Merge branch 'development' of github.com:0xProject/0x.js into development

* 'development' of github.com:0xProject/0x.js: (24 commits)
  Rename variables
  Update CHANGELOG
  Add npm config for contracts list
  Run prettier
  Fix checks, add contract list to compile script in package.json
  Add contracts to compiler options
  Add missing public types from connect docs
  Change imports order
  Change default page params in connect to page 1 and perPage 100
  Add docs staging to 0x.js package
  Fix a typo
  Add an assertion
  Add PR numbers
  Fix entry points
  Add tests for dev-utils package
  Move subproviders from dev-utils to subproviders
  Add missing CHANGELOG entry
  Add support for intersection types in docs
  Add stagedocs script to connect package
  web3 typings fix - web3.net.peerCount returns number
  ...
This commit is contained in:
Fabio Berger
2018-02-15 20:09:53 -07:00
59 changed files with 403 additions and 1348 deletions

View File

@@ -0,0 +1,24 @@
const execAsync = require('async-child-process').execAsync;
const postpublish_utils = require('../../../scripts/postpublish_utils');
const cwd = __dirname + '/..';
const S3BucketPath = 's3://staging-0xjs-docs-jsons/';
const jsonFilePath = __dirname + '/../' + postpublish_utils.generatedDocsDirectoryName + '/index.json';
const version = process.env.DOCS_VERSION;
execAsync('JSON_FILE_PATH=' + jsonFilePath + ' PROJECT_DIR=' + __dirname + '/.. yarn docs:json', {
cwd,
})
.then(function(result) {
if (result.stderr !== '') {
throw new Error(result.stderr);
}
const fileName = 'v' + version + '.json';
const s3Url = S3BucketPath + fileName;
return execAsync('S3_URL=' + s3Url + ' yarn upload_docs_json', {
cwd,
});
})
.catch(function(err) {
console.log(err);
});

View File

@@ -1,5 +1,9 @@
# CHANGELOG
## v0.6.0 - _TBD, 2018_
* Add pagination options to HttpClient methods (#393)
## v0.5.7 - _February 9, 2018_
* Fix publishing issue where .npmignore was not properly excluding undesired content (#389)

View File

@@ -0,0 +1,24 @@
const execAsync = require('async-child-process').execAsync;
const postpublish_utils = require('../../../scripts/postpublish_utils');
const cwd = __dirname + '/..';
const S3BucketPath = 's3://staging-connect-docs-jsons/';
const jsonFilePath = __dirname + '/../' + postpublish_utils.generatedDocsDirectoryName + '/index.json';
const version = process.env.DOCS_VERSION;
execAsync('JSON_FILE_PATH=' + jsonFilePath + ' PROJECT_DIR=' + __dirname + '/.. yarn docs:json', {
cwd,
})
.then(function(result) {
if (result.stderr !== '') {
throw new Error(result.stderr);
}
const fileName = 'v' + version + '.json';
const s3Url = S3BucketPath + fileName;
return execAsync('S3_URL=' + s3Url + ' yarn upload_docs_json', {
cwd,
});
})
.catch(function(err) {
console.log(err);
});

View File

@@ -13,20 +13,48 @@ import {
HttpRequestType,
OrderbookRequest,
OrderbookResponse,
OrdersRequest,
OrdersRequestOpts,
PagedRequestOpts,
SignedOrder,
TokenPairsItem,
TokenPairsRequest,
TokenPairsRequestOpts,
} from './types';
import { relayerResponseJsonParsers } from './utils/relayer_response_json_parsers';
const TRAILING_SLASHES_REGEX = /\/+$/;
const DEFAULT_PAGED_REQUEST_OPTS: PagedRequestOpts = {
page: 1,
perPage: 100,
};
/**
* This mapping defines how an option property name gets converted into an HTTP request query field
*/
const OPTS_TO_QUERY_FIELD_MAP = {
perPage: 'per_page',
};
/**
* This class includes all the functionality related to interacting with a set of HTTP endpoints
* that implement the standard relayer API v0
*/
export class HttpClient implements Client {
private _apiEndpointUrl: string;
/**
* Format parameters to be appended to http requests into query string form
*/
private static _buildQueryStringFromHttpParams(params?: object): string {
// if params are undefined or empty, return an empty string
if (_.isUndefined(params) || _.isEmpty(params)) {
return '';
}
// format params into a form the api expects
const formattedParams = _.mapKeys(params, (value: any, key: string) => {
return _.get(OPTS_TO_QUERY_FIELD_MAP, key, key);
});
// stringify the formatted object
const stringifiedParams = queryString.stringify(formattedParams);
return `?${stringifiedParams}`;
}
/**
* Instantiates a new HttpClient instance
* @param url The relayer API base HTTP url you would like to interact with
@@ -38,34 +66,35 @@ export class HttpClient implements Client {
}
/**
* Retrieve token pair info from the API
* @param request A TokenPairsRequest instance describing specific token information
* to retrieve
* @param requestOpts Options specifying token information to retrieve and page information, defaults to { page: 1, perPage: 100 }
* @return The resulting TokenPairsItems that match the request
*/
public async getTokenPairsAsync(request?: TokenPairsRequest): Promise<TokenPairsItem[]> {
if (!_.isUndefined(request)) {
assert.doesConformToSchema('request', request, clientSchemas.relayerTokenPairsRequestSchema);
public async getTokenPairsAsync(requestOpts?: TokenPairsRequestOpts & PagedRequestOpts): Promise<TokenPairsItem[]> {
if (!_.isUndefined(requestOpts)) {
assert.doesConformToSchema('requestOpts', requestOpts, clientSchemas.tokenPairsRequestOptsSchema);
assert.doesConformToSchema('requestOpts', requestOpts, clientSchemas.pagedRequestOptsSchema);
}
const requestOpts = {
params: request,
const httpRequestOpts = {
params: _.defaults({}, requestOpts, DEFAULT_PAGED_REQUEST_OPTS),
};
const responseJson = await this._requestAsync('/token_pairs', HttpRequestType.Get, requestOpts);
const responseJson = await this._requestAsync('/token_pairs', HttpRequestType.Get, httpRequestOpts);
const tokenPairs = relayerResponseJsonParsers.parseTokenPairsJson(responseJson);
return tokenPairs;
}
/**
* Retrieve orders from the API
* @param request An OrdersRequest instance describing specific orders to retrieve
* @param requestOpts Options specifying orders to retrieve and page information, defaults to { page: 1, perPage: 100 }
* @return The resulting SignedOrders that match the request
*/
public async getOrdersAsync(request?: OrdersRequest): Promise<SignedOrder[]> {
if (!_.isUndefined(request)) {
assert.doesConformToSchema('request', request, clientSchemas.relayerOrdersRequestSchema);
public async getOrdersAsync(requestOpts?: OrdersRequestOpts & PagedRequestOpts): Promise<SignedOrder[]> {
if (!_.isUndefined(requestOpts)) {
assert.doesConformToSchema('requestOpts', requestOpts, clientSchemas.ordersRequestOptsSchema);
assert.doesConformToSchema('requestOpts', requestOpts, clientSchemas.pagedRequestOptsSchema);
}
const requestOpts = {
params: request,
const httpRequestOpts = {
params: _.defaults({}, requestOpts, DEFAULT_PAGED_REQUEST_OPTS),
};
const responseJson = await this._requestAsync(`/orders`, HttpRequestType.Get, requestOpts);
const responseJson = await this._requestAsync(`/orders`, HttpRequestType.Get, httpRequestOpts);
const orders = relayerResponseJsonParsers.parseOrdersJson(responseJson);
return orders;
}
@@ -83,14 +112,21 @@ export class HttpClient implements Client {
/**
* Retrieve an orderbook from the API
* @param request An OrderbookRequest instance describing the specific orderbook to retrieve
* @param requestOpts Options specifying page information, defaults to { page: 1, perPage: 100 }
* @return The resulting OrderbookResponse that matches the request
*/
public async getOrderbookAsync(request: OrderbookRequest): Promise<OrderbookResponse> {
assert.doesConformToSchema('request', request, clientSchemas.relayerOrderBookRequestSchema);
const requestOpts = {
params: request,
public async getOrderbookAsync(
request: OrderbookRequest,
requestOpts?: PagedRequestOpts,
): Promise<OrderbookResponse> {
assert.doesConformToSchema('request', request, clientSchemas.orderBookRequestSchema);
if (!_.isUndefined(requestOpts)) {
assert.doesConformToSchema('requestOpts', requestOpts, clientSchemas.pagedRequestOptsSchema);
}
const httpRequestOpts = {
params: _.defaults({}, request, requestOpts, DEFAULT_PAGED_REQUEST_OPTS),
};
const responseJson = await this._requestAsync('/orderbook', HttpRequestType.Get, requestOpts);
const responseJson = await this._requestAsync('/orderbook', HttpRequestType.Get, httpRequestOpts);
const orderbook = relayerResponseJsonParsers.parseOrderbookResponseJson(responseJson);
return orderbook;
}
@@ -100,11 +136,11 @@ export class HttpClient implements Client {
* @return The resulting FeesResponse that matches the request
*/
public async getFeesAsync(request: FeesRequest): Promise<FeesResponse> {
assert.doesConformToSchema('request', request, schemas.relayerApiFeesPayloadSchema);
const requestOpts = {
assert.doesConformToSchema('request', request, clientSchemas.feesRequestSchema);
const httpRequestOpts = {
payload: request,
};
const responseJson = await this._requestAsync('/fees', HttpRequestType.Post, requestOpts);
const responseJson = await this._requestAsync('/fees', HttpRequestType.Post, httpRequestOpts);
const fees = relayerResponseJsonParsers.parseFeesResponseJson(responseJson);
return fees;
}
@@ -126,11 +162,7 @@ export class HttpClient implements Client {
): Promise<any> {
const params = _.get(requestOptions, 'params');
const payload = _.get(requestOptions, 'payload');
let query = '';
if (!_.isUndefined(params) && !_.isEmpty(params)) {
const stringifiedParams = queryString.stringify(params);
query = `?${stringifiedParams}`;
}
const query = HttpClient._buildQueryStringFromHttpParams(params);
const url = `${this._apiEndpointUrl}${path}${query}`;
const headers = new Headers({
'content-type': 'application/json',

View File

@@ -11,9 +11,10 @@ export {
OrderbookChannelSubscriptionOpts,
OrderbookRequest,
OrderbookResponse,
OrdersRequest,
OrdersRequestOpts,
PagedRequestOpts,
SignedOrder,
TokenPairsItem,
TokenPairsRequest,
TokenPairsRequestOpts,
TokenTradeInfo,
} from './types';

View File

@@ -0,0 +1,26 @@
export const feesRequestSchema = {
id: '/FeesRequest',
type: 'object',
properties: {
exchangeContractAddress: { $ref: '/Address' },
maker: { $ref: '/Address' },
taker: { $ref: '/Address' },
makerTokenAddress: { $ref: '/Address' },
takerTokenAddress: { $ref: '/Address' },
makerTokenAmount: { $ref: '/Number' },
takerTokenAmount: { $ref: '/Number' },
expirationUnixTimestampSec: { $ref: '/Number' },
salt: { $ref: '/Number' },
},
required: [
'exchangeContractAddress',
'maker',
'taker',
'makerTokenAddress',
'takerTokenAddress',
'makerTokenAmount',
'takerTokenAmount',
'expirationUnixTimestampSec',
'salt',
],
};

View File

@@ -1,8 +1,9 @@
export const relayerOrderBookRequestSchema = {
id: '/RelayerOrderBookRequest',
export const orderBookRequestSchema = {
id: '/OrderBookRequest',
type: 'object',
properties: {
baseTokenAddress: { $ref: '/Address' },
quoteTokenAddress: { $ref: '/Address' },
},
required: ['baseTokenAddress', 'quoteTokenAddress'],
};

View File

@@ -1,5 +1,5 @@
export const relayerOrdersRequestSchema = {
id: '/RelayerOrdersRequest',
export const ordersRequestOptsSchema = {
id: '/OrdersRequestOpts',
type: 'object',
properties: {
exchangeContractAddress: { $ref: '/Address' },

View File

@@ -0,0 +1,8 @@
export const pagedRequestOptsSchema = {
id: '/PagedRequestOpts',
type: 'object',
properties: {
page: { type: 'number' },
perPage: { type: 'number' },
},
};

View File

@@ -1,8 +0,0 @@
export const relayerOrderBookRequestSchema = {
id: '/RelayerOrderBookRequest',
type: 'object',
properties: {
baseTokenAddress: { $ref: '/Address' },
quoteTokenAddress: { $ref: '/Address' },
},
};

View File

@@ -1,9 +1,13 @@
import { relayerOrderBookRequestSchema } from './relayer_orderbook_request_schema';
import { relayerOrdersRequestSchema } from './relayer_orders_request_schema';
import { relayerTokenPairsRequestSchema } from './relayer_token_pairs_request_schema';
import { feesRequestSchema } from './fees_request_schema';
import { orderBookRequestSchema } from './orderbook_request_schema';
import { ordersRequestOptsSchema } from './orders_request_opts_schema';
import { pagedRequestOptsSchema } from './paged_request_opts_schema';
import { tokenPairsRequestOptsSchema } from './token_pairs_request_opts_schema';
export const schemas = {
relayerOrderBookRequestSchema,
relayerOrdersRequestSchema,
relayerTokenPairsRequestSchema,
feesRequestSchema,
orderBookRequestSchema,
ordersRequestOptsSchema,
pagedRequestOptsSchema,
tokenPairsRequestOptsSchema,
};

View File

@@ -1,5 +1,5 @@
export const relayerTokenPairsRequestSchema = {
id: '/RelayerTokenPairsRequest',
export const tokenPairsRequestOptsSchema = {
id: '/TokenPairsRequestOpts',
type: 'object',
properties: {
tokenA: { $ref: '/Address' },

View File

@@ -30,10 +30,10 @@ export interface ECSignature {
}
export interface Client {
getTokenPairsAsync: (request?: TokenPairsRequest) => Promise<TokenPairsItem[]>;
getOrdersAsync: (request?: OrdersRequest) => Promise<SignedOrder[]>;
getTokenPairsAsync: (requestOpts?: TokenPairsRequestOpts & PagedRequestOpts) => Promise<TokenPairsItem[]>;
getOrdersAsync: (requestOpts?: OrdersRequestOpts & PagedRequestOpts) => Promise<SignedOrder[]>;
getOrderAsync: (orderHash: string) => Promise<SignedOrder>;
getOrderbookAsync: (request: OrderbookRequest) => Promise<OrderbookResponse>;
getOrderbookAsync: (request: OrderbookRequest, requestOpts?: PagedRequestOpts) => Promise<OrderbookResponse>;
getFeesAsync: (request: FeesRequest) => Promise<FeesResponse>;
submitOrderAsync: (signedOrder: SignedOrder) => Promise<void>;
}
@@ -111,7 +111,7 @@ export enum WebsocketClientEventType {
ConnectFailed = 'connectFailed',
}
export interface TokenPairsRequest {
export interface TokenPairsRequestOpts {
tokenA?: string;
tokenB?: string;
}
@@ -128,7 +128,7 @@ export interface TokenTradeInfo {
precision: number;
}
export interface OrdersRequest {
export interface OrdersRequestOpts {
exchangeContractAddress?: string;
tokenAddress?: string;
makerTokenAddress?: string;
@@ -167,6 +167,11 @@ export interface FeesResponse {
takerFee: BigNumber;
}
export interface PagedRequestOpts {
page?: number;
perPage?: number;
}
export interface HttpRequestOptions {
params?: object;
payload?: object;

View File

@@ -40,19 +40,22 @@ describe('HttpClient', () => {
});
describe('#getTokenPairsAsync', () => {
const url = `${relayUrl}/token_pairs`;
it('gets token pairs', async () => {
fetchMock.get(url, tokenPairsResponseJSON);
it('gets token pairs with default options when none are provided', async () => {
const urlWithQuery = `${url}?page=1&per_page=100`;
fetchMock.get(urlWithQuery, tokenPairsResponseJSON);
const tokenPairs = await relayerClient.getTokenPairsAsync();
expect(tokenPairs).to.be.deep.equal(tokenPairsResponse);
});
it('gets specific token pairs for request', async () => {
it('gets token pairs with specified request options', async () => {
const tokenAddress = '0x323b5d4c32345ced77393b3530b1eed0f346429d';
const tokenPairsRequest = {
const tokenPairsRequestOpts = {
tokenA: tokenAddress,
page: 3,
perPage: 50,
};
const urlWithQuery = `${url}?tokenA=${tokenAddress}`;
const urlWithQuery = `${url}?page=3&per_page=50&tokenA=${tokenAddress}`;
fetchMock.get(urlWithQuery, tokenPairsResponseJSON);
const tokenPairs = await relayerClient.getTokenPairsAsync(tokenPairsRequest);
const tokenPairs = await relayerClient.getTokenPairsAsync(tokenPairsRequestOpts);
expect(tokenPairs).to.be.deep.equal(tokenPairsResponse);
});
it('throws an error for invalid JSON response', async () => {
@@ -62,17 +65,20 @@ describe('HttpClient', () => {
});
describe('#getOrdersAsync', () => {
const url = `${relayUrl}/orders`;
it('gets orders', async () => {
fetchMock.get(url, ordersResponseJSON);
it('gets orders with default options when none are provided', async () => {
const urlWithQuery = `${url}?page=1&per_page=100`;
fetchMock.get(urlWithQuery, ordersResponseJSON);
const orders = await relayerClient.getOrdersAsync();
expect(orders).to.be.deep.equal(ordersResponse);
});
it('gets specific orders for request', async () => {
it('gets orders with specified request options', async () => {
const tokenAddress = '0x323b5d4c32345ced77393b3530b1eed0f346429d';
const ordersRequest = {
tokenAddress,
page: 3,
perPage: 50,
};
const urlWithQuery = `${url}?tokenAddress=${tokenAddress}`;
const urlWithQuery = `${url}?page=3&per_page=50&tokenAddress=${tokenAddress}`;
fetchMock.get(urlWithQuery, ordersResponseJSON);
const orders = await relayerClient.getOrdersAsync(ordersRequest);
expect(orders).to.be.deep.equal(ordersResponse);
@@ -100,14 +106,27 @@ describe('HttpClient', () => {
baseTokenAddress: '0x323b5d4c32345ced77393b3530b1eed0f346429d',
quoteTokenAddress: '0xa2b31dacf30a9c50ca473337c01d8a201ae33e32',
};
const url = `${relayUrl}/orderbook?baseTokenAddress=${request.baseTokenAddress}&quoteTokenAddress=${
request.quoteTokenAddress
}`;
it('gets order book', async () => {
fetchMock.get(url, orderbookJSON);
const url = `${relayUrl}/orderbook`;
it('gets orderbook with default page options when none are provided', async () => {
const urlWithQuery = `${url}?baseTokenAddress=${
request.baseTokenAddress
}&page=1&per_page=100&quoteTokenAddress=${request.quoteTokenAddress}`;
fetchMock.get(urlWithQuery, orderbookJSON);
const orderbook = await relayerClient.getOrderbookAsync(request);
expect(orderbook).to.be.deep.equal(orderbookResponse);
});
it('gets orderbook with specified page options', async () => {
const urlWithQuery = `${url}?baseTokenAddress=${
request.baseTokenAddress
}&page=3&per_page=50&quoteTokenAddress=${request.quoteTokenAddress}`;
fetchMock.get(urlWithQuery, orderbookJSON);
const pagedRequestOptions = {
page: 3,
perPage: 50,
};
const orderbook = await relayerClient.getOrderbookAsync(request, pagedRequestOptions);
expect(orderbook).to.be.deep.equal(orderbookResponse);
});
it('throws an error for invalid JSON response', async () => {
fetchMock.get(url, { test: 'dummy' });
expect(relayerClient.getOrderbookAsync(request)).to.be.rejected();

View File

@@ -15,13 +15,16 @@
"test": "run-s compile build run_mocha",
"run_mocha": "mocha 'lib/test/**/*.js' --timeout 10000 --bail --exit",
"compile:comment": "Yarn workspaces do not link binaries correctly so we need to reference them directly https://github.com/yarnpkg/yarn/issues/3846",
"compile": "node ../deployer/lib/src/cli.js compile --contracts-dir src/contracts --artifacts-dir src/artifacts",
"clean": "rm -rf ./lib",
"compile": "node ../deployer/lib/src/cli.js compile --contracts ${npm_package_config_contracts} --contracts-dir src/contracts --artifacts-dir src/artifacts",
"clean": "shx rm -rf ./lib",
"generate_contract_wrappers": "node ../abi-gen/lib/index.js --abis 'src/artifacts/@(DummyToken|TokenTransferProxy|Exchange|TokenRegistry|MultiSigWallet|MultiSigWalletWithTimeLock|MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress|TokenRegistry|ZRXToken).json' --template contract_templates/contract.handlebars --partials 'contract_templates/partials/**/*.handlebars' --output src/contract_wrappers/generated",
"migrate": "node ../deployer/lib/src/cli.js migrate",
"lint": "tslint --project . 'migrations/**/*.ts' 'test/**/*.ts' 'util/**/*.ts' 'deploy/**/*.ts'",
"test:circleci": "yarn test"
},
"config": {
"contracts": "Exchange,DummyToken,ZRXToken,Token,WETH9,TokenTransferProxy,MultiSigWallet,MultiSigWalletWithTimeLock,MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress,MaliciousToken,TokenRegistry"
},
"repository": {
"type": "git",
"url": "https://github.com/0xProject/0x.js.git"
@@ -51,6 +54,7 @@
"mocha": "^4.0.1",
"npm-run-all": "^4.1.2",
"solc": "^0.4.18",
"shx": "^0.2.2",
"tslint": "5.8.0",
"types-bn": "^0.0.1",
"types-ethereumjs-util": "0xProject/types-ethereumjs-util",

File diff suppressed because one or more lines are too long

View File

@@ -1,188 +0,0 @@
{
"contract_name": "ERC20Token",
"networks": {
"50": {
"solc_version": "0.4.18",
"keccak256": "0x31be5b5f8d7ae32e5ac282b8740cc7aa87cdc383cabafa02292ea6f38302efcc",
"optimizer_enabled": 0,
"abi": [
{
"constant": false,
"inputs": [
{
"name": "_spender",
"type": "address"
},
{
"name": "_value",
"type": "uint256"
}
],
"name": "approve",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "totalSupply",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "_from",
"type": "address"
},
{
"name": "_to",
"type": "address"
},
{
"name": "_value",
"type": "uint256"
}
],
"name": "transferFrom",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "_owner",
"type": "address"
}
],
"name": "balanceOf",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "_to",
"type": "address"
},
{
"name": "_value",
"type": "uint256"
}
],
"name": "transfer",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "_owner",
"type": "address"
},
{
"name": "_spender",
"type": "address"
}
],
"name": "allowance",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "_from",
"type": "address"
},
{
"indexed": true,
"name": "_to",
"type": "address"
},
{
"indexed": false,
"name": "_value",
"type": "uint256"
}
],
"name": "Transfer",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "_owner",
"type": "address"
},
{
"indexed": true,
"name": "_spender",
"type": "address"
},
{
"indexed": false,
"name": "_value",
"type": "uint256"
}
],
"name": "Approval",
"type": "event"
}
],
"unlinked_binary":
"0x6060604052341561000f57600080fd5b6109528061001e6000396000f300606060405260043610610078576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063095ea7b31461007d57806318160ddd146100d757806323b872dd1461010057806370a0823114610179578063a9059cbb146101c6578063dd62ed3e14610220575b600080fd5b341561008857600080fd5b6100bd600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061028c565b604051808215151515815260200191505060405180910390f35b34156100e257600080fd5b6100ea61037e565b6040518082815260200191505060405180910390f35b341561010b57600080fd5b61015f600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610384565b604051808215151515815260200191505060405180910390f35b341561018457600080fd5b6101b0600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610677565b6040518082815260200191505060405180910390f35b34156101d157600080fd5b610206600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506106bf565b604051808215151515815260200191505060405180910390f35b341561022b57600080fd5b610276600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061089f565b6040518082815260200191505060405180910390f35b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60025481565b6000816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015610450575081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b80156104da57506000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020540110155b15156104e557600080fd5b816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015801561078d57506000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020540110155b151561079857600080fd5b816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050929150505600a165627a7a72305820d9af9b2b6ffe19f00d45d30a243f833e31053a2e48142e183c9f1e6b0ead7a9e0029",
"updated_at": 1517509619365
}
}
}

View File

@@ -1,182 +0,0 @@
{
"contract_name": "ERC20Token_v1",
"networks": {
"50": {
"solc_version": "0.4.11",
"keccak256": "0x3d710b436c430d6fe49f64b091555405360d76da6454b93faa8e213eea34a96d",
"optimizer_enabled": 0,
"abi": [
{
"constant": false,
"inputs": [
{
"name": "_spender",
"type": "address"
},
{
"name": "_value",
"type": "uint256"
}
],
"name": "approve",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "totalSupply",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "_from",
"type": "address"
},
{
"name": "_to",
"type": "address"
},
{
"name": "_value",
"type": "uint256"
}
],
"name": "transferFrom",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "_owner",
"type": "address"
}
],
"name": "balanceOf",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "_to",
"type": "address"
},
{
"name": "_value",
"type": "uint256"
}
],
"name": "transfer",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "_owner",
"type": "address"
},
{
"name": "_spender",
"type": "address"
}
],
"name": "allowance",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"type": "function"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "_from",
"type": "address"
},
{
"indexed": true,
"name": "_to",
"type": "address"
},
{
"indexed": false,
"name": "_value",
"type": "uint256"
}
],
"name": "Transfer",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "_owner",
"type": "address"
},
{
"indexed": true,
"name": "_spender",
"type": "address"
},
{
"indexed": false,
"name": "_value",
"type": "uint256"
}
],
"name": "Approval",
"type": "event"
}
],
"unlinked_binary":
"0x6060604052341561000c57fe5b5b61095b8061001c6000396000f30060606040523615610076576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063095ea7b31461007857806318160ddd146100cf57806323b872dd146100f557806370a082311461016b578063a9059cbb146101b5578063dd62ed3e1461020c575bfe5b341561008057fe5b6100b5600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610275565b604051808215151515815260200191505060405180910390f35b34156100d757fe5b6100df610368565b6040518082815260200191505060405180910390f35b34156100fd57fe5b610151600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061036e565b604051808215151515815260200191505060405180910390f35b341561017357fe5b61019f600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061066f565b6040518082815260200191505060405180910390f35b34156101bd57fe5b6101f2600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506106b9565b604051808215151515815260200191505060405180910390f35b341561021457fe5b61025f600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506108a7565b6040518082815260200191505060405180910390f35b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a3600190505b92915050565b60025481565b600081600060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015801561043b575081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b80156104c75750600060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482600060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020540110155b1561065e5781600060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555081600060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050610668565b60009050610668565b5b9392505050565b6000600060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490505b919050565b600081600060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015801561078a5750600060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482600060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020540110155b156108975781600060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190506108a1565b600090506108a1565b5b92915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490505b929150505600a165627a7a72305820441601e8451e1c2d31e6cde19fc920b8f95e79f9d42dd662aeefad13fd8bcfaa0029",
"updated_at": 1517509621756
}
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,49 +0,0 @@
{
"contract_name": "Ownable",
"networks": {
"50": {
"solc_version": "0.4.18",
"keccak256": "0x04e5204925913f5ff6b8193f4ab38eef9d53fc9a553f1a737924fc69db492a99",
"optimizer_enabled": 0,
"abi": [
{
"constant": true,
"inputs": [],
"name": "owner",
"outputs": [
{
"name": "",
"type": "address"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "newOwner",
"type": "address"
}
],
"name": "transferOwnership",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "constructor"
}
],
"unlinked_binary":
"0x6060604052341561000f57600080fd5b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506102058061005e6000396000f30060606040526004361061004c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680638da5cb5b14610051578063f2fde38b146100a6575b600080fd5b341561005c57600080fd5b6100646100df565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156100b157600080fd5b6100dd600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610104565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561015f57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415156101d657806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b505600a165627a7a723058202c25abe7564c2f872e2f210a96faa6c7691055d67e9a3edd56dcef376c646e170029",
"updated_at": 1517509621376
}
}
}

View File

@@ -1,46 +0,0 @@
{
"contract_name": "Ownable_v1",
"networks": {
"50": {
"solc_version": "0.4.11",
"keccak256": "0x82a6595d8d4c3c9cd44ef0fd8f77528195c35c8173970d2b119374f5d74332f4",
"optimizer_enabled": 0,
"abi": [
{
"constant": true,
"inputs": [],
"name": "owner",
"outputs": [
{
"name": "",
"type": "address"
}
],
"payable": false,
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "newOwner",
"type": "address"
}
],
"name": "transferOwnership",
"outputs": [],
"payable": false,
"type": "function"
},
{
"inputs": [],
"payable": false,
"type": "constructor"
}
],
"unlinked_binary":
"0x6060604052341561000c57fe5b5b33600060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b5b6101fa8061005f6000396000f30060606040526000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680638da5cb5b14610046578063f2fde38b14610098575bfe5b341561004e57fe5b6100566100ce565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156100a057fe5b6100cc600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506100f4565b005b600060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156101515760006000fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415156101c95780600060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b5b5b505600a165627a7a723058201bce811586dc86b1fc25fa9779089c5bf0b5d2cf9e981a580ef44253300866520029",
"updated_at": 1517535966230
}
}
}

View File

@@ -1,14 +0,0 @@
{
"contract_name": "SafeMath",
"networks": {
"50": {
"solc_version": "0.4.18",
"keccak256": "0xb1d52f567a893c86f452bd80fbb6907d992046a31b35830bc779116d23fd5549",
"optimizer_enabled": 0,
"abi": [],
"unlinked_binary":
"0x60606040523415600e57600080fd5b603580601b6000396000f3006060604052600080fd00a165627a7a723058206526256c7c1e7d1d1b2df1caefcbd76717428d6237de37aacbb5097658456b720029",
"updated_at": 1517509621492
}
}
}

View File

@@ -1,14 +0,0 @@
{
"contract_name": "SafeMath_v1",
"networks": {
"50": {
"solc_version": "0.4.11",
"keccak256": "0xd2c1f0518a23e63d5892f66e7b8d228c7486495b139a0f3b049f6ba7803c892d",
"optimizer_enabled": 0,
"abi": [],
"unlinked_binary":
"0x60606040523415600b57fe5b5b60338060196000396000f30060606040525bfe00a165627a7a72305820acbb91f6e4b200e929056917b84223c3fedbdeca5c35f7bf9292edf2a8ee4aa00029",
"updated_at": 1517509621851
}
}
}

View File

@@ -168,7 +168,7 @@
],
"unlinked_binary":
"0x6060604052341561000f57600080fd5b6102ac8061001e6000396000f30060606040526004361061006d576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063095ea7b31461007257806323b872dd146100cc57806370a0823114610145578063a9059cbb14610192578063dd62ed3e146101ec575b600080fd5b341561007d57600080fd5b6100b2600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610258565b604051808215151515815260200191505060405180910390f35b34156100d757600080fd5b61012b600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610260565b604051808215151515815260200191505060405180910390f35b341561015057600080fd5b61017c600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610269565b6040518082815260200191505060405180910390f35b341561019d57600080fd5b6101d2600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610270565b604051808215151515815260200191505060405180910390f35b34156101f757600080fd5b610242600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610278565b6040518082815260200191505060405180910390f35b600092915050565b60009392505050565b6000919050565b600092915050565b6000929150505600a165627a7a723058201ef98a5ecc619c89a935fee340b114a09fe44aa51aa765f4037dd3423f49d42d0029",
"updated_at": 1517509619496
"updated_at": 1518645860796
}
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,182 +0,0 @@
{
"contract_name": "Token_v1",
"networks": {
"50": {
"solc_version": "0.4.11",
"keccak256": "0x35a82bc7bc0994caa97f8ea44660b9b5e796acfe72705b5ff7ed8f2a3c47ff37",
"optimizer_enabled": 0,
"abi": [
{
"constant": false,
"inputs": [
{
"name": "_spender",
"type": "address"
},
{
"name": "_value",
"type": "uint256"
}
],
"name": "approve",
"outputs": [
{
"name": "success",
"type": "bool"
}
],
"payable": false,
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "totalSupply",
"outputs": [
{
"name": "supply",
"type": "uint256"
}
],
"payable": false,
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "_from",
"type": "address"
},
{
"name": "_to",
"type": "address"
},
{
"name": "_value",
"type": "uint256"
}
],
"name": "transferFrom",
"outputs": [
{
"name": "success",
"type": "bool"
}
],
"payable": false,
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "_owner",
"type": "address"
}
],
"name": "balanceOf",
"outputs": [
{
"name": "balance",
"type": "uint256"
}
],
"payable": false,
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "_to",
"type": "address"
},
{
"name": "_value",
"type": "uint256"
}
],
"name": "transfer",
"outputs": [
{
"name": "success",
"type": "bool"
}
],
"payable": false,
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "_owner",
"type": "address"
},
{
"name": "_spender",
"type": "address"
}
],
"name": "allowance",
"outputs": [
{
"name": "remaining",
"type": "uint256"
}
],
"payable": false,
"type": "function"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "_from",
"type": "address"
},
{
"indexed": true,
"name": "_to",
"type": "address"
},
{
"indexed": false,
"name": "_value",
"type": "uint256"
}
],
"name": "Transfer",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "_owner",
"type": "address"
},
{
"indexed": true,
"name": "_spender",
"type": "address"
},
{
"indexed": false,
"name": "_value",
"type": "uint256"
}
],
"name": "Approval",
"type": "event"
}
],
"unlinked_binary":
"0x6060604052341561000c57fe5b5b6102d48061001c6000396000f30060606040523615610076576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063095ea7b31461007857806318160ddd146100cf57806323b872dd146100f557806370a082311461016b578063a9059cbb146101b5578063dd62ed3e1461020c575bfe5b341561008057fe5b6100b5600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610275565b604051808215151515815260200191505060405180910390f35b34156100d757fe5b6100df61027e565b6040518082815260200191505060405180910390f35b34156100fd57fe5b610151600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610284565b604051808215151515815260200191505060405180910390f35b341561017357fe5b61019f600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061028e565b6040518082815260200191505060405180910390f35b34156101bd57fe5b6101f2600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610296565b604051808215151515815260200191505060405180910390f35b341561021457fe5b61025f600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061029f565b6040518082815260200191505060405180910390f35b60005b92915050565b60005b90565b60005b9392505050565b60005b919050565b60005b92915050565b60005b929150505600a165627a7a72305820b8fd6d6a6fe5fb53fa4968f246aad074b179498a6d15208c4b2d8be473df69420029",
"updated_at": 1517509621946
}
}
}

View File

@@ -1,188 +0,0 @@
{
"contract_name": "UnlimitedAllowanceToken",
"networks": {
"50": {
"solc_version": "0.4.18",
"keccak256": "0xfc55032f0942ce4081a9f8c3eacfa0bddf61e1fb76593c8d6514adcb97a96690",
"optimizer_enabled": 0,
"abi": [
{
"constant": false,
"inputs": [
{
"name": "_spender",
"type": "address"
},
{
"name": "_value",
"type": "uint256"
}
],
"name": "approve",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "totalSupply",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "_from",
"type": "address"
},
{
"name": "_to",
"type": "address"
},
{
"name": "_value",
"type": "uint256"
}
],
"name": "transferFrom",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "_owner",
"type": "address"
}
],
"name": "balanceOf",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "_to",
"type": "address"
},
{
"name": "_value",
"type": "uint256"
}
],
"name": "transfer",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "_owner",
"type": "address"
},
{
"name": "_spender",
"type": "address"
}
],
"name": "allowance",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "_from",
"type": "address"
},
{
"indexed": true,
"name": "_to",
"type": "address"
},
{
"indexed": false,
"name": "_value",
"type": "uint256"
}
],
"name": "Transfer",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "_owner",
"type": "address"
},
{
"indexed": true,
"name": "_spender",
"type": "address"
},
{
"indexed": false,
"name": "_value",
"type": "uint256"
}
],
"name": "Approval",
"type": "event"
}
],
"unlinked_binary":
"0x6060604052341561000f57600080fd5b6109808061001e6000396000f300606060405260043610610078576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063095ea7b31461007d57806318160ddd146100d757806323b872dd1461010057806370a0823114610179578063a9059cbb146101c6578063dd62ed3e14610220575b600080fd5b341561008857600080fd5b6100bd600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061028c565b604051808215151515815260200191505060405180910390f35b34156100e257600080fd5b6100ea61037e565b6040518082815260200191505060405180910390f35b341561010b57600080fd5b61015f600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610384565b604051808215151515815260200191505060405180910390f35b341561018457600080fd5b6101b0600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506106a5565b6040518082815260200191505060405180910390f35b34156101d157600080fd5b610206600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506106ed565b604051808215151515815260200191505060405180910390f35b341561022b57600080fd5b610276600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506108cd565b6040518082815260200191505060405180910390f35b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60025481565b600080600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101580156104545750828110155b80156104de57506000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020540110155b15156104e957600080fd5b826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8110156106345782600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055505b8373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019150509392505050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101580156107bb57506000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020540110155b15156107c657600080fd5b816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050929150505600a165627a7a72305820fcfe717221cfe35887f7cf953f3c89ebf20f5cc389a92a5b68e2fd22c236d0e30029",
"updated_at": 1517509620184
}
}
}

View File

@@ -1,182 +0,0 @@
{
"contract_name": "UnlimitedAllowanceToken_v1",
"networks": {
"50": {
"solc_version": "0.4.11",
"keccak256": "0x3b548a72cde0786747f9bdf42901fcf51ec546ced40506335d28b0778e35d25a",
"optimizer_enabled": 0,
"abi": [
{
"constant": false,
"inputs": [
{
"name": "_spender",
"type": "address"
},
{
"name": "_value",
"type": "uint256"
}
],
"name": "approve",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "totalSupply",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "_from",
"type": "address"
},
{
"name": "_to",
"type": "address"
},
{
"name": "_value",
"type": "uint256"
}
],
"name": "transferFrom",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "_owner",
"type": "address"
}
],
"name": "balanceOf",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "_to",
"type": "address"
},
{
"name": "_value",
"type": "uint256"
}
],
"name": "transfer",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "_owner",
"type": "address"
},
{
"name": "_spender",
"type": "address"
}
],
"name": "allowance",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"type": "function"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "_from",
"type": "address"
},
{
"indexed": true,
"name": "_to",
"type": "address"
},
{
"indexed": false,
"name": "_value",
"type": "uint256"
}
],
"name": "Transfer",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "_owner",
"type": "address"
},
{
"indexed": true,
"name": "_spender",
"type": "address"
},
{
"indexed": false,
"name": "_value",
"type": "uint256"
}
],
"name": "Approval",
"type": "event"
}
],
"unlinked_binary":
"0x6060604052341561000c57fe5b5b61098a8061001c6000396000f30060606040523615610076576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063095ea7b31461007857806318160ddd146100cf57806323b872dd146100f557806370a082311461016b578063a9059cbb146101b5578063dd62ed3e1461020c575bfe5b341561008057fe5b6100b5600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610275565b604051808215151515815260200191505060405180910390f35b34156100d757fe5b6100df610368565b6040518082815260200191505060405180910390f35b34156100fd57fe5b610151600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061036e565b604051808215151515815260200191505060405180910390f35b341561017357fe5b61019f600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061069e565b6040518082815260200191505060405180910390f35b34156101bd57fe5b6101f2600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506106e8565b604051808215151515815260200191505060405180910390f35b341561021457fe5b61025f600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506108d6565b6040518082815260200191505060405180910390f35b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a3600190505b92915050565b60025481565b60006000600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082600060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101580156104405750828110155b80156104cc5750600060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483600060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020540110155b1561068c5782600060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555082600060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81101561061e5782600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055505b8373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019150610696565b60009150610696565b5b509392505050565b6000600060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490505b919050565b600081600060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101580156107b95750600060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482600060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020540110155b156108c65781600060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190506108d0565b600090506108d0565b5b92915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490505b929150505600a165627a7a723058204c2e4edd6947d81382e4a79ca7070d2068e887e849a5998d8cd99e1ae7e4107b0029",
"updated_at": 1517509622346
}
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,5 +1,9 @@
# CHANGELOG
## v0.0.10 - _??_
* Add the ability to pass in specific contracts to compile in CLI (#400)
## v0.0.8 - _February 9, 2018_
* Fix publishing issue where .npmignore was not properly excluding undesired content (#389)

View File

@@ -9,7 +9,7 @@
"build": "yarn clean && copyfiles 'test/fixtures/contracts/**/*' src/solc/solc_bin/* ./lib && tsc",
"test": "npm run build; mocha lib/test/*_test.js",
"compile": "npm run build; node lib/src/cli.js compile",
"clean": "rm -rf ./lib",
"clean": "shx rm -rf ./lib",
"migrate": "npm run build; node lib/src/cli.js migrate",
"lint": "tslint --project . 'src/**/*.ts' 'test/**/*.ts'",
"test:circleci": "yarn test"
@@ -31,6 +31,7 @@
"@0xproject/tslint-config": "^0.4.9",
"chai": "^4.0.1",
"copyfiles": "^1.2.0",
"shx": "^0.2.2",
"mocha": "^4.0.1",
"tslint": "5.8.0",
"types-bn": "^0.0.1",

View File

@@ -14,6 +14,7 @@ const DEFAULT_ARTIFACTS_DIR = path.resolve('artifacts');
const DEFAULT_NETWORK_ID = 50;
const DEFAULT_JSONRPC_PORT = 8545;
const DEFAULT_GAS_PRICE = (10 ** 9 * 2).toString();
const DEFAULT_CONTRACTS_LIST = '*';
/**
* Compiles all contracts with options passed in through CLI.
@@ -25,6 +26,7 @@ async function onCompileCommand(argv: CliOptions): Promise<void> {
networkId: argv.networkId,
optimizerEnabled: argv.shouldOptimize ? 1 : 0,
artifactsDir: argv.artifactsDir,
specifiedContracts: getContractsSetFromList(argv.contracts),
};
await commands.compileAsync(opts);
}
@@ -43,6 +45,7 @@ async function onMigrateCommand(argv: CliOptions): Promise<void> {
networkId,
optimizerEnabled: argv.shouldOptimize ? 1 : 0,
artifactsDir: argv.artifactsDir,
specifiedContracts: getContractsSetFromList(argv.contracts),
};
await commands.compileAsync(compilerOpts);
@@ -72,6 +75,7 @@ async function onDeployCommand(argv: CliOptions): Promise<void> {
networkId,
optimizerEnabled: argv.shouldOptimize ? 1 : 0,
artifactsDir: argv.artifactsDir,
specifiedContracts: getContractsSetFromList(argv.contracts),
};
await commands.compileAsync(compilerOpts);
@@ -89,6 +93,18 @@ async function onDeployCommand(argv: CliOptions): Promise<void> {
const deployerArgs = deployerArgsString.split(',');
await commands.deployAsync(argv.contract, deployerArgs, deployerOpts);
}
/**
* Creates a set of contracts to compile.
* @param contracts Comma separated list of contracts to compile
*/
function getContractsSetFromList(contracts: string): Set<string> {
const specifiedContracts = new Set();
const contractsArray = contracts.split(',');
_.forEach(contractsArray, contractName => {
specifiedContracts.add(contractName);
});
return specifiedContracts;
}
/**
* Provides extra required options for deploy command.
* @param yargsInstance yargs instance provided in builder function callback.
@@ -144,6 +160,11 @@ function deployCommandBuilder(yargsInstance: any) {
type: 'string',
description: 'account to use for deploying contracts',
})
.option('contracts', {
type: 'string',
default: DEFAULT_CONTRACTS_LIST,
description: 'comma separated list of contracts to compile',
})
.command('compile', 'compile contracts', identityCommandBuilder, onCompileCommand)
.command(
'migrate',

View File

@@ -17,6 +17,7 @@ import {
import { utils } from './utils/utils';
const SOLIDITY_FILE_EXTENSION = '.sol';
const ALL_CONTRACTS_IDENTIFIER = '*';
export class Compiler {
private _contractsDir: string;
@@ -25,6 +26,7 @@ export class Compiler {
private _artifactsDir: string;
private _contractSourcesIfExists?: ContractSources;
private _solcErrors: Set<string>;
private _specifiedContracts: Set<string>;
/**
* Recursively retrieves Solidity source code from directory.
* @param dirPath Directory to search.
@@ -106,6 +108,7 @@ export class Compiler {
this._optimizerEnabled = opts.optimizerEnabled;
this._artifactsDir = opts.artifactsDir;
this._solcErrors = new Set();
this._specifiedContracts = opts.specifiedContracts;
}
/**
* Compiles all Solidity files found in contractsDir and writes JSON artifacts to artifactsDir.
@@ -136,6 +139,8 @@ export class Compiler {
const contractName = path.basename(contractBaseName, SOLIDITY_FILE_EXTENSION);
const currentArtifactPath = `${this._artifactsDir}/${contractName}.json`;
const sourceHash = `0x${ethUtil.sha3(source).toString('hex')}`;
const isContractSpecified =
this._specifiedContracts.has(ALL_CONTRACTS_IDENTIFIER) || this._specifiedContracts.has(contractName);
let currentArtifactString: string;
let currentArtifact: ContractArtifact;
@@ -150,11 +155,12 @@ export class Compiler {
oldNetworks = currentArtifact.networks;
const oldNetwork: ContractData = oldNetworks[this._networkId];
shouldCompile =
_.isUndefined(oldNetwork) ||
(_.isUndefined(oldNetwork) ||
oldNetwork.keccak256 !== sourceHash ||
oldNetwork.optimizer_enabled !== this._optimizerEnabled;
oldNetwork.optimizer_enabled !== this._optimizerEnabled) &&
isContractSpecified;
} catch (err) {
shouldCompile = true;
shouldCompile = isContractSpecified;
}
if (!shouldCompile) {

View File

@@ -50,6 +50,7 @@ export interface CompilerOptions {
networkId: number;
optimizerEnabled: number;
artifactsDir: string;
specifiedContracts: Set<string>;
}
export interface DeployerOptions {

View File

@@ -18,6 +18,7 @@ const compilerOpts: CompilerOptions = {
contractsDir,
networkId: constants.networkId,
optimizerEnabled: constants.optimizerEnabled,
specifiedContracts: new Set(constants.specifiedContracts),
};
const compiler = new Compiler(compilerOpts);
const deployerOpts = {

View File

@@ -8,4 +8,5 @@ export const constants = {
timeoutMs: 20000,
zrxTokenAddress: '0xe41d2489571d322189246dafa5ebde1f4699f498',
tokenTransferProxyAddress: '0x8da0d80f5007ef1e431dd2127178d224e32c2ef4',
specifiedContracts: '*',
};

View File

@@ -1,5 +1,9 @@
# CHANGELOG
## v0.1.0 - _TBD, 2018_
* Remove subproviders (#392)
## v0.0.12 - _February 9, 2018_
* Fix publishing issue where .npmignore was not properly excluding undesired content (#389)

View File

@@ -2,13 +2,16 @@
"name": "@0xproject/dev-utils",
"version": "0.0.13",
"description": "0x dev TS utils",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"main": "lib/src/index.js",
"types": "lib/src/index.d.ts",
"scripts": {
"build:watch": "tsc -w",
"build": "tsc",
"test": "run-s clean build run_mocha",
"test:circleci": "yarn test",
"run_mocha": "mocha lib/test/**/*_test.js --bail --exit",
"clean": "shx rm -rf lib",
"lint": "tslint --project . 'src/**/*.ts'"
"lint": "tslint --project . 'src/**/*.ts' 'test/**/*.ts'"
},
"license": "Apache-2.0",
"repository": {
@@ -20,9 +23,14 @@
},
"homepage": "https://github.com/0xProject/0x.js/packages/dev-utils/README.md",
"devDependencies": {
"@types/mocha": "^2.2.42",
"@0xproject/tslint-config": "^0.4.9",
"@0xproject/types": "^0.2.2",
"@0xproject/web3-wrapper": "^0.1.13",
"@types/lodash": "^4.14.86",
"chai": "^4.0.1",
"chai-typescript-typings": "^0.0.3",
"mocha": "^4.0.1",
"npm-run-all": "^4.1.2",
"shx": "^0.2.2",
"tslint": "5.8.0",
@@ -32,6 +40,7 @@
},
"dependencies": {
"@0xproject/utils": "^0.3.3",
"@0xproject/subproviders": "^0.4.2",
"ethereumjs-util": "^5.1.2",
"lodash": "^4.17.4",
"request-promise-native": "^1.0.5",

View File

@@ -6,8 +6,7 @@
import ProviderEngine = require('web3-provider-engine');
import RpcSubprovider = require('web3-provider-engine/subproviders/rpc');
import { EmptyWalletSubprovider } from './subproviders/empty_wallet_subprovider';
import { FakeGasEstimateSubprovider } from './subproviders/fake_gas_estimate_subprovider';
import { EmptyWalletSubprovider, FakeGasEstimateSubprovider } from '@0xproject/subproviders';
import { constants } from './constants';

View File

@@ -0,0 +1,27 @@
import { BlockParamLiteral } from '@0xproject/types';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
import * as chai from 'chai';
import 'mocha';
import { BlockchainLifecycle, RPC, web3Factory } from '../src';
const expect = chai.expect;
describe('BlockchainLifecycle tests', () => {
const web3 = web3Factory.create();
const web3Wrapper = new Web3Wrapper(web3.currentProvider);
const rpc = new RPC();
const blockchainLifecycle = new BlockchainLifecycle();
describe('#startAsync/revertAsync', () => {
it('reverts changes in between', async () => {
const blockNumberBefore = await web3Wrapper.getBlockNumberAsync();
await blockchainLifecycle.startAsync();
await rpc.mineBlockAsync();
const blockNumberAfter = await web3Wrapper.getBlockNumberAsync();
expect(blockNumberAfter).to.be.equal(blockNumberBefore + 1);
await blockchainLifecycle.revertAsync();
const blockNumberAfterRevert = await web3Wrapper.getBlockNumberAsync();
expect(blockNumberAfterRevert).to.be.equal(blockNumberBefore);
});
});
});

View File

@@ -0,0 +1,42 @@
import { BlockParamLiteral } from '@0xproject/types';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
import * as chai from 'chai';
import 'mocha';
import { RPC, web3Factory } from '../src';
const expect = chai.expect;
describe('RPC tests', () => {
const web3 = web3Factory.create();
const web3Wrapper = new Web3Wrapper(web3.currentProvider);
const rpc = new RPC();
describe('#mineBlockAsync', () => {
it('increases block number when called', async () => {
const blockNumberBefore = await web3Wrapper.getBlockNumberAsync();
await rpc.mineBlockAsync();
const blockNumberAfter = await web3Wrapper.getBlockNumberAsync();
expect(blockNumberAfter).to.be.equal(blockNumberBefore + 1);
});
});
describe('#increaseTimeAsync', () => {
it('increases time when called', async () => {
const TIME_DELTA = 1000;
const blockTimestampBefore = await web3Wrapper.getBlockTimestampAsync(BlockParamLiteral.Latest);
await rpc.increaseTimeAsync(TIME_DELTA);
await rpc.mineBlockAsync();
const blockTimestampAfter = await web3Wrapper.getBlockTimestampAsync(BlockParamLiteral.Latest);
expect(blockTimestampAfter).to.be.at.least(blockTimestampBefore + TIME_DELTA);
});
});
describe('#takeSnapshotAsync/revertSnapshotAsync', () => {
it('reverts changes in between', async () => {
const blockNumberBefore = await web3Wrapper.getBlockNumberAsync();
const snapshotId = await rpc.takeSnapshotAsync();
await rpc.mineBlockAsync();
await rpc.revertSnapshotAsync(snapshotId);
const blockNumberAfter = await web3Wrapper.getBlockNumberAsync();
expect(blockNumberAfter).to.be.equal(blockNumberBefore);
});
});
});

View File

@@ -5,7 +5,9 @@
},
"include": [
"./src/**/*",
"./test/**/*",
"../../node_modules/types-bn/index.d.ts",
"../../node_modules/chai-typescript-typings/index.d.ts",
"../../node_modules/web3-typescript-typings/index.d.ts",
"../../node_modules/types-ethereumjs-util/index.d.ts"
]

View File

@@ -1,5 +1,9 @@
# CHANGELOG
## v0.5.0 - _TBD, 2018_
* Add EmptyWalletSubprovider and FakeGasEstimateSubprovider (#392)
## v0.4.1 - _February 9, 2018_
* Fix publishing issue where .npmignore was not properly excluding undesired content (#389)

View File

@@ -6,6 +6,8 @@ import {
import { LedgerEthereumClient } from './types';
export { EmptyWalletSubprovider } from './subproviders/empty_wallet_subprovider';
export { FakeGasEstimateSubprovider } from './subproviders/fake_gas_estimate_subprovider';
export { InjectedWeb3Subprovider } from './subproviders/injected_web3';
export { RedundantRPCSubprovider } from './subproviders/redundant_rpc';
export { LedgerSubprovider } from './subproviders/ledger';

View File

@@ -1,5 +1,9 @@
# CHANGELOG
## v0.9.11 - _TBD, 2018_
* Fix `web3.net.peerCount` to be of type number instead of boolean (#397)
## v0.9.3 - _January 11, 2018_
* Fix `getTransactionReceipt` not returning null (#338)

View File

@@ -298,7 +298,7 @@ declare module 'web3' {
interface NetApi {
listening: boolean;
peerCount: boolean;
peerCount: number;
getListening(cd: (err: Error, listening: boolean) => void): void;
getPeerCount(cd: (err: Error, peerCount: number) => void): void;
}

View File

@@ -6,7 +6,8 @@ import { DocsInfo } from 'ts/pages/documentation/docs_info';
import { Documentation as DocumentationComponent, DocumentationAllProps } from 'ts/pages/documentation/documentation';
import { Dispatcher } from 'ts/redux/dispatcher';
import { State } from 'ts/redux/reducer';
import { DocsInfoConfig, WebsitePaths } from 'ts/types';
import { DocsInfoConfig, Environments, WebsitePaths } from 'ts/types';
import { configs } from 'ts/utils/configs';
import { constants } from 'ts/utils/constants';
import { typeDocUtils } from 'ts/utils/typedoc_utils';
@@ -23,12 +24,16 @@ const connectDocSections = {
types: constants.TYPES_SECTION_NAME,
};
const s3BucketName =
configs.ENVIRONMENT === Environments.DEVELOPMENT ? 'staging-connect-docs-jsons' : 'connect-docs-jsons';
const docsJsonRoot = `https://s3.amazonaws.com/${s3BucketName}`;
const docsInfoConfig: DocsInfoConfig = {
displayName: '0x Connect',
subPackageName: 'connect',
packageUrl: 'https://github.com/0xProject/0x.js',
websitePath: WebsitePaths.Connect,
docsJsonRoot: 'https://s3.amazonaws.com/connect-docs-jsons',
docsJsonRoot,
menu: {
introduction: [connectDocSections.introduction],
install: [connectDocSections.installation],
@@ -52,8 +57,11 @@ const docsInfoConfig: DocsInfoConfig = {
'OrderbookRequest',
'OrderbookResponse',
'OrdersRequest',
'OrdersRequestOpts',
'PagedRequestOpts',
'TokenPairsItem',
'TokenPairsRequest',
'TokenPairsRequestOpts',
'TokenTradeInfo',
'Order',
'SignedOrder',

View File

@@ -6,7 +6,8 @@ import { DocsInfo } from 'ts/pages/documentation/docs_info';
import { Documentation as DocumentationComponent, DocumentationAllProps } from 'ts/pages/documentation/documentation';
import { Dispatcher } from 'ts/redux/dispatcher';
import { State } from 'ts/redux/reducer';
import { DocsInfoConfig, WebsitePaths } from 'ts/types';
import { DocsInfoConfig, Environments, WebsitePaths } from 'ts/types';
import { configs } from 'ts/utils/configs';
import { constants } from 'ts/utils/constants';
import { typeDocUtils } from 'ts/utils/typedoc_utils';
@@ -35,12 +36,15 @@ const zeroExJsDocSections = {
types: constants.TYPES_SECTION_NAME,
};
const s3BucketName = configs.ENVIRONMENT === Environments.DEVELOPMENT ? 'staging-0xjs-docs-jsons' : '0xjs-docs-jsons';
const docsJsonRoot = `https://s3.amazonaws.com/${s3BucketName}`;
const docsInfoConfig: DocsInfoConfig = {
displayName: '0x.js',
packageUrl: 'https://github.com/0xProject/0x.js',
subPackageName: '0x.js',
websitePath: WebsitePaths.ZeroExJs,
docsJsonRoot: 'https://s3.amazonaws.com/0xjs-docs-jsons',
docsJsonRoot,
menu: {
introduction: [zeroExJsDocSections.introduction],
install: [zeroExJsDocSections.installation],

View File

@@ -118,6 +118,23 @@ export function Type(props: TypeProps): any {
typeName = type.name;
break;
case TypeDocTypes.Intersection:
const intersectionsTypes = _.map(type.types, t => {
return (
<Type
key={`type-${t.name}-${t.value}-${t.typeDocType}`}
type={t}
sectionName={props.sectionName}
typeDefinitionByName={props.typeDefinitionByName}
docsInfo={props.docsInfo}
/>
);
});
typeName = _.reduce(intersectionsTypes, (prev: React.ReactNode, curr: React.ReactNode) => {
return [prev, '&', curr];
});
break;
default:
throw utils.spawnSwitchErr('type.typeDocType', type.typeDocType);
}

View File

@@ -324,6 +324,7 @@ export enum TypeDocTypes {
Reflection = 'reflection',
Union = 'union',
TypeParameter = 'typeParameter',
Intersection = 'intersection',
Unknown = 'unknown',
}