Merge branch 'development' into v2-prototype
* development: (29 commits) Do not remove artifacts when running `clean` fix style errors Fix circular dependency Add my profile image to images Add myself to about page Add dogfood configs to website Revert to lerna:run lint Do lint sequentially Exclude monorepo-scripts from tslint as test Fix prettier Add hover state to top tokens Change to weekly txn volume Change minimum Node version to 6.12 Document Node.js version requirement and add it to package.json Apply prettier to some files which were not formatted correctly Fix TSLint issues Fix TSLint issues Update ethereeumjs-testrpc to ganache-cli Fix infinite loop Add changelog entries for packages where executable binary exporting fixed ... # Conflicts: # packages/contracts/package.json # packages/contracts/util/formatters.ts # packages/contracts/util/signed_order_utils.ts # packages/migrations/package.json # yarn.lock
This commit is contained in:
@@ -34,28 +34,16 @@ yarn install
|
||||
|
||||
### Build
|
||||
|
||||
If this is your **first** time building this package, you must first build **all** packages within the monorepo. This is because packages that depend on other packages located inside this monorepo are symlinked when run from **within** the monorepo. This allows you to make changes across multiple packages without first publishing dependent packages to NPM. To build all packages, run the following from the monorepo root directory:
|
||||
To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
|
||||
|
||||
```bash
|
||||
yarn lerna:rebuild
|
||||
PKG=contracts yarn build
|
||||
```
|
||||
|
||||
Or continuously rebuild on change:
|
||||
|
||||
```bash
|
||||
yarn dev
|
||||
```
|
||||
|
||||
You can also build this specific package by running the following from within its directory:
|
||||
|
||||
```bash
|
||||
yarn build
|
||||
```
|
||||
|
||||
or continuously rebuild on change:
|
||||
|
||||
```bash
|
||||
yarn build:watch
|
||||
PKG=contracts yarn watch
|
||||
```
|
||||
|
||||
### Clean
|
||||
|
||||
@@ -2,25 +2,25 @@
|
||||
"private": true,
|
||||
"name": "contracts",
|
||||
"version": "2.1.28",
|
||||
"engines": {
|
||||
"node" : ">=6.12"
|
||||
},
|
||||
"description": "Smart contract components of 0x protocol",
|
||||
"main": "index.js",
|
||||
"directories": {
|
||||
"test": "test"
|
||||
},
|
||||
"scripts": {
|
||||
"build:watch": "tsc -w",
|
||||
"watch": "tsc -w",
|
||||
"prebuild": "run-s clean copy_artifacts generate_contract_wrappers",
|
||||
"copy_artifacts": "copyfiles -u 4 '../migrations/artifacts/2.0.0/**/*' ./lib/src/artifacts;",
|
||||
"build": "tsc",
|
||||
"test": "run-s build run_mocha",
|
||||
"test:coverage": "SOLIDITY_COVERAGE=true run-s build run_mocha coverage:report:text coverage:report:lcov",
|
||||
"run_mocha": "mocha 'lib/test/**/*.js' --timeout 100000 --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 ../sol-compiler/lib/src/cli.js",
|
||||
"clean": "shx rm -rf lib ./contract_wrappers/generated",
|
||||
"generate_contract_wrappers":
|
||||
"node ../abi-gen/lib/index.js --abis ${npm_package_config_abis} --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output ./src/contract_wrappers/generated --backend ethers && prettier --write './src/contract_wrappers/generated/**.ts'",
|
||||
"compile": "sol-compiler",
|
||||
"clean": "shx rm -rf lib src/contract_wrappers/generated",
|
||||
"generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output src/contract_wrappers/generated --backend ethers && prettier --write 'src/contract_wrappers/generated/**.ts'",
|
||||
"lint": "tslint --project .",
|
||||
"coverage:report:text": "istanbul report text",
|
||||
"coverage:report:html": "istanbul report html && open coverage/index.html",
|
||||
@@ -42,6 +42,7 @@
|
||||
},
|
||||
"homepage": "https://github.com/0xProject/0x-monorepo/packages/contracts/README.md",
|
||||
"devDependencies": {
|
||||
"@0xproject/abi-gen": "^0.2.13",
|
||||
"@0xproject/dev-utils": "^0.4.1",
|
||||
"@0xproject/tslint-config": "^0.4.17",
|
||||
"@types/lodash": "4.14.104",
|
||||
|
||||
@@ -4,7 +4,7 @@ import ChaiBigNumber = require('chai-bignumber');
|
||||
import * as dirtyChai from 'dirty-chai';
|
||||
|
||||
export const chaiSetup = {
|
||||
configure() {
|
||||
configure(): void {
|
||||
chai.config.includeStack = true;
|
||||
chai.use(ChaiBigNumber());
|
||||
chai.use(dirtyChai);
|
||||
|
||||
@@ -18,7 +18,7 @@ export const crypto = {
|
||||
solSHA256(args: any[]): Buffer {
|
||||
return crypto._solHash(args, ABI.soliditySHA256);
|
||||
},
|
||||
_solHash(args: any[], hashFunction: (types: string[], values: any[]) => Buffer) {
|
||||
_solHash(args: any[], hashFunction: (types: string[], values: any[]) => Buffer): Buffer {
|
||||
const argTypes: string[] = [];
|
||||
_.each(args, (arg, i) => {
|
||||
const isNumber = _.isFinite(arg);
|
||||
|
||||
@@ -11,7 +11,7 @@ import { TransactionDataParams } from './types';
|
||||
|
||||
export class MultiSigWrapper {
|
||||
private _multiSig: MultiSigWalletContract;
|
||||
public static encodeFnArgs(name: string, abi: AbiDefinition[], args: any[]) {
|
||||
public static encodeFnArgs(name: string, abi: AbiDefinition[], args: any[]): string {
|
||||
const abiEntity = _.find(abi, { name }) as MethodAbi;
|
||||
if (_.isUndefined(abiEntity)) {
|
||||
throw new Error(`Did not find abi entry for name: ${name}`);
|
||||
@@ -33,7 +33,7 @@ export class MultiSigWrapper {
|
||||
from: string,
|
||||
dataParams: TransactionDataParams,
|
||||
value: BigNumber = new BigNumber(0),
|
||||
) {
|
||||
): Promise<string> {
|
||||
const { name, abi, args = [] } = dataParams;
|
||||
const encoded = MultiSigWrapper.encodeFnArgs(name, abi, args);
|
||||
return this._multiSig.submitTransaction.sendTransactionAsync(destination, value, encoded, {
|
||||
|
||||
@@ -9,7 +9,7 @@ export class TokenRegWrapper {
|
||||
constructor(tokenRegContract: TokenRegistryContract) {
|
||||
this._tokenReg = tokenRegContract;
|
||||
}
|
||||
public async addTokenAsync(token: Token, from: string) {
|
||||
public async addTokenAsync(token: Token, from: string): Promise<string> {
|
||||
const tx = this._tokenReg.addToken.sendTransactionAsync(
|
||||
token.address as string,
|
||||
token.name,
|
||||
@@ -21,7 +21,7 @@ export class TokenRegWrapper {
|
||||
);
|
||||
return tx;
|
||||
}
|
||||
public async getTokenMetaDataAsync(tokenAddress: string) {
|
||||
public async getTokenMetaDataAsync(tokenAddress: string): Promise<Token> {
|
||||
const data = await this._tokenReg.getTokenMetaData.callAsync(tokenAddress);
|
||||
const token: Token = {
|
||||
address: data[0],
|
||||
@@ -33,7 +33,7 @@ export class TokenRegWrapper {
|
||||
};
|
||||
return token;
|
||||
}
|
||||
public async getTokenByNameAsync(tokenName: string) {
|
||||
public async getTokenByNameAsync(tokenName: string): Promise<Token> {
|
||||
const data = await this._tokenReg.getTokenByName.callAsync(tokenName);
|
||||
const token: Token = {
|
||||
address: data[0],
|
||||
@@ -45,7 +45,7 @@ export class TokenRegWrapper {
|
||||
};
|
||||
return token;
|
||||
}
|
||||
public async getTokenBySymbolAsync(tokenSymbol: string) {
|
||||
public async getTokenBySymbolAsync(tokenSymbol: string): Promise<Token> {
|
||||
const data = await this._tokenReg.getTokenBySymbol.callAsync(tokenSymbol);
|
||||
const token: Token = {
|
||||
address: data[0],
|
||||
|
||||
Reference in New Issue
Block a user