2018-07-16 10:27:49 +03:00
|
|
|
'use strict';
|
|
|
|
|
2018-09-26 22:47:09 +03:00
|
|
|
import { Contract, ContractFactory, VoidSigner } from './contract';
|
2018-08-02 00:35:23 +03:00
|
|
|
|
2018-09-24 22:55:17 +03:00
|
|
|
import { Signer } from './abstract-signer';
|
|
|
|
import { Wallet } from './wallet';
|
2018-07-31 01:59:52 +03:00
|
|
|
|
2018-09-24 22:55:17 +03:00
|
|
|
import * as constants from './constants';
|
|
|
|
import * as errors from './errors';
|
2018-08-13 18:58:19 +03:00
|
|
|
|
2018-09-24 22:55:17 +03:00
|
|
|
import * as providers from './providers';
|
2018-07-31 01:59:52 +03:00
|
|
|
import * as utils from './utils';
|
2018-09-24 22:55:17 +03:00
|
|
|
import * as wordlists from './wordlists';
|
2018-07-16 10:27:49 +03:00
|
|
|
|
|
|
|
|
2018-09-24 22:55:17 +03:00
|
|
|
////////////////////////
|
|
|
|
// Compile-Time Constants
|
2018-07-16 10:27:49 +03:00
|
|
|
|
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"
|
2018-07-16 10:27:49 +03:00
|
|
|
import { version } from './_version';
|
|
|
|
|
2018-09-24 22:55:17 +03:00
|
|
|
|
|
|
|
////////////////////////
|
|
|
|
// Types
|
|
|
|
|
2018-10-05 02:54:15 +03:00
|
|
|
import { ContractFunction, ContractTransaction, Event, EventFilter } from './contract';
|
2018-09-24 22:55:17 +03:00
|
|
|
|
|
|
|
|
|
|
|
////////////////////////
|
|
|
|
// Helper Functions
|
|
|
|
|
|
|
|
function getDefaultProvider(network?: utils.Network | string): providers.BaseProvider {
|
2018-11-22 00:23:44 +03:00
|
|
|
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
|
|
|
|
});
|
|
|
|
}
|
2018-11-20 23:41:12 +03:00
|
|
|
return n._defaultProvider(providers);
|
2018-08-02 00:35:23 +03:00
|
|
|
}
|
|
|
|
|
2018-09-24 22:55:17 +03:00
|
|
|
|
|
|
|
////////////////////////
|
|
|
|
// Exports
|
|
|
|
|
2018-07-16 10:27:49 +03:00
|
|
|
export {
|
2018-09-24 22:55:17 +03:00
|
|
|
Signer,
|
|
|
|
|
2018-07-16 10:27:49 +03:00
|
|
|
Wallet,
|
2018-09-04 17:28:26 +03:00
|
|
|
VoidSigner,
|
2018-07-16 10:27:49 +03:00
|
|
|
|
2018-07-31 01:59:52 +03:00
|
|
|
getDefaultProvider,
|
2018-08-02 00:35:23 +03:00
|
|
|
providers,
|
2018-07-16 10:27:49 +03:00
|
|
|
|
2018-09-24 22:55:17 +03:00
|
|
|
Contract,
|
2018-09-26 22:47:09 +03:00
|
|
|
ContractFactory,
|
2018-09-24 22:55:17 +03:00
|
|
|
|
2018-07-16 10:27:49 +03:00
|
|
|
constants,
|
2018-09-24 22:55:17 +03:00
|
|
|
errors,
|
2018-07-16 10:27:49 +03:00
|
|
|
|
2018-09-24 22:55:17 +03:00
|
|
|
utils,
|
2018-08-02 00:35:23 +03:00
|
|
|
|
2018-07-16 10:27:49 +03:00
|
|
|
wordlists,
|
|
|
|
|
2018-09-24 22:55:17 +03:00
|
|
|
////////////////////////
|
|
|
|
// Compile-Time Constants
|
|
|
|
|
2018-07-17 09:05:24 +03:00
|
|
|
platform,
|
2018-09-24 22:55:17 +03:00
|
|
|
version,
|
|
|
|
|
|
|
|
////////////////////////
|
|
|
|
// Types
|
|
|
|
|
|
|
|
ContractFunction,
|
2018-10-05 02:54:15 +03:00
|
|
|
ContractTransaction,
|
2018-09-24 22:55:17 +03:00
|
|
|
Event,
|
|
|
|
EventFilter
|
2018-07-16 10:27:49 +03:00
|
|
|
};
|
|
|
|
|