mirror of https://github.com/embarklabs/embark.git
refactor: extract types that are shared
This commit is contained in:
parent
db35d7f573
commit
8f59647f36
|
@ -6,26 +6,13 @@ const EmbarkJS = require("embarkjs");
|
|||
const IpfsApi = require("ipfs-api");
|
||||
const stringify = require("json-stringify-safe");
|
||||
import Web3 from "web3";
|
||||
import { Embark, Events } from "../../../typings/embark";
|
||||
import Suggestions from "./suggestions";
|
||||
|
||||
declare const __: any;
|
||||
|
||||
interface Events {
|
||||
on: any;
|
||||
request: any;
|
||||
emit: any;
|
||||
once: any;
|
||||
setCommandHandler: any;
|
||||
}
|
||||
|
||||
interface EmbarkApi {
|
||||
events: Events;
|
||||
registerAPICall: any;
|
||||
registerConsoleCommand: any;
|
||||
}
|
||||
|
||||
class Console {
|
||||
private embark: EmbarkApi;
|
||||
private embark: Embark;
|
||||
private events: Events;
|
||||
private plugins: any;
|
||||
private version: string;
|
||||
|
@ -36,7 +23,7 @@ class Console {
|
|||
private cmdHistoryFile: string;
|
||||
private suggestions: Suggestions;
|
||||
|
||||
constructor(embark: any, options: any) {
|
||||
constructor(embark: Embark, options: any) {
|
||||
this.embark = embark;
|
||||
this.events = options.events;
|
||||
this.plugins = options.plugins;
|
||||
|
|
|
@ -1,14 +1,6 @@
|
|||
const fuzzySearch = require("../../utils/utils").fuzzySearch;
|
||||
|
||||
interface Events {
|
||||
on: any;
|
||||
request: any;
|
||||
}
|
||||
|
||||
interface EmbarkApi {
|
||||
events: Events;
|
||||
registerAPICall: any;
|
||||
}
|
||||
import { Embark, Events } from "../../../typings/embark";
|
||||
|
||||
interface ContractsManager {
|
||||
[key: string]: any;
|
||||
|
@ -23,11 +15,11 @@ interface Suggestion {
|
|||
type SuggestionsList = Suggestion[];
|
||||
|
||||
export default class Suggestions {
|
||||
private embark: EmbarkApi;
|
||||
private embark: Embark;
|
||||
private events: Events;
|
||||
private contracts: ContractsManager;
|
||||
|
||||
constructor(embark: EmbarkApi, options?: object) {
|
||||
constructor(embark: Embark, options?: object) {
|
||||
this.embark = embark;
|
||||
this.events = embark.events;
|
||||
this.contracts = {};
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
import { Logger } from "./logger";
|
||||
|
||||
export interface Events {
|
||||
on: any;
|
||||
request: any;
|
||||
emit: any;
|
||||
once: any;
|
||||
setCommandHandler: any;
|
||||
}
|
||||
|
||||
export interface Embark {
|
||||
events: Events;
|
||||
registerAPICall: any;
|
||||
registerConsoleCommand: any;
|
||||
logger: Logger;
|
||||
config: {};
|
||||
registerActionForEvent(name: string, action: (callback: () => void) => void): void;
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
export interface EmbarkConfig {
|
||||
contracts: [string];
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
export interface Logger {
|
||||
info(text: string): void;
|
||||
error(text: string): void;
|
||||
}
|
Loading…
Reference in New Issue