From 558ef2c00db7fa876bb2e36ad5f1f5584df9567c Mon Sep 17 00:00:00 2001 From: Richard Moore Date: Wed, 1 Aug 2018 17:35:23 -0400 Subject: [PATCH] Updated ethers exported structure. --- src.ts/ethers.ts | 201 +++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 187 insertions(+), 14 deletions(-) diff --git a/src.ts/ethers.ts b/src.ts/ethers.ts index cec65ea2f..f9c4274d3 100644 --- a/src.ts/ethers.ts +++ b/src.ts/ethers.ts @@ -1,9 +1,7 @@ 'use strict'; -// This is empty in node, and used by browserify to inject extra goodies -import { platform } from './utils/shims'; - import { Contract, Interface } from './contracts'; + import { Provider, getDefaultProvider, @@ -17,19 +15,200 @@ import { IpcProvider, } from './providers'; + +import { JsonRpcSigner } from './providers/json-rpc-provider'; + import { HDNode, SigningKey, Wallet } from './wallet'; import * as utils from './utils'; -import * as wordlists from './wordlists'; -import * as types from './types'; +import * as wordlists from './wordlists'; import * as errors from './utils/errors'; +// This is empty in node, and used by browserify to inject extra goodies +import { platform } from './utils/shims'; + +// This is generated by "npm run dist" import { version } from './_version'; +/////////////////////////////// +// Imported Abstracts + +import { Provider as _AbstractProvider } from './providers/abstract-provider'; +import { Signer as _AbstractSigner } from './wallet/abstract-signer'; + +/////////////////////////////// +// Imported Types + +import { + ContractFunction as _ContractFunction, + Event as _Event, + EventFilter as _EventFilter +} from './contracts/contract'; + +import { + Indexed as _Indexed, + + DeployDescription as _DeplyDescription, + EventDescription as _EventDescription, + FunctionDescription as _FunctionDescription, + LogDescription as _LogDescription, + TransactionDescription as _TransactionDescription +} from './contracts/interface'; + +import { + Block as _Block, + BlockTag as _BlockTag, + EventType as _EventType, + Filter as _Filter, + Log as _Log, + Listener as _Listener, + TransactionReceipt as _TransactionReceipt, + TransactionRequest as _TransactionRequest, + TransactionResponse as _TransactionResponse, +} from './providers/abstract-provider'; + +import { AsyncSendable as _AsyncSendable } from './providers/web3-provider'; + +import { + CoerceFunc as _CoerceFunc, + EventFragment as _EventFragment, + FunctionFragment as _FunctionFragment, + ParamType as _ParamType +} from './utils/abi-coder'; + +import { BigNumberish as _BigNumberish } from './utils/bignumber'; + +import { + Arrayish as _Arrayish, + Hexable as _Hexable, + Signature as _Signature +} from './utils/bytes'; + +import { SupportedAlgorithms as _SupportedAlgorithms } from './utils/hmac'; + +import { + Network as _Network, + Networkish as _Networkish +} from './utils/networks'; + +import { + Transaction as _Transaction, + UnsignedTransaction as _UnsignedTransaction +} from './utils/transaction'; + +import { UnicodeNormalizationForm as _UnicodeNotmalizationForm } from './utils/utf8'; + +import { + ConnectionInfo as _ConnectionInfo, + OnceBlockable as _OnceBlockable, + PollOptions as _PollOptions +} from './utils/web'; + +import { + EncryptOptions as _EncryptOptions, + ProgressCallback as _ProgressCallback +} from './wallet/secret-storage'; + +import { Wordlist as _Wordlist } from './wordlists/wordlist'; + +/////////////////////////////// +// Exported Types + +module types { + export const AbstractSigner = _AbstractSigner; + export const AbstractProvider = _AbstractProvider; + + export type SignerOrProvider = _AbstractSigner | _AbstractProvider; + + // ./contracts/contract + export type ContractFunction = _ContractFunction; + export type EventFilter = _EventFilter; + export interface Event extends _Event { }; + + // ./contracts/interface + export interface Indexed extends _Indexed { }; + export interface DeployDescription extends _DeplyDescription { }; + export interface EventDescription extends _EventDescription { }; + export interface FunctionDescription extends _FunctionDescription { }; + export interface LogDescription extends _LogDescription { }; + export interface TransactionDescription extends _TransactionDescription { }; + + // ./providers/abstract-provider + export type BlockTag = _BlockTag; + export type EventType = _EventType; + export type Filter = _Filter; + export type Listener = _Listener; + export type TransactionRequest = _TransactionRequest; + export interface Block extends _Block { }; + export interface Log extends _Log { }; + export interface TransactionReceipt extends _TransactionReceipt { }; + export interface TransactionResponse extends _TransactionResponse { } + + // ./providers/web3-provider + export type AsyncSendable = _AsyncSendable; + + // ./utils/abi-coder + export type CoerceFunc = _CoerceFunc; + export type EventFragment = _EventFragment; + export type FunctionFragment = _FunctionFragment; + export type ParamType = _ParamType; + + // ./utils/bignumber + export type BigNumberish = _BigNumberish; + + // ./utils/bytes + export type Arrayish = _Arrayish; + export type Hexable = _Hexable; + export type Signature = _Signature; + + // ./utils/hmac + export const SupportedAlgorithms = _SupportedAlgorithms; + + // ./utils/networks + export type Network = _Network; + export type Networkish = _Networkish; + + // ./utils/transaction + export type UnsignedTransaction = _UnsignedTransaction; + export interface Transaction extends _Transaction { }; + + // ./utils/utf8 + export const UnicodeNormalizationForm = _UnicodeNotmalizationForm; + + // ./utils/web + export type ConnectionInfo = _ConnectionInfo; + export interface OnceBlockable extends _OnceBlockable { }; + export type PollOptions = _PollOptions; + + // ./wallet/secret-storage + export type EncryptOptions = _EncryptOptions; + export type ProgressCallback = _ProgressCallback; + + // ./wordlists/wordlist + export const Wordlist = _Wordlist; +} + +/////////////////////////////// + const constants = utils.constants; +const providers = { + Provider, + + FallbackProvider, + + EtherscanProvider, + InfuraProvider, + + IpcProvider, + JsonRpcProvider, + Web3Provider, + + JsonRpcSigner +}; + export { Wallet, @@ -40,20 +219,14 @@ export { Interface, getDefaultProvider, - Provider, - FallbackProvider, - EtherscanProvider, - InfuraProvider, - JsonRpcProvider, - Web3Provider, - IpcProvider, - - types, + providers, errors, constants, utils, + types, + wordlists, platform,