Beispiel #1
0
def setup_all():
    setup_network()
    web3 = Web3Provider.get_web3()
    if web3.eth.accounts and web3.eth.accounts[0].lower(
    ) == '0xe2DD09d719Da89e5a3D0F2549c7E24566e947260'.lower():
        wallet = Wallet(
            web3,
            private_key=
            '0xc594c6e5def4bab63ac29eed19a134c130388f74f019bc74b8f4389df2837a58'
        )

        provider = get_provider_wallet()
        if web3.fromWei(Web3Helper.get_ether_balance(provider.address),
                        'ether') < 10:
            Web3Helper.send_ether(wallet, provider.address, 25)

        consumer = get_consumer_wallet()
        if web3.fromWei(Web3Helper.get_ether_balance(consumer.address),
                        'ether') < 10:
            Web3Helper.send_ether(wallet, consumer.address, 25)
Beispiel #2
0
def setup_all():
    setup_network()
    web3 = Web3Provider.get_web3()
    if (
        web3.eth.accounts
        and web3.eth.accounts[0].lower()
        == "0xe2DD09d719Da89e5a3D0F2549c7E24566e947260".lower()
    ):
        wallet = Wallet(
            web3,
            private_key="0xfd5c1ccea015b6d663618850824154a3b3fb2882c46cefb05b9a93fea8c3d215",
        )

        provider = get_provider_wallet()
        if web3.fromWei(Web3Helper.get_ether_balance(provider.address), "ether") < 10:
            Web3Helper.send_ether(wallet, provider.address, 25)

        consumer = get_consumer_wallet()
        if web3.fromWei(Web3Helper.get_ether_balance(consumer.address), "ether") < 10:
            Web3Helper.send_ether(wallet, consumer.address, 25)
    check_required_attributes, check_url_details, get_asset_download_urls,
    get_asset_url_at_index, get_asset_urls, get_compute_endpoint,
    get_download_url, get_metadata_url, get_request_data,
    process_compute_request, process_consume_request, record_consume_request,
    validate_algorithm_dict, validate_order,
    validate_transfer_not_used_for_other_service)
from ocean_provider.utils.accounts import verify_signature
from ocean_provider.utils.basics import (LocalFileAdapter,
                                         get_asset_from_metadatastore,
                                         get_config, get_datatoken_minter,
                                         get_provider_wallet, setup_network)
from ocean_provider.utils.encryption import do_encrypt

setup_logging()
services = Blueprint('services', __name__)
setup_network()
provider_wallet = get_provider_wallet()
requests_session = get_requests_session()
requests_session.mount('file://', LocalFileAdapter())
user_nonce = UserNonce(get_config().storage_path)

logger = logging.getLogger(__name__)


@services.route('/nonce', methods=['GET'])
def nonce():
    required_attributes = [
        'userAddress',
    ]
    data = get_request_data(request)