Added non-unified types to resolve npm link issues.

This commit is contained in:
Richard Moore 2018-07-23 19:21:42 -04:00
parent ae8d75fe6a
commit 26207e7bb8
No known key found for this signature in database
GPG Key ID: 525F70A6FCABC295
55 changed files with 863 additions and 8 deletions

File diff suppressed because one or more lines are too long

@ -425,7 +425,7 @@ declare module 'ethers/utils/errors' {
} }
declare module 'ethers/_version' { declare module 'ethers/_version' {
export const version = "4.0.0-beta.2"; export const version = "4.0.0-beta.3";
} }
declare module 'ethers/contracts/contract' { declare module 'ethers/contracts/contract' {

2
dist/types/_version.d.ts vendored Normal file

@ -0,0 +1,2 @@
export declare const version = "4.0.0-beta.2";
//# sourceMappingURL=_version.d.ts.map

36
dist/types/contracts/contract.d.ts vendored Normal file

@ -0,0 +1,36 @@
import { Interface } from './interface';
import { Signer, MinimalProvider, BigNumber, ContractFunction, EventFilter, ParamType, Listener, TransactionRequest, TransactionResponse } from '../utils/types';
interface Bucket<T> {
[name: string]: T;
}
export declare class Contract {
readonly address: string;
readonly interface: Interface;
readonly signer: Signer;
readonly provider: MinimalProvider;
readonly estimate: Bucket<(...params: Array<any>) => Promise<BigNumber>>;
readonly functions: Bucket<ContractFunction>;
readonly filters: Bucket<(...params: Array<any>) => EventFilter>;
readonly [name: string]: ContractFunction | any;
readonly addressPromise: Promise<string>;
readonly deployTransaction: TransactionResponse;
constructor(addressOrName: string, contractInterface: Array<string | ParamType> | string | Interface, signerOrProvider: Signer | MinimalProvider);
deployed(): Promise<Contract>;
fallback(overrides?: TransactionRequest): Promise<TransactionResponse>;
connect(signerOrProvider: Signer | MinimalProvider): Contract;
attach(addressOrName: string): Contract;
deploy(bytecode: string, ...args: Array<any>): Promise<Contract>;
private _events;
private _getEventFilter;
private _addEventListener;
on(event: EventFilter | string, listener: Listener): Contract;
once(event: EventFilter | string, listener: Listener): Contract;
addEventLisener(eventName: EventFilter | string, listener: Listener): Contract;
emit(eventName: EventFilter | string, ...args: Array<any>): boolean;
listenerCount(eventName?: EventFilter | string): number;
listeners(eventName: EventFilter | string): Array<Listener>;
removeAllListeners(eventName: EventFilter | string): Contract;
removeListener(eventName: any, listener: Listener): Contract;
}
export {};
//# sourceMappingURL=contract.d.ts.map

4
dist/types/contracts/index.d.ts vendored Normal file

@ -0,0 +1,4 @@
import { Contract } from './contract';
import { Interface } from './interface';
export { Contract, Interface };
//# sourceMappingURL=index.d.ts.map

21
dist/types/contracts/interface.d.ts vendored Normal file

@ -0,0 +1,21 @@
import { BigNumberish, DeployDescription as _DeployDescription, EventDescription as _EventDescription, FunctionDescription as _FunctionDescription, LogDescription as _LogDescription, TransactionDescription as _TransactionDescription, EventFragment, FunctionFragment, ParamType } from '../utils/types';
export declare class Interface {
readonly abi: Array<EventFragment | FunctionFragment>;
readonly functions: {
[name: string]: _FunctionDescription;
};
readonly events: {
[name: string]: _EventDescription;
};
readonly deployFunction: _DeployDescription;
constructor(abi: Array<string | ParamType> | string);
parseTransaction(tx: {
data: string;
value?: BigNumberish;
}): _TransactionDescription;
parseLog(log: {
topics: Array<string>;
data: string;
}): _LogDescription;
}
//# sourceMappingURL=interface.d.ts.map

20
dist/types/ethers.d.ts vendored Normal file

@ -0,0 +1,20 @@
import { platform } from './utils/shims';
import { Contract, Interface } from './contracts';
import * as providers from './providers';
import * as utils from './utils';
import { HDNode, SigningKey, Wallet } from './wallet';
import * as wordlists from './wordlists';
import * as types from './utils/types';
import * as errors from './utils/errors';
import { version } from './_version';
declare const constants: {
AddressZero: string;
HashZero: string;
NegativeOne: utils.types.BigNumber;
Zero: utils.types.BigNumber;
One: utils.types.BigNumber;
Two: utils.types.BigNumber;
WeiPerEther: utils.types.BigNumber;
};
export { Wallet, HDNode, SigningKey, Contract, Interface, providers, types, errors, constants, utils, wordlists, platform, version };
//# sourceMappingURL=ethers.d.ts.map

4
dist/types/index.d.ts vendored Normal file

@ -0,0 +1,4 @@
import * as ethers from './ethers';
export { ethers };
export * from "./ethers";
//# sourceMappingURL=index.d.ts.map

@ -0,0 +1,10 @@
import { Provider } from './provider';
import { BlockTag, Networkish, TransactionResponse } from '../utils/types';
export declare class EtherscanProvider extends Provider {
readonly baseUrl: string;
readonly apiKey: string;
constructor(network?: Networkish, apiKey?: string);
perform(method: string, params: any): Promise<any>;
getHistory(addressOrName: string | Promise<string>, startBlock?: BlockTag, endBlock?: BlockTag): Promise<Array<TransactionResponse>>;
}
//# sourceMappingURL=etherscan-provider.d.ts.map

@ -0,0 +1,8 @@
import { Provider } from './provider';
export declare class FallbackProvider extends Provider {
private _providers;
constructor(providers: Array<Provider>);
readonly providers: Array<Provider>;
perform(method: string, params: any): any;
}
//# sourceMappingURL=fallback-provider.d.ts.map

11
dist/types/providers/index.d.ts vendored Normal file

@ -0,0 +1,11 @@
import { Provider } from './provider';
import { EtherscanProvider } from './etherscan-provider';
import { FallbackProvider } from './fallback-provider';
import { IpcProvider } from './ipc-provider';
import { InfuraProvider } from './infura-provider';
import { JsonRpcProvider, JsonRpcSigner } from './json-rpc-provider';
import { Web3Provider } from './web3-provider';
import { Network } from '../utils/types';
declare function getDefaultProvider(network?: Network | string): Provider;
export { Provider, getDefaultProvider, FallbackProvider, EtherscanProvider, InfuraProvider, JsonRpcProvider, Web3Provider, IpcProvider, JsonRpcSigner };
//# sourceMappingURL=index.d.ts.map

@ -0,0 +1,10 @@
import { JsonRpcProvider, JsonRpcSigner } from './json-rpc-provider';
import { Networkish } from '../utils/types';
export declare class InfuraProvider extends JsonRpcProvider {
readonly apiAccessToken: string;
constructor(network?: Networkish, apiAccessToken?: string);
protected _startPending(): void;
getSigner(address?: string): JsonRpcSigner;
listAccounts(): Promise<Array<string>>;
}
//# sourceMappingURL=infura-provider.d.ts.map

@ -0,0 +1,8 @@
import { JsonRpcProvider } from './json-rpc-provider';
import { Networkish } from '../utils/types';
export declare class IpcProvider extends JsonRpcProvider {
readonly path: string;
constructor(path: string, network?: Networkish);
send(method: string, params: any): Promise<any>;
}
//# sourceMappingURL=ipc-provider.d.ts.map

@ -0,0 +1,27 @@
import { Provider } from './provider';
import { Arrayish, BigNumber, BlockTag, ConnectionInfo, Networkish, Signer, TransactionRequest, TransactionResponse } from '../utils/types';
export declare class JsonRpcSigner extends Signer {
readonly provider: JsonRpcProvider;
private _address;
constructor(provider: JsonRpcProvider, address?: string);
readonly address: string;
getAddress(): Promise<string>;
getBalance(blockTag?: BlockTag): Promise<BigNumber>;
getTransactionCount(blockTag?: BlockTag): Promise<number>;
sendTransaction(transaction: TransactionRequest): Promise<TransactionResponse>;
signMessage(message: Arrayish | string): Promise<string>;
unlock(password: string): Promise<boolean>;
}
export declare class JsonRpcProvider extends Provider {
readonly connection: ConnectionInfo;
private _pendingFilter;
constructor(url?: ConnectionInfo | string, network?: Networkish);
getSigner(address?: string): JsonRpcSigner;
listAccounts(): Promise<Array<string>>;
send(method: string, params: any): Promise<any>;
perform(method: string, params: any): Promise<any>;
protected _startPending(): void;
protected _stopPending(): void;
static hexlifyTransaction(transaction: TransactionRequest): any;
}
//# sourceMappingURL=json-rpc-provider.d.ts.map

63
dist/types/providers/provider.d.ts vendored Normal file

@ -0,0 +1,63 @@
import { BigNumber, BigNumberish, Block, BlockTag, EventType, Filter, Listener, Log, MinimalProvider, Network, Networkish, Transaction, TransactionReceipt, TransactionRequest, TransactionResponse } from '../utils/types';
export declare class Provider extends MinimalProvider {
private _network;
private _events;
protected _emitted: any;
private _pollingInterval;
private _poller;
private _lastBlockNumber;
private _balances;
/**
* ready
*
* A Promise<Network> that resolves only once the provider is ready.
*
* Sub-classes that call the super with a network without a chainId
* MUST set this. Standard named networks have a known chainId.
*
*/
protected ready: Promise<Network>;
constructor(network: Networkish | Promise<Network>);
private _doPoll;
resetEventsBlock(blockNumber: number): void;
readonly network: Network;
getNetwork(): Promise<Network>;
readonly blockNumber: number;
polling: boolean;
pollingInterval: number;
waitForTransaction(transactionHash: string, timeout?: number): Promise<TransactionReceipt>;
getBlockNumber(): Promise<number>;
getGasPrice(): Promise<BigNumber>;
getBalance(addressOrName: string | Promise<string>, blockTag?: BlockTag | Promise<BlockTag>): Promise<BigNumber>;
getTransactionCount(addressOrName: string | Promise<string>, blockTag?: BlockTag | Promise<BlockTag>): Promise<number>;
getCode(addressOrName: string | Promise<string>, blockTag?: BlockTag | Promise<BlockTag>): Promise<string>;
getStorageAt(addressOrName: string | Promise<string>, position: BigNumberish | Promise<BigNumberish>, blockTag?: BlockTag | Promise<BlockTag>): Promise<string>;
sendTransaction(signedTransaction: string | Promise<string>): Promise<TransactionResponse>;
_wrapTransaction(tx: Transaction, hash?: string): TransactionResponse;
call(transaction: TransactionRequest): Promise<string>;
estimateGas(transaction: TransactionRequest): Promise<BigNumber>;
getBlock(blockHashOrBlockTag: BlockTag | string | Promise<BlockTag | string>): Promise<Block>;
getTransaction(transactionHash: string): Promise<TransactionResponse>;
getTransactionReceipt(transactionHash: string): Promise<TransactionReceipt>;
getLogs(filter: Filter): Promise<Array<Log>>;
getEtherPrice(): Promise<number>;
private _resolveNames;
private _getResolver;
resolveName(name: string | Promise<string>): Promise<string>;
lookupAddress(address: string | Promise<string>): Promise<string>;
static checkTransactionResponse(transaction: any): TransactionResponse;
doPoll(): void;
perform(method: string, params: any): Promise<any>;
protected _startPending(): void;
protected _stopPending(): void;
private _addEventListener;
on(eventName: EventType, listener: Listener): Provider;
once(eventName: EventType, listener: Listener): Provider;
addEventListener(eventName: EventType, listener: Listener): Provider;
emit(eventName: EventType, ...args: Array<any>): boolean;
listenerCount(eventName?: EventType): number;
listeners(eventName: EventType): Array<Listener>;
removeAllListeners(eventName: EventType): Provider;
removeListener(eventName: EventType, listener: Listener): Provider;
}
//# sourceMappingURL=provider.d.ts.map

@ -0,0 +1,8 @@
import { JsonRpcProvider } from './json-rpc-provider';
import { AsyncProvider, Networkish } from '../utils/types';
export declare class Web3Provider extends JsonRpcProvider {
readonly _web3Provider: AsyncProvider;
constructor(web3Provider: AsyncProvider, network?: Networkish);
send(method: string, params: any): Promise<any>;
}
//# sourceMappingURL=web3-provider.d.ts.map

14
dist/types/utils/abi-coder.d.ts vendored Normal file

@ -0,0 +1,14 @@
import { Arrayish, CoerceFunc, EventFragment, FunctionFragment, ParamType } from './types';
export declare const defaultCoerceFunc: CoerceFunc;
export declare function parseParamType(type: string): ParamType;
export declare function formatParamType(paramType: ParamType): string;
export declare function formatSignature(fragment: EventFragment | FunctionFragment): string;
export declare function parseSignature(fragment: string): EventFragment | FunctionFragment;
export declare class AbiCoder {
readonly coerceFunc: CoerceFunc;
constructor(coerceFunc?: CoerceFunc);
encode(types: Array<string | ParamType>, values: Array<any>): string;
decode(types: Array<string | ParamType>, data: Arrayish): Array<any>;
}
export declare const defaultAbiCoder: AbiCoder;
//# sourceMappingURL=abi-coder.d.ts.map

8
dist/types/utils/address.d.ts vendored Normal file

@ -0,0 +1,8 @@
import { Arrayish, BigNumber } from './types';
export declare function getAddress(address: string): string;
export declare function getIcapAddress(address: string): string;
export declare function getContractAddress(transaction: {
from: string;
nonce: Arrayish | BigNumber | number;
}): string;
//# sourceMappingURL=address.d.ts.map

4
dist/types/utils/base64.d.ts vendored Normal file

@ -0,0 +1,4 @@
import { Arrayish } from './types';
export declare function decode(textData: string): Uint8Array;
export declare function encode(data: Arrayish): string;
//# sourceMappingURL=base64.d.ts.map

8
dist/types/utils/bignumber.d.ts vendored Normal file

@ -0,0 +1,8 @@
import { BigNumber as _BigNumber, BigNumberish } from './types';
export declare function bigNumberify(value: BigNumberish): _BigNumber;
export declare const ConstantNegativeOne: _BigNumber;
export declare const ConstantZero: _BigNumber;
export declare const ConstantOne: _BigNumber;
export declare const ConstantTwo: _BigNumber;
export declare const ConstantWeiPerEther: _BigNumber;
//# sourceMappingURL=bignumber.d.ts.map

21
dist/types/utils/bytes.d.ts vendored Normal file

@ -0,0 +1,21 @@
/**
* Conversion Utilities
*
*/
import { Arrayish, BigNumber, Signature } from './types';
export declare const AddressZero = "0x0000000000000000000000000000000000000000";
export declare const HashZero = "0x0000000000000000000000000000000000000000000000000000000000000000";
export declare function isArrayish(value: any): boolean;
export declare function arrayify(value: Arrayish | BigNumber): Uint8Array;
export declare function concat(objects: Array<Arrayish>): Uint8Array;
export declare function stripZeros(value: Arrayish): Uint8Array;
export declare function padZeros(value: Arrayish, length: number): Uint8Array;
export declare function isHexString(value: any, length?: number): boolean;
export declare function hexlify(value: Arrayish | BigNumber | number): string;
export declare function hexDataLength(data: string): number;
export declare function hexDataSlice(data: string, offset: number, length?: number): string;
export declare function hexStripZeros(value: string): string;
export declare function hexZeroPad(value: string, length: number): string;
export declare function splitSignature(signature: Arrayish | Signature): Signature;
export declare function joinSignature(signature: Signature): string;
//# sourceMappingURL=bytes.d.ts.map

14
dist/types/utils/errors.d.ts vendored Normal file

@ -0,0 +1,14 @@
export declare const UNKNOWN_ERROR = "UNKNOWN_ERROR";
export declare const NOT_IMPLEMENTED = "NOT_IMPLEMENTED";
export declare const MISSING_NEW = "MISSING_NEW";
export declare const CALL_EXCEPTION = "CALL_EXCEPTION";
export declare const INVALID_ARGUMENT = "INVALID_ARGUMENT";
export declare const MISSING_ARGUMENT = "MISSING_ARGUMENT";
export declare const UNEXPECTED_ARGUMENT = "UNEXPECTED_ARGUMENT";
export declare const NUMERIC_FAULT = "NUMERIC_FAULT";
export declare const UNSUPPORTED_OPERATION = "UNSUPPORTED_OPERATION";
export declare function throwError(message: string, code: string, params: any): never;
export declare function checkNew(self: any, kind: any): void;
export declare function checkArgumentCount(count: number, expectedCount: number, suffix?: string): void;
export declare function setCensorship(censorship: boolean, permanent?: boolean): void;
//# sourceMappingURL=errors.d.ts.map

5
dist/types/utils/hash.d.ts vendored Normal file

@ -0,0 +1,5 @@
import { Arrayish } from './types';
export declare function namehash(name: string): string;
export declare function id(text: string): string;
export declare function hashMessage(message: Arrayish | string): string;
//# sourceMappingURL=hash.d.ts.map

3
dist/types/utils/hmac.d.ts vendored Normal file

@ -0,0 +1,3 @@
import { Arrayish, SupportedAlgorithms } from './types';
export declare function computeHmac(algorithm: SupportedAlgorithms, key: Arrayish, data: Arrayish): Uint8Array;
//# sourceMappingURL=hmac.d.ts.map

33
dist/types/utils/index.d.ts vendored Normal file

@ -0,0 +1,33 @@
import { getAddress, getContractAddress, getIcapAddress } from './address';
import { AbiCoder, defaultAbiCoder, formatSignature, formatParamType, parseSignature, parseParamType } from './abi-coder';
import * as base64 from './base64';
import { bigNumberify } from './bignumber';
import { arrayify, concat, hexDataSlice, hexDataLength, hexlify, hexStripZeros, hexZeroPad, joinSignature, padZeros, splitSignature, stripZeros } from './bytes';
import { hashMessage, id, namehash } from './hash';
import { getJsonWalletAddress } from './json-wallet';
import { keccak256 } from './keccak256';
import { sha256 } from './sha2';
import { keccak256 as solidityKeccak256, pack as solidityPack, sha256 as soliditySha256 } from './solidity';
import { randomBytes } from './random-bytes';
import { getNetwork } from './networks';
import { defineFrozen, defineReadOnly, resolveProperties, shallowCopy } from './properties';
import * as RLP from './rlp';
import { computePublicKey, verifyMessage } from './secp256k1';
import { parse as parseTransaction, serialize as serializeTransaction } from './transaction';
import { toUtf8Bytes, toUtf8String } from './utf8';
import { formatEther, parseEther, formatUnits, parseUnits } from './units';
import { fetchJson } from './web';
import * as types from './types';
import * as errors from './errors';
declare const etherSymbol = "\u039E";
declare const constants: {
AddressZero: string;
HashZero: string;
NegativeOne: types.BigNumber;
Zero: types.BigNumber;
One: types.BigNumber;
Two: types.BigNumber;
WeiPerEther: types.BigNumber;
};
export { AbiCoder, defaultAbiCoder, formatSignature, formatParamType, parseSignature, parseParamType, constants, types, RLP, fetchJson, getNetwork, defineReadOnly, defineFrozen, resolveProperties, shallowCopy, etherSymbol, arrayify, concat, padZeros, stripZeros, base64, bigNumberify, hexlify, hexStripZeros, hexZeroPad, hexDataLength, hexDataSlice, toUtf8Bytes, toUtf8String, hashMessage, namehash, id, getAddress, getIcapAddress, getContractAddress, formatEther, parseEther, formatUnits, parseUnits, keccak256, sha256, randomBytes, solidityPack, solidityKeccak256, soliditySha256, splitSignature, joinSignature, parseTransaction, serializeTransaction, getJsonWalletAddress, computePublicKey, verifyMessage, errors };
//# sourceMappingURL=index.d.ts.map

4
dist/types/utils/json-wallet.d.ts vendored Normal file

@ -0,0 +1,4 @@
export declare function isCrowdsaleWallet(json: string): boolean;
export declare function isSecretStorageWallet(json: string): boolean;
export declare function getJsonWalletAddress(json: string): string;
//# sourceMappingURL=json-wallet.d.ts.map

3
dist/types/utils/keccak256.d.ts vendored Normal file

@ -0,0 +1,3 @@
import { Arrayish } from './types';
export declare function keccak256(data: Arrayish): string;
//# sourceMappingURL=keccak256.d.ts.map

9
dist/types/utils/networks.d.ts vendored Normal file

@ -0,0 +1,9 @@
import { Network, Networkish } from '../utils/types';
/**
* getNetwork
*
* Converts a named common networks or chain ID (network ID) to a Network
* and verifies a network is a valid Network..
*/
export declare function getNetwork(network: Networkish): Network;
//# sourceMappingURL=networks.d.ts.map

3
dist/types/utils/pbkdf2.d.ts vendored Normal file

@ -0,0 +1,3 @@
import { Arrayish } from './types';
export declare function pbkdf2(password: Arrayish, salt: Arrayish, iterations: number, keylen: number, hashAlgorithm: string): Uint8Array;
//# sourceMappingURL=pbkdf2.d.ts.map

6
dist/types/utils/properties.d.ts vendored Normal file

@ -0,0 +1,6 @@
export declare function defineReadOnly(object: any, name: string, value: any): void;
export declare function defineFrozen(object: any, name: string, value: any): void;
export declare function resolveProperties(object: any): Promise<any>;
export declare function shallowCopy(object: any): any;
export declare function jsonCopy(object: any): any;
//# sourceMappingURL=properties.d.ts.map

2
dist/types/utils/random-bytes.d.ts vendored Normal file

@ -0,0 +1,2 @@
export declare function randomBytes(length: number): Uint8Array;
//# sourceMappingURL=random-bytes.d.ts.map

4
dist/types/utils/rlp.d.ts vendored Normal file

@ -0,0 +1,4 @@
import { Arrayish } from './types';
export declare function encode(object: any): string;
export declare function decode(data: Arrayish): any;
//# sourceMappingURL=rlp.d.ts.map

15
dist/types/utils/secp256k1.d.ts vendored Normal file

@ -0,0 +1,15 @@
import { Arrayish, Signature } from './types';
export declare class KeyPair {
readonly privateKey: string;
readonly publicKey: string;
readonly compressedPublicKey: string;
readonly publicKeyBytes: Uint8Array;
constructor(privateKey: Arrayish);
sign(digest: Arrayish): Signature;
}
export declare function recoverPublicKey(digest: Arrayish, signature: Signature): string;
export declare function computePublicKey(key: Arrayish, compressed?: boolean): string;
export declare function recoverAddress(digest: Arrayish, signature: Signature): string;
export declare function computeAddress(key: string): string;
export declare function verifyMessage(message: Arrayish | string, signature: Signature | string): string;
//# sourceMappingURL=secp256k1.d.ts.map

4
dist/types/utils/sha2.d.ts vendored Normal file

@ -0,0 +1,4 @@
import { Arrayish } from './types';
export declare function sha256(data: Arrayish): string;
export declare function sha512(data: Arrayish): string;
//# sourceMappingURL=sha2.d.ts.map

2
dist/types/utils/shims.d.ts vendored Normal file

@ -0,0 +1,2 @@
export declare const platform = "node";
//# sourceMappingURL=shims.d.ts.map

4
dist/types/utils/solidity.d.ts vendored Normal file

@ -0,0 +1,4 @@
export declare function pack(types: Array<string>, values: Array<any>): string;
export declare function keccak256(types: Array<string>, values: Array<any>): string;
export declare function sha256(types: Array<string>, values: Array<any>): string;
//# sourceMappingURL=solidity.d.ts.map

4
dist/types/utils/transaction.d.ts vendored Normal file

@ -0,0 +1,4 @@
import { Arrayish, Signature, Transaction, UnsignedTransaction } from './types';
export declare function serialize(transaction: UnsignedTransaction, signature?: Arrayish | Signature): string;
export declare function parse(rawTransaction: Arrayish): Transaction;
//# sourceMappingURL=transaction.d.ts.map

301
dist/types/utils/types.d.ts vendored Normal file

@ -0,0 +1,301 @@
export declare type Arrayish = string | ArrayLike<number>;
export declare abstract class BigNumber {
abstract fromTwos(value: number): BigNumber;
abstract toTwos(value: number): BigNumber;
abstract add(other: BigNumberish): BigNumber;
abstract sub(other: BigNumberish): BigNumber;
abstract div(other: BigNumberish): BigNumber;
abstract mul(other: BigNumberish): BigNumber;
abstract mod(other: BigNumberish): BigNumber;
abstract pow(other: BigNumberish): BigNumber;
abstract maskn(value: number): BigNumber;
abstract eq(other: BigNumberish): boolean;
abstract lt(other: BigNumberish): boolean;
abstract lte(other: BigNumberish): boolean;
abstract gt(other: BigNumberish): boolean;
abstract gte(other: BigNumberish): boolean;
abstract isZero(): boolean;
abstract toNumber(): number;
abstract toString(): string;
abstract toHexString(): string;
}
export declare type BigNumberish = BigNumber | string | number | Arrayish;
export declare type ConnectionInfo = {
url: string;
user?: string;
password?: string;
allowInsecure?: boolean;
};
export interface OnceBlockable {
once(eventName: "block", handler: () => void): void;
}
export declare type PollOptions = {
timeout?: number;
floor?: number;
ceiling?: number;
interval?: number;
onceBlock?: OnceBlockable;
};
export declare type SupportedAlgorithms = 'sha256' | 'sha512';
export interface Signature {
r: string;
s: string;
recoveryParam?: number;
v?: number;
}
export declare type Network = {
name: string;
chainId: number;
ensAddress?: string;
};
export declare type Networkish = Network | string | number;
export declare type CoerceFunc = (type: string, value: any) => any;
export declare type ParamType = {
name?: string;
type: string;
indexed?: boolean;
components?: Array<any>;
};
export declare type EventFragment = {
type: string;
name: string;
anonymous: boolean;
inputs: Array<ParamType>;
};
export declare type FunctionFragment = {
type: string;
name: string;
constant: boolean;
inputs: Array<ParamType>;
outputs: Array<ParamType>;
payable: boolean;
stateMutability: string;
};
export declare type UnsignedTransaction = {
to?: string;
nonce?: number;
gasLimit?: BigNumberish;
gasPrice?: BigNumberish;
data?: Arrayish;
value?: BigNumberish;
chainId?: number;
};
export interface Transaction {
hash?: string;
to?: string;
from?: string;
nonce: number;
gasLimit: BigNumber;
gasPrice: BigNumber;
data: string;
value: BigNumber;
chainId: number;
r?: string;
s?: string;
v?: number;
}
export declare type BlockTag = string | number;
export interface Block {
hash: string;
parentHash: string;
number: number;
timestamp: number;
nonce: string;
difficulty: number;
gasLimit: BigNumber;
gasUsed: BigNumber;
miner: string;
extraData: string;
transactions: Array<string>;
}
export declare type Filter = {
fromBlock?: BlockTag;
toBlock?: BlockTag;
address?: string;
topics?: Array<string | Array<string>>;
};
export interface Log {
blockNumber?: number;
blockHash?: string;
transactionIndex?: number;
removed?: boolean;
transactionLogIndex?: number;
address: string;
data: string;
topics: Array<string>;
transactionHash?: string;
logIndex?: number;
}
export interface TransactionReceipt {
contractAddress?: string;
transactionIndex?: number;
root?: string;
gasUsed?: BigNumber;
logsBloom?: string;
blockHash?: string;
transactionHash?: string;
logs?: Array<Log>;
blockNumber?: number;
cumulativeGasUsed?: BigNumber;
byzantium: boolean;
status?: number;
}
export declare type TransactionRequest = {
to?: string | Promise<string>;
from?: string | Promise<string>;
nonce?: number | string | Promise<number | string>;
gasLimit?: BigNumberish | Promise<BigNumberish>;
gasPrice?: BigNumberish | Promise<BigNumberish>;
data?: Arrayish | Promise<Arrayish>;
value?: BigNumberish | Promise<BigNumberish>;
chainId?: number | Promise<number>;
};
export interface TransactionResponse extends Transaction {
blockNumber?: number;
blockHash?: string;
timestamp?: number;
from: string;
raw?: string;
wait: (timeout?: number) => Promise<TransactionReceipt>;
}
export declare abstract class Indexed {
readonly hash: string;
}
export interface DeployDescription {
readonly inputs: Array<ParamType>;
readonly payable: boolean;
encode(bytecode: string, params: Array<any>): string;
}
export interface FunctionDescription {
readonly type: "call" | "transaction";
readonly name: string;
readonly signature: string;
readonly sighash: string;
readonly inputs: Array<ParamType>;
readonly outputs: Array<ParamType>;
readonly payable: boolean;
encode(params: Array<any>): string;
decode(data: string): any;
}
export interface EventDescription {
readonly name: string;
readonly signature: string;
readonly inputs: Array<ParamType>;
readonly anonymous: boolean;
readonly topic: string;
encodeTopics(params: Array<any>): Array<string>;
decode(data: string, topics?: Array<string>): any;
}
export interface LogDescription {
readonly name: string;
readonly signature: string;
readonly topic: string;
readonly values: Array<any>;
}
export interface TransactionDescription {
readonly name: string;
readonly args: Array<any>;
readonly signature: string;
readonly sighash: string;
readonly decode: (data: string) => any;
readonly value: BigNumber;
}
export declare type ContractFunction = (...params: Array<any>) => Promise<any>;
export declare type EventFilter = {
address?: string;
topics?: Array<string>;
};
export interface Event extends Log {
args: Array<any>;
decode: (data: string, topics?: Array<string>) => any;
event: string;
eventSignature: string;
removeListener: () => void;
getBlock: () => Promise<Block>;
getTransaction: () => Promise<TransactionResponse>;
getTransactionReceipt: () => Promise<TransactionReceipt>;
}
export declare type EventType = string | Array<string> | Filter;
export declare type Listener = (...args: Array<any>) => void;
/**
* Provider
*
* Note: We use an abstract class so we can use instanceof to determine if an
* object is a Provider.
*/
export declare abstract class MinimalProvider implements OnceBlockable {
abstract getNetwork(): Promise<Network>;
abstract getBlockNumber(): Promise<number>;
abstract getGasPrice(): Promise<BigNumber>;
abstract getBalance(addressOrName: string | Promise<string>, blockTag?: BlockTag | Promise<BlockTag>): Promise<BigNumber>;
abstract getTransactionCount(addressOrName: string | Promise<string>, blockTag?: BlockTag | Promise<BlockTag>): Promise<number>;
abstract getCode(addressOrName: string | Promise<string>, blockTag?: BlockTag | Promise<BlockTag>): Promise<string>;
abstract getStorageAt(addressOrName: string | Promise<string>, position: BigNumberish | Promise<BigNumberish>, blockTag?: BlockTag | Promise<BlockTag>): Promise<string>;
abstract sendTransaction(signedTransaction: string | Promise<string>): Promise<TransactionResponse>;
abstract call(transaction: TransactionRequest): Promise<string>;
abstract estimateGas(transaction: TransactionRequest): Promise<BigNumber>;
abstract getBlock(blockHashOrBlockTag: BlockTag | string | Promise<BlockTag | string>): Promise<Block>;
abstract getTransaction(transactionHash: string): Promise<TransactionResponse>;
abstract getTransactionReceipt(transactionHash: string): Promise<TransactionReceipt>;
abstract getLogs(filter: Filter): Promise<Array<Log>>;
abstract resolveName(name: string | Promise<string>): Promise<string>;
abstract lookupAddress(address: string | Promise<string>): Promise<string>;
abstract on(eventName: EventType, listener: Listener): MinimalProvider;
abstract once(eventName: EventType, listener: Listener): MinimalProvider;
abstract listenerCount(eventName?: EventType): number;
abstract listeners(eventName: EventType): Array<Listener>;
abstract removeAllListeners(eventName: EventType): MinimalProvider;
abstract removeListener(eventName: EventType, listener: Listener): MinimalProvider;
abstract waitForTransaction(transactionHash: string, timeout?: number): Promise<TransactionReceipt>;
}
export declare type AsyncProvider = {
isMetaMask?: boolean;
host?: string;
path?: string;
sendAsync: (request: any, callback: (error: any, response: any) => void) => void;
};
export declare type ProgressCallback = (percent: number) => void;
export declare type EncryptOptions = {
iv?: Arrayish;
entropy?: Arrayish;
mnemonic?: string;
path?: string;
client?: string;
salt?: Arrayish;
uuid?: string;
scrypt?: {
N?: number;
r?: number;
p?: number;
};
};
/**
* Signer
*
* Note: We use an abstract class so we can use instanceof to determine if an
* object is a Signer.
*/
export declare abstract class Signer {
provider?: MinimalProvider;
abstract getAddress(): Promise<string>;
abstract signMessage(message: Arrayish | string): Promise<string>;
abstract sendTransaction(transaction: TransactionRequest): Promise<TransactionResponse>;
}
export declare abstract class HDNode {
readonly privateKey: string;
readonly publicKey: string;
readonly mnemonic: string;
readonly path: string;
readonly chainCode: string;
readonly index: number;
readonly depth: number;
abstract derivePath(path: string): HDNode;
}
export interface Wordlist {
locale: string;
getWord(index: number): string;
getWordIndex(word: string): number;
split(mnemonic: string): Array<string>;
join(words: Array<string>): string;
}
//# sourceMappingURL=types.d.ts.map

6
dist/types/utils/units.d.ts vendored Normal file

@ -0,0 +1,6 @@
import { BigNumber, BigNumberish } from './types';
export declare function formatUnits(value: BigNumberish, unitType?: string | number, options?: any): string;
export declare function parseUnits(value: string, unitType?: string | number): BigNumber;
export declare function formatEther(wei: BigNumberish, options?: any): string;
export declare function parseEther(ether: string): BigNumber;
//# sourceMappingURL=units.d.ts.map

11
dist/types/utils/utf8.d.ts vendored Normal file

@ -0,0 +1,11 @@
import { Arrayish } from './types';
export declare enum UnicodeNormalizationForm {
current = "",
NFC = "NFC",
NFD = "NFD",
NFKC = "NFKC",
NFKD = "NFKD"
}
export declare function toUtf8Bytes(str: string, form?: UnicodeNormalizationForm): Uint8Array;
export declare function toUtf8String(bytes: Arrayish): string;
//# sourceMappingURL=utf8.d.ts.map

4
dist/types/utils/web.d.ts vendored Normal file

@ -0,0 +1,4 @@
import { ConnectionInfo, PollOptions } from './types';
export declare function fetchJson(connection: string | ConnectionInfo, json: string, processFunc: (value: any) => any): Promise<any>;
export declare function poll(func: () => Promise<any>, options?: PollOptions): Promise<any>;
//# sourceMappingURL=web.d.ts.map

9
dist/types/wallet/hdnode.d.ts vendored Normal file

@ -0,0 +1,9 @@
import { Arrayish, HDNode as _HDNode, Wordlist } from '../utils/types';
export declare const defaultPath = "m/44'/60'/0'/0/0";
export declare function fromMnemonic(mnemonic: string, wordlist?: Wordlist): _HDNode;
export declare function fromSeed(seed: Arrayish): _HDNode;
export declare function mnemonicToSeed(mnemonic: string, password?: string): string;
export declare function mnemonicToEntropy(mnemonic: string, wordlist?: Wordlist): string;
export declare function entropyToMnemonic(entropy: Arrayish, wordlist?: Wordlist): string;
export declare function isValidMnemonic(mnemonic: string, wordlist?: Wordlist): boolean;
//# sourceMappingURL=hdnode.d.ts.map

5
dist/types/wallet/index.d.ts vendored Normal file

@ -0,0 +1,5 @@
import { Wallet } from './wallet';
import * as HDNode from './hdnode';
import { SigningKey } from './signing-key';
export { HDNode, SigningKey, Wallet };
//# sourceMappingURL=index.d.ts.map

6
dist/types/wallet/secret-storage.d.ts vendored Normal file

@ -0,0 +1,6 @@
import { SigningKey } from './signing-key';
import { Arrayish, EncryptOptions, ProgressCallback } from '../utils/types';
export declare function decryptCrowdsale(json: string, password: Arrayish | string): SigningKey;
export declare function decrypt(json: string, password: Arrayish, progressCallback?: ProgressCallback): Promise<SigningKey>;
export declare function encrypt(privateKey: Arrayish | SigningKey, password: Arrayish | string, options?: EncryptOptions, progressCallback?: ProgressCallback): Promise<string>;
//# sourceMappingURL=secret-storage.d.ts.map

12
dist/types/wallet/signing-key.d.ts vendored Normal file

@ -0,0 +1,12 @@
import { Arrayish, HDNode, Signature } from '../utils/types';
export declare class SigningKey {
readonly privateKey: string;
readonly publicKey: string;
readonly address: string;
readonly mnemonic: string;
readonly path: string;
private readonly keyPair;
constructor(privateKey: Arrayish | HDNode);
signDigest(digest: Arrayish): Signature;
}
//# sourceMappingURL=signing-key.d.ts.map

29
dist/types/wallet/wallet.d.ts vendored Normal file

@ -0,0 +1,29 @@
import { SigningKey } from './signing-key';
import { Arrayish, BigNumber, BlockTag, HDNode, MinimalProvider, ProgressCallback, Signer, TransactionRequest, TransactionResponse, Wordlist } from '../utils/types';
export declare class Wallet extends Signer {
readonly provider: MinimalProvider;
private readonly signingKey;
constructor(privateKey: SigningKey | HDNode | Arrayish, provider?: MinimalProvider);
readonly address: string;
readonly mnemonic: string;
readonly path: string;
readonly privateKey: string;
/**
* Create a new instance of this Wallet connected to provider.
*/
connect(provider: MinimalProvider): Wallet;
getAddress(): Promise<string>;
sign(transaction: TransactionRequest): Promise<string>;
signMessage(message: Arrayish | string): Promise<string>;
getBalance(blockTag?: BlockTag): Promise<BigNumber>;
getTransactionCount(blockTag?: BlockTag): Promise<number>;
sendTransaction(transaction: TransactionRequest): Promise<TransactionResponse>;
encrypt(password: Arrayish | string, options: any, progressCallback: ProgressCallback): Promise<string>;
/**
* Static methods to create Wallet instances.
*/
static createRandom(options?: any): Wallet;
static fromEncryptedJson(json: string, password: Arrayish, progressCallback: ProgressCallback): Promise<Wallet>;
static fromMnemonic(mnemonic: string, path?: string, wordlist?: Wordlist): Wallet;
}
//# sourceMappingURL=wallet.d.ts.map

10
dist/types/wordlists/index.d.ts vendored Normal file

@ -0,0 +1,10 @@
import { Wordlist } from './wordlist';
declare const en: Wordlist;
declare const ko: Wordlist;
declare const it: Wordlist;
declare const ja: Wordlist;
declare const zh: Wordlist;
declare const zh_cn: Wordlist;
declare const zh_tw: Wordlist;
export { en, it, ja, ko, zh, zh_cn, zh_tw };
//# sourceMappingURL=index.d.ts.map

9
dist/types/wordlists/lang-en.d.ts vendored Normal file

@ -0,0 +1,9 @@
import { Wordlist } from './wordlist';
declare class LangEn extends Wordlist {
constructor();
getWord(index: number): string;
getWordIndex(word: string): number;
}
declare const langEn: LangEn;
export { langEn };
//# sourceMappingURL=lang-en.d.ts.map

9
dist/types/wordlists/lang-it.d.ts vendored Normal file

@ -0,0 +1,9 @@
import { Wordlist } from './wordlist';
declare class LangIt extends Wordlist {
constructor();
getWord(index: number): string;
getWordIndex(word: string): number;
}
declare const langIt: LangIt;
export { langIt };
//# sourceMappingURL=lang-it.d.ts.map

11
dist/types/wordlists/lang-ja.d.ts vendored Normal file

@ -0,0 +1,11 @@
import { Wordlist } from './wordlist';
declare class LangJa extends Wordlist {
constructor();
getWord(index: number): string;
getWordIndex(word: string): number;
split(mnemonic: string): Array<string>;
join(words: Array<string>): string;
}
declare const langJa: LangJa;
export { langJa };
//# sourceMappingURL=lang-ja.d.ts.map

9
dist/types/wordlists/lang-ko.d.ts vendored Normal file

@ -0,0 +1,9 @@
import { Wordlist } from './wordlist';
declare class LangKo extends Wordlist {
constructor();
getWord(index: number): string;
getWordIndex(word: string): number;
}
declare const langKo: LangKo;
export { langKo };
//# sourceMappingURL=lang-ko.d.ts.map

11
dist/types/wordlists/lang-zh.d.ts vendored Normal file

@ -0,0 +1,11 @@
import { Wordlist } from './wordlist';
declare class LangZh extends Wordlist {
constructor(country: string);
getWord(index: number): string;
getWordIndex(word: string): number;
split(mnemonic: string): Array<string>;
}
declare const langZhCn: LangZh;
declare const langZhTw: LangZh;
export { langZhCn, langZhTw };
//# sourceMappingURL=lang-zh.d.ts.map

12
dist/types/wordlists/wordlist.d.ts vendored Normal file

@ -0,0 +1,12 @@
import { Wordlist as _Wordlist } from '../utils/types';
export declare function check(wordlist: _Wordlist): string;
export declare abstract class Wordlist implements _Wordlist {
locale: string;
constructor(locale: string);
abstract getWord(index: number): string;
abstract getWordIndex(word: string): number;
split(mnemonic: string): Array<string>;
join(words: Array<string>): string;
}
export declare function register(lang: Wordlist, name?: string): void;
//# sourceMappingURL=wordlist.d.ts.map

@ -158,8 +158,8 @@ taskBundle("default", { filename: "ethers.js", minify: false });
// Creates dist/ethers.min.js // Creates dist/ethers.min.js
taskBundle("minified", { filename: "ethers.min.js", minify: true }); taskBundle("minified", { filename: "ethers.min.js", minify: true });
// Crearte a single definition file and its map as dist/ethers.d.ts[.map] // Dump the TypeScript definitions to dist/types/
gulp.task("temp-types", function() { gulp.task("types", function() {
return gulp.src(['./src.ts/index.ts', './src.ts/**/*.ts']) return gulp.src(['./src.ts/index.ts', './src.ts/**/*.ts'])
.pipe(ts({ .pipe(ts({
declaration: true, declaration: true,
@ -170,7 +170,7 @@ gulp.task("temp-types", function() {
target: "es5", target: "es5",
})) }))
.dts .dts
.pipe(gulp.dest(".tmp")) .pipe(gulp.dest("dist/types"))
}); });
/** /**

@ -1,15 +1,15 @@
{ {
"name": "ethers", "name": "ethers",
"version": "4.0.0-beta.2", "version": "4.0.0-beta.3",
"description": "Ethereum wallet library.", "description": "Ethereum wallet library.",
"main": "./index.js", "main": "./index.js",
"types": "./dist/ethers.d.ts", "types": "./dist/types/",
"scripts": { "scripts": {
"build": "npm run dist-version && tsc -p ./tsconfig.json", "build": "npm run dist-version && tsc -p ./tsconfig.json",
"auto-build": "npm run build -- -w", "auto-build": "npm run build -- -w",
"dist": "npm run dist-version && npm run build && gulp default minified && npm run dist-types", "dist": "npm run dist-version && npm run build && gulp default minified && npm run dist-types",
"dist-bip39": "gulp bip39-it bip39-ja bip39-ko bip39-zh", "dist-bip39": "gulp bip39-it bip39-ja bip39-ko bip39-zh",
"dist-types": "gulp temp-types && dts-bundle --name ethers --main .tmp/index.d.ts --out ../dist/ethers.d.ts", "dist-types": "gulp types && dts-bundle --name ethers --main dist/types/index.d.ts --out ../ethers.types.txt",
"dist-version": "node -e \"let v = require('./package.json').version; require('fs').writeFileSync('./src.ts/_version.ts', 'export const version = \\\"' + v +'\\\";\\n')\"", "dist-version": "node -e \"let v = require('./package.json').version; require('fs').writeFileSync('./src.ts/_version.ts', 'export const version = \\\"' + v +'\\\";\\n')\"",
"eslint": "eslint index.js contracts/*.js providers/*.js utils/*.js wallet/*.js wordlists/*.js", "eslint": "eslint index.js contracts/*.js providers/*.js utils/*.js wallet/*.js wordlists/*.js",
"test": "if [ \"$RUN_PHANTOMJS\" = \"1\" ]; then npm run-script test-phantomjs; else npm run-script test-node; fi", "test": "if [ \"$RUN_PHANTOMJS\" = \"1\" ]; then npm run-script test-phantomjs; else npm run-script test-node; fi",