ethers.js/src.ts/ethers.ts

85 lines
1.6 KiB
TypeScript
Raw Normal View History

'use strict';
import { Contract, ContractFactory, VoidSigner } from './contract';
2018-08-02 00:35:23 +03:00
import { Signer } from './abstract-signer';
import { Wallet } from './wallet';
import * as constants from './constants';
import * as errors from './errors';
import * as providers from './providers';
import * as utils from './utils';
import * as wordlists from './wordlists';
////////////////////////
// Compile-Time Constants
2018-08-02 00:35:23 +03:00
// 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';
////////////////////////
// Types
import { ContractFunction, ContractTransaction, Event, EventFilter } from './contract';
////////////////////////
// Helper Functions
function getDefaultProvider(network?: utils.Network | string): providers.BaseProvider {
if (network == null) { network = 'homestead'; }
let n = utils.getNetwork(network);
if (!n || !n._defaultProvider) {
errors.throwError('unsupported getDefaultProvider network', errors.UNSUPPORTED_OPERATION, {
operation: 'getDefaultProvider',
network: network
});
}
return n._defaultProvider(providers);
2018-08-02 00:35:23 +03:00
}
////////////////////////
// Exports
export {
Signer,
Wallet,
VoidSigner,
getDefaultProvider,
2018-08-02 00:35:23 +03:00
providers,
Contract,
ContractFactory,
constants,
errors,
utils,
2018-08-02 00:35:23 +03:00
wordlists,
////////////////////////
// Compile-Time Constants
2018-07-17 09:05:24 +03:00
platform,
version,
////////////////////////
// Types
ContractFunction,
ContractTransaction,
Event,
EventFilter
};