Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
for (const [key, val] of Object.entries(requiredEnvVars)) {
if (val === null || val === undefined) {
logger.warn('Missing environment variable', {
key,
value: val,
})
exit(1)
}
}
const clearPendingTxs = requiredEnvVars.CLEAR_PENDING_TXS
const l2Provider = injectL2Context(
new JsonRpcProvider(requiredEnvVars.L2_NODE_WEB3_URL)
)
const sequencerSigner: Signer = await getSequencerSigner()
let proposerSigner: Signer = await getProposerSigner()
const sequencerAddress = await sequencerSigner.getAddress()
const proposerAddress = await proposerSigner.getAddress()
// If the sequencer & proposer are the same, use a single wallet
if (sequencerAddress === proposerAddress) {
proposerSigner = sequencerSigner
}
logger.info('Configured batch submitter addresses', {
sequencerAddress,
proposerAddress,
addressManagerAddress: requiredEnvVars.ADDRESS_MANAGER_ADDRESS,
exports.Contract = contracts_1.Contract;
exports.ContractFactory = contracts_1.ContractFactory;
var bignumber_1 = require("@ethersproject/bignumber");
exports.BigNumber = bignumber_1.BigNumber;
exports.FixedNumber = bignumber_1.FixedNumber;
var abstract_signer_1 = require("@ethersproject/abstract-signer");
exports.Signer = abstract_signer_1.Signer;
exports.VoidSigner = abstract_signer_1.VoidSigner;
var wallet_1 = require("@ethersproject/wallet");
exports.Wallet = wallet_1.Wallet;
var constants = __importStar(require("@ethersproject/constants"));
exports.constants = constants;
var providers = __importStar(require("@ethersproject/providers"));
exports.providers = providers;
var providers_1 = require("@ethersproject/providers");
exports.getDefaultProvider = providers_1.getDefaultProvider;
var wordlists_1 = require("@ethersproject/wordlists");
exports.Wordlist = wordlists_1.Wordlist;
exports.wordlists = wordlists_1.wordlists;
var utils = __importStar(require("./utils"));
exports.utils = utils;
var logger_1 = require("@ethersproject/logger");
var errors = logger_1.Logger.errors;
exports.errors = errors;
////////////////////////
// Compile-Time Constants
// This is generated by "npm run dist"
var _version_1 = require("./_version");
exports.version = _version_1.version;
var logger = new logger_1.Logger(_version_1.version);
exports.logger = logger;
protected async _init(): Promise {
if (!this.options.db.isOpen()) {
await this.options.db.open()
}
this.state.db = new TransportDB(this.options.db)
this.state.l1RpcProvider =
typeof this.options.l1RpcProvider === 'string'
? new JsonRpcProvider(this.options.l1RpcProvider)
: this.options.l1RpcProvider
this._initializeApp()
}
protected async _init(): Promise {
if (this.options.legacySequencerCompatibility) {
this.logger.info(
'Using legacy sync, this will be quite a bit slower than normal'
)
}
this.state.db = new TransportDB(this.options.db)
this.state.l2RpcProvider =
typeof this.options.l2RpcProvider === 'string'
? new JsonRpcProvider(this.options.l2RpcProvider)
: this.options.l2RpcProvider
}
protected async _init(): Promise {
this.state.db = new TransportDB(this.options.db)
this.state.l1RpcProvider =
typeof this.options.l1RpcProvider === 'string'
? new JsonRpcProvider(this.options.l1RpcProvider)
: this.options.l1RpcProvider
this.logger.info('Using AddressManager', {
addressManager: this.options.addressManager,
})
const Lib_AddressManager = loadContract(
'Lib_AddressManager',
this.options.addressManager,
this.state.l1RpcProvider
)
const code = await this.state.l1RpcProvider.getCode(
Lib_AddressManager.address
)
if (fromHexString(code).length === 0) {
const initialize = () => {
const provider =
window.web3 && window.web3.currentProvider
? new Web3Provider(window.web3.currentProvider)
: new FallbackProvider([
new JsonRpcProvider('https://api.mycryptoapi.com/eth'),
new InfuraProvider(),
new EtherscanProvider()
]);
handleConnect(provider);
};
const getSequencerSigner = async (): Promise => {
const l1Provider = new JsonRpcProvider(requiredEnvVars.L1_NODE_WEB3_URL)
if (useHardhat) {
if (!DEBUG_IMPERSONATE_SEQUENCER_ADDRESS) {
throw new Error('Must pass DEBUG_IMPERSONATE_SEQUENCER_ADDRESS')
}
await l1Provider.send('hardhat_impersonateAccount', [
DEBUG_IMPERSONATE_SEQUENCER_ADDRESS,
])
return l1Provider.getSigner(DEBUG_IMPERSONATE_SEQUENCER_ADDRESS)
}
if (SEQUENCER_PRIVATE_KEY) {
return new Wallet(SEQUENCER_PRIVATE_KEY, l1Provider)
} else if (SEQUENCER_MNEMONIC) {
return Wallet.fromMnemonic(SEQUENCER_MNEMONIC, SEQUENCER_HD_PATH).connect(
l1Provider
const initialize = () => {
const provider =
window.web3 && window.web3.currentProvider
? new Web3Provider(window.web3.currentProvider)
: new FallbackProvider([
new JsonRpcProvider('https://api.mycryptoapi.com/eth'),
new InfuraProvider(),
new EtherscanProvider()
]);
handleConnect(provider);
};
function getLibrary(provider: any): Web3Provider {
const library = new Web3Provider(provider)
library.pollingInterval = 8000
return library
}
const initialize = () => {
const provider =
window.web3 && window.web3.currentProvider
? new Web3Provider(window.web3.currentProvider)
: new FallbackProvider([
new JsonRpcProvider('https://api.mycryptoapi.com/eth'),
new InfuraProvider(),
new EtherscanProvider()
]);
handleConnect(provider);
};