Created
October 28, 2018 06:42
-
-
Save kermankohli/0d7640efb9c3f7c89f8f4e493aec4f3c to your computer and use it in GitHub Desktop.
Types File
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { BigNumber } from "bignumber.js"; | |
import * as _ from "lodash"; | |
export interface TxData { | |
from?: string; | |
gas?: BigNumber; | |
gasPrice?: BigNumber; | |
nonce?: BigNumber; | |
} | |
export interface TxDataPayable extends TxData { | |
value?: BigNumber; | |
} | |
export interface Log { | |
event: string; | |
address: Address; | |
args: any; | |
} | |
export interface ReceiptLog { | |
name: string; | |
events: Object[]; | |
address: string; | |
} | |
export interface LogEntry { | |
logIndex: number | null; | |
transactionIndex: number | null; | |
transactionHash: string; | |
blockHash: string | null; | |
blockNumber: number | null; | |
address: string; | |
data: string; | |
topics: string[]; | |
} | |
export declare type TransactionReceiptStatus = null | string | 0 | 1; | |
export interface TransactionReceipt { | |
blockHash: string; | |
blockNumber: number; | |
transactionHash: string; | |
transactionIndex: number; | |
from: string; | |
to: string; | |
status: TransactionReceiptStatus; | |
cumulativeGasUsed: number; | |
gasUsed: number; | |
contractAddress: string | null; | |
logs: LogEntry[]; | |
} | |
export interface MultiSigSubmissionEventArgs { | |
transactionId: BigNumber; | |
} | |
export const classUtils = { | |
// This is useful for classes that have nested methods. Nested methods don't get bound out of the box. | |
bindAll(self: any, exclude: string[] = ["contructor"], thisArg?: any): void { | |
for (const key of Object.getOwnPropertyNames(self)) { | |
const val = self[key]; | |
if (!_.includes(exclude, key)) { | |
if (_.isFunction(val)) { | |
self[key] = val.bind(thisArg || self); | |
} else if (_.isObject(val)) { | |
classUtils.bindAll(val, exclude, self); | |
} | |
} | |
} | |
return self; | |
}, | |
}; | |
export type Address = string; | |
export type UInt = BigNumber; | |
export type Bytes32 = string; | |
export type TxHash = string; | |
export enum SolidityType { | |
address = "address", | |
uint256 = "uint256", | |
uint8 = "uint8", | |
uint = "uint", | |
bytes32 = "bytes32", | |
boolean = "bool", | |
string = "string", | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment