aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-05-14 17:30:51 +0800
committerFabio Berger <me@fabioberger.com>2018-05-14 17:30:51 +0800
commitc94d1b22754c1d1bf10f0dd2b9c13eea91e17cb6 (patch)
tree986b220cf80aab8d8e8ef6c4cef8c08be6eeab10 /packages/contracts
parent7d60356facce60c1d4d80c703bfc565c5c47e73b (diff)
parent58fa35641d3016ef106496c929e48febcf827dc6 (diff)
downloaddexon-sol-tools-c94d1b22754c1d1bf10f0dd2b9c13eea91e17cb6.tar
dexon-sol-tools-c94d1b22754c1d1bf10f0dd2b9c13eea91e17cb6.tar.gz
dexon-sol-tools-c94d1b22754c1d1bf10f0dd2b9c13eea91e17cb6.tar.bz2
dexon-sol-tools-c94d1b22754c1d1bf10f0dd2b9c13eea91e17cb6.tar.lz
dexon-sol-tools-c94d1b22754c1d1bf10f0dd2b9c13eea91e17cb6.tar.xz
dexon-sol-tools-c94d1b22754c1d1bf10f0dd2b9c13eea91e17cb6.tar.zst
dexon-sol-tools-c94d1b22754c1d1bf10f0dd2b9c13eea91e17cb6.zip
Merge branch 'development' of github.com:0xProject/0x-monorepo into development
* 'development' of github.com:0xProject/0x-monorepo: Add missing type definitions
Diffstat (limited to 'packages/contracts')
-rw-r--r--packages/contracts/test/utils/chai_setup.ts2
-rw-r--r--packages/contracts/util/crypto.ts2
-rw-r--r--packages/contracts/util/formatters.ts6
-rw-r--r--packages/contracts/util/multi_sig_wrapper.ts4
-rw-r--r--packages/contracts/util/signed_order_utils.ts13
-rw-r--r--packages/contracts/util/token_registry_wrapper.ts8
6 files changed, 22 insertions, 13 deletions
diff --git a/packages/contracts/test/utils/chai_setup.ts b/packages/contracts/test/utils/chai_setup.ts
index 078edd309..1a8733093 100644
--- a/packages/contracts/test/utils/chai_setup.ts
+++ b/packages/contracts/test/utils/chai_setup.ts
@@ -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);
diff --git a/packages/contracts/util/crypto.ts b/packages/contracts/util/crypto.ts
index 810072d2f..3661b3afd 100644
--- a/packages/contracts/util/crypto.ts
+++ b/packages/contracts/util/crypto.ts
@@ -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);
diff --git a/packages/contracts/util/formatters.ts b/packages/contracts/util/formatters.ts
index 8e0dfb09e..3e3b67495 100644
--- a/packages/contracts/util/formatters.ts
+++ b/packages/contracts/util/formatters.ts
@@ -9,7 +9,7 @@ export const formatters = {
signedOrders: SignedOrder[],
shouldThrowOnInsufficientBalanceOrAllowance: boolean,
fillTakerTokenAmounts: BigNumber[] = [],
- ) {
+ ): BatchFillOrders {
const batchFill: BatchFillOrders = {
orderAddresses: [],
orderValues: [],
@@ -48,7 +48,7 @@ export const formatters = {
signedOrders: SignedOrder[],
shouldThrowOnInsufficientBalanceOrAllowance: boolean,
fillTakerTokenAmount: BigNumber,
- ) {
+ ): FillOrdersUpTo {
const fillUpTo: FillOrdersUpTo = {
orderAddresses: [],
orderValues: [],
@@ -80,7 +80,7 @@ export const formatters = {
});
return fillUpTo;
},
- createBatchCancel(signedOrders: SignedOrder[], cancelTakerTokenAmounts: BigNumber[] = []) {
+ createBatchCancel(signedOrders: SignedOrder[], cancelTakerTokenAmounts: BigNumber[] = []): BatchCancelOrders {
const batchCancel: BatchCancelOrders = {
orderAddresses: [],
orderValues: [],
diff --git a/packages/contracts/util/multi_sig_wrapper.ts b/packages/contracts/util/multi_sig_wrapper.ts
index 9f6dcec52..c66106b9a 100644
--- a/packages/contracts/util/multi_sig_wrapper.ts
+++ b/packages/contracts/util/multi_sig_wrapper.ts
@@ -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, {
diff --git a/packages/contracts/util/signed_order_utils.ts b/packages/contracts/util/signed_order_utils.ts
index fc2f800cd..30a2814e7 100644
--- a/packages/contracts/util/signed_order_utils.ts
+++ b/packages/contracts/util/signed_order_utils.ts
@@ -6,6 +6,15 @@ import * as _ from 'lodash';
import { crypto } from './crypto';
+interface OrderAddressesAndValues {
+ orderAddresses: string[];
+ orderValues: BigNumber[];
+}
+
+interface OrderCancel extends OrderAddressesAndValues {
+ cancelTakerTokenAmount: BigNumber;
+}
+
export const signedOrderUtils = {
createFill: (
signedOrder: SignedOrder,
@@ -20,14 +29,14 @@ export const signedOrderUtils = {
};
return fill;
},
- createCancel(signedOrder: SignedOrder, cancelTakerTokenAmount?: BigNumber) {
+ createCancel(signedOrder: SignedOrder, cancelTakerTokenAmount?: BigNumber): OrderCancel {
const cancel = {
...signedOrderUtils.getOrderAddressesAndValues(signedOrder),
cancelTakerTokenAmount: cancelTakerTokenAmount || signedOrder.takerTokenAmount,
};
return cancel;
},
- getOrderAddressesAndValues(signedOrder: SignedOrder) {
+ getOrderAddressesAndValues(signedOrder: SignedOrder): OrderAddressesAndValues {
return {
orderAddresses: [
signedOrder.maker,
diff --git a/packages/contracts/util/token_registry_wrapper.ts b/packages/contracts/util/token_registry_wrapper.ts
index d78c8a64e..bed62fa53 100644
--- a/packages/contracts/util/token_registry_wrapper.ts
+++ b/packages/contracts/util/token_registry_wrapper.ts
@@ -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],