mirror of
https://github.com/embarklabs/subspace.git
synced 2025-02-27 13:50:37 +00:00
feat: type definition
This commit is contained in:
parent
d507a63c58
commit
433300aa62
@ -27,6 +27,7 @@
|
|||||||
"main": "./dist/index.js",
|
"main": "./dist/index.js",
|
||||||
"browser": "./lib/index.js",
|
"browser": "./lib/index.js",
|
||||||
"module": "./module/index.js",
|
"module": "./module/index.js",
|
||||||
|
"types": "types/index.d.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"clean": "rimraf dist; rimraf lib; rimraf module;",
|
"clean": "rimraf dist; rimraf lib; rimraf module;",
|
||||||
"build:browser": "cross-env BABEL_ENV=browser babel ./src --out-dir ./lib --source-maps --copy-files",
|
"build:browser": "cross-env BABEL_ENV=browser babel ./src --out-dir ./lib --source-maps --copy-files",
|
||||||
|
39
packages/core/types/index.d.ts
vendored
Normal file
39
packages/core/types/index.d.ts
vendored
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
import Web3 from "web3";
|
||||||
|
import {Contract} from "web3-eth-contract";
|
||||||
|
import {AbiItem} from "web3-utils";
|
||||||
|
import {Observable} from "rxjs";
|
||||||
|
import {LogsOptions, TransactionConfig, } from "web3-core";
|
||||||
|
import {BlockTransactionObject} from "web3-eth";
|
||||||
|
|
||||||
|
export default class Subspace {
|
||||||
|
constructor(web3: Web3, options?: SubspaceOptions);
|
||||||
|
async init(): void;
|
||||||
|
contract(contractInstance: Contract | ContractLike): Contract;
|
||||||
|
clearDB(collection: string) : void;
|
||||||
|
trackProperty(contractInstance: Contract, propName: string, methodArgs?: any[], callArgs?: TransactionConfig): Observable<any>;
|
||||||
|
trackLogs(options?: LogsOptions, inputsABI?: AbiItem): Observable<any>;
|
||||||
|
trackEvent(contractInstance: Contract, eventName: string, filterConditions: any): Observable<object>;
|
||||||
|
trackBalance(address: string, erc20Address?: string): Observable<string>;
|
||||||
|
trackBlockNumber(): Observable<number>;
|
||||||
|
trackBlock(): Observable<BlockTransactionObject>;
|
||||||
|
trackGasPrice(): Observable<string>;
|
||||||
|
trackAverageBlocktime(): Observable<number>;
|
||||||
|
close(): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ContractLike {
|
||||||
|
address?: string;
|
||||||
|
deployedAddress?: string;
|
||||||
|
abi?: AbiItem[];
|
||||||
|
abiDefinition?: AbiItem[];
|
||||||
|
from?: string;
|
||||||
|
defaultAddress?: string;
|
||||||
|
gas?: string | number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface SubspaceOptions {
|
||||||
|
dbFilename?: string;
|
||||||
|
callInterval?: number;
|
||||||
|
refreshLastNBlocks?: number;
|
||||||
|
disableSubscriptions?: boolean;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user