Use better Description typing.
This commit is contained in:
parent
13f50abd84
commit
2d5492cd2e
|
@ -132,7 +132,7 @@ export interface FilterByBlockHash extends EventFilter {
|
|||
export abstract class ForkEvent extends Description {
|
||||
readonly expiry: number;
|
||||
|
||||
readonly _isForkEvent: boolean;
|
||||
readonly _isForkEvent?: boolean;
|
||||
|
||||
static isForkEvent(value: any): value is ForkEvent {
|
||||
return !!(value && value._isForkEvent);
|
||||
|
@ -142,6 +142,8 @@ export abstract class ForkEvent extends Description {
|
|||
export class BlockForkEvent extends ForkEvent {
|
||||
readonly blockhash: string;
|
||||
|
||||
readonly _isBlockForkEvent?: boolean;
|
||||
|
||||
constructor(blockhash: string, expiry?: number) {
|
||||
if (!isHexString(blockhash, 32)) {
|
||||
logger.throwArgumentError("invalid blockhash", "blockhash", blockhash);
|
||||
|
@ -159,6 +161,8 @@ export class BlockForkEvent extends ForkEvent {
|
|||
export class TransactionForkEvent extends ForkEvent {
|
||||
readonly hash: string;
|
||||
|
||||
readonly _isTransactionOrderForkEvent?: boolean;
|
||||
|
||||
constructor(hash: string, expiry?: number) {
|
||||
if (!isHexString(hash, 32)) {
|
||||
logger.throwArgumentError("invalid transaction hash", "hash", hash);
|
||||
|
|
|
@ -16,7 +16,14 @@ const logger = new Logger(version);
|
|||
|
||||
import { getPassword, looseArrayify, searchPath } from "./utils";
|
||||
|
||||
export class CrowdsaleAccount extends Description implements ExternallyOwnedAccount {
|
||||
interface _CrowdsaleAccount {
|
||||
address: string;
|
||||
privateKey: string;
|
||||
|
||||
_isCrowdsaleAccount: boolean;
|
||||
}
|
||||
|
||||
export class CrowdsaleAccount extends Description<_CrowdsaleAccount> implements ExternallyOwnedAccount {
|
||||
readonly address: string;
|
||||
readonly privateKey: string;
|
||||
readonly mnemonic?: string;
|
||||
|
|
|
@ -18,7 +18,16 @@ import { getPassword, looseArrayify, searchPath, zpad } from "./utils";
|
|||
|
||||
// Exported Types
|
||||
|
||||
export class KeystoreAccount extends Description implements ExternallyOwnedAccount {
|
||||
interface _KeystoreAccount {
|
||||
address: string;
|
||||
privateKey: string;
|
||||
mnemonic?: string;
|
||||
path?: string;
|
||||
|
||||
_isKeystoreAccount: boolean;
|
||||
}
|
||||
|
||||
export class KeystoreAccount extends Description<_KeystoreAccount> implements ExternallyOwnedAccount {
|
||||
readonly address: string;
|
||||
readonly privateKey: string;
|
||||
readonly mnemonic?: string;
|
||||
|
@ -94,7 +103,7 @@ export async function decrypt(json: string, password: Bytes | string, progressCa
|
|||
}
|
||||
}
|
||||
|
||||
const account: any = {
|
||||
const account: _KeystoreAccount = {
|
||||
_isKeystoreAccount: true,
|
||||
address: address,
|
||||
privateKey: hexlify(privateKey)
|
||||
|
|
Loading…
Reference in New Issue