add tslint.json to package and update actor mixins

This commit is contained in:
Michael Zhu
2019-10-30 13:33:22 -07:00
parent 5f699b0c47
commit e9e6452890
7 changed files with 61 additions and 6 deletions

View File

@@ -8,7 +8,16 @@ export interface FeeRecipientConfig extends ActorConfig {
verifyingContract?: BaseContract;
}
export function FeeRecipientMixin<TBase extends Constructor>(Base: TBase) {
export interface FeeRecipientInterface {
approvalFactory?: ApprovalFactory;
signCoordinatorApproval: (
transaction: SignedZeroExTransaction,
txOrigin: string,
signatureType?: SignatureType,
) => SignedCoordinatorApproval;
}
export function FeeRecipientMixin<TBase extends Constructor>(Base: TBase): TBase & Constructor<FeeRecipientInterface> {
return class extends Base {
public readonly actor: Actor;
public readonly approvalFactory?: ApprovalFactory;

View File

@@ -5,7 +5,12 @@ import { BlockParamLiteral, TransactionReceiptWithDecodedLogs } from 'ethereum-t
import { Actor, Constructor } from './base';
export function KeeperMixin<TBase extends Constructor>(Base: TBase) {
export interface KeeperInterface {
endEpochAsync: (shouldFastForward?: boolean) => Promise<TransactionReceiptWithDecodedLogs>;
finalizePoolsAsync: (poolIds?: string[]) => Promise<TransactionReceiptWithDecodedLogs[]>;
}
export function KeeperMixin<TBase extends Constructor>(Base: TBase): TBase & Constructor<KeeperInterface> {
return class extends Base {
public readonly actor: Actor;

View File

@@ -8,7 +8,15 @@ export interface MakerConfig extends ActorConfig {
orderConfig: Partial<Order>;
}
export function MakerMixin<TBase extends Constructor>(Base: TBase) {
export interface MakerInterface {
makerPoolId?: string;
orderFactory: OrderFactory;
signOrderAsync: (customOrderParams?: Partial<Order>) => Promise<SignedOrder>;
cancelOrderAsync: (order: SignedOrder) => Promise<TransactionReceiptWithDecodedLogs>;
joinStakingPoolAsync: (poolId: string) => Promise<TransactionReceiptWithDecodedLogs>;
}
export function MakerMixin<TBase extends Constructor>(Base: TBase): TBase & Constructor<MakerInterface> {
return class extends Base {
public makerPoolId?: string;
public readonly actor: Actor;

View File

@@ -6,7 +6,16 @@ export interface OperatorShareByPoolId {
[poolId: string]: number;
}
export function PoolOperatorMixin<TBase extends Constructor>(Base: TBase) {
export interface PoolOperatorInterface {
operatorShares: OperatorShareByPoolId;
createStakingPoolAsync: (operatorShare: number, addOperatorAsMaker?: boolean) => Promise<string>;
decreaseOperatorShareAsync: (
poolId: string,
newOperatorShare: number,
) => Promise<TransactionReceiptWithDecodedLogs>;
}
export function PoolOperatorMixin<TBase extends Constructor>(Base: TBase): TBase & Constructor<PoolOperatorInterface> {
return class extends Base {
public readonly operatorShares: OperatorShareByPoolId = {};
public readonly actor: Actor;

View File

@@ -3,7 +3,14 @@ import { BigNumber } from '@0x/utils';
import { Actor, Constructor } from './base';
export function StakerMixin<TBase extends Constructor>(Base: TBase) {
export interface StakerInterface {
stakeAsync: (
amount: BigNumber,
poolId?: string,
) => Promise<void>;
}
export function StakerMixin<TBase extends Constructor>(Base: TBase): TBase & Constructor<StakerInterface> {
return class extends Base {
public readonly actor: Actor;

View File

@@ -5,7 +5,15 @@ import { TransactionReceiptWithDecodedLogs, TxData } from 'ethereum-types';
import { Actor, Constructor } from './base';
import { DeploymentManager } from '../utils/deployment_manager';
export function TakerMixin<TBase extends Constructor>(Base: TBase) {
export interface TakerInterface {
fillOrderAsync: (
order: SignedOrder,
fillAmount: BigNumber,
txData?: Partial<TxData>,
) => Promise<TransactionReceiptWithDecodedLogs>;
}
export function TakerMixin<TBase extends Constructor>(Base: TBase): TBase & Constructor<TakerInterface> {
return class extends Base {
public readonly actor: Actor;

View File

@@ -0,0 +1,9 @@
{
"extends": ["@0x/tslint-config"],
"rules": {
"custom-no-magic-numbers": false
},
"linterOptions": {
"exclude": ["src/artifacts.ts"]
}
}