def instantiate_blockchain_handlers(app_config, file_mode=True): issuing_address = app_config.issuing_address chain = app_config.chain secret_manager = initialize_signer(app_config) if file_mode: certificate_batch_handler = CertificateBatchHandler( secret_manager=secret_manager, certificate_handler=CertificateV2Handler(), merkle_tree=MerkleTreeGenerator()) else: certificate_batch_handler = CertificateBatchWebHandler( secret_manager=secret_manager, certificate_handler=CertificateWebV2Handler(), merkle_tree=MerkleTreeGenerator()) if chain == Chain.mockchain: transaction_handler = MockTransactionHandler() else: cost_constants = BitcoinTransactionCostConstants( app_config.tx_fee, app_config.dust_threshold, app_config.satoshi_per_byte) connector = BitcoinServiceProviderConnector(chain, app_config.bitcoind) transaction_handler = BitcoinTransactionHandler( connector, cost_constants, secret_manager, issuing_address=issuing_address) return certificate_batch_handler, transaction_handler, connector
def instantiate_blockchain_handlers(app_config): check_necessary_arguments(app_config) issuing_address = app_config.issuing_address chain = app_config.chain secret_manager = initialize_signer(app_config) certificate_batch_handler = CertificateBatchHandler( secret_manager=secret_manager, certificate_handler=CertificateV3Handler(), merkle_tree=MerkleTreeGenerator(), config=app_config) if chain == Chain.mockchain: transaction_handler = MockTransactionHandler() # ethereum chains elif chain == Chain.ethereum_mainnet or chain == Chain.ethereum_bloxberg: cost_constants = EthereumTransactionCostConstants( app_config.gas_price, app_config.gas_limit) connector = instantiate_connector(app_config, cost_constants) transaction_handler = EthereumSCTransactionHandler( connector, cost_constants, secret_manager, issuing_address=issuing_address) return certificate_batch_handler, transaction_handler, connector
def instantiate_blockchain_handlers(app_config): issuing_address = app_config.issuing_address chain = app_config.chain secret_manager = initialize_signer(app_config) certificate_batch_handler = CertificateBatchHandler(secret_manager=secret_manager, certificate_handler=CertificateV2Handler(), merkle_tree=MerkleTreeGenerator()) if chain == Chain.mockchain: transaction_handler = MockTransactionHandler() # ethereum chains elif chain == Chain.ethereum_mainnet or chain == Chain.ethereum_ropsten: cost_constants = EthereumTransactionCostConstants(app_config.gas_price, app_config.gas_limit) connector = EthereumServiceProviderConnector(chain, app_config.api_token) transaction_handler = EthereumTransactionHandler(connector, cost_constants, secret_manager, issuing_address=issuing_address) return certificate_batch_handler, transaction_handler, connector