2
0
mirror of synced 2025-02-25 12:35:17 +00:00
ethers.js/providers/infura-provider.js

22 lines
646 B
JavaScript
Raw Normal View History

2017-02-25 01:23:48 -05:00
var JsonRpcProvider = require('./json-rpc-provider.js');
var utils = (function() {
return {
defineProperty: require('ethers-utils/properties.js').defineProperty
}
})();
function InfuraProvider(testnet, apiAccessToken) {
if (!(this instanceof InfuraProvider)) { throw new Error('missing new'); }
var host = (testnet ? "ropsten": "mainnet") + '.infura.io';
var url = 'https://' + host + '/' + (apiAccessToken || '');
JsonRpcProvider.call(this, url, testnet);
utils.defineProperty(this, 'apiAccessToken', apiAccessToken || null);
}
2017-03-01 02:31:11 -05:00
JsonRpcProvider.inherits(InfuraProvider);
2017-02-25 01:23:48 -05:00
module.exports = InfuraProvider;