Example #1
0
def test_extract_valid_transaction_params_includes_invalid():
    input = {
        'chainId': 1,
        'type': '0x2',
        'from': '0x0',
        'to': '0x0',
        'gas': 21000,
        'gasPrice': 5000000,
        'maxFeePerGas': 2000000000,
        'maxPriorityFeePerGas': 1000000000,
        'value': 1,
        'tokens': 9000,
    }
    valid_transaction_params = extract_valid_transaction_params(input)
    assert valid_transaction_params == {
        'chainId': 1,
        'type': '0x2',
        'from': '0x0',
        'to': '0x0',
        'gas': 21000,
        'gasPrice': 5000000,
        'maxFeePerGas': 2000000000,
        'maxPriorityFeePerGas': 1000000000,
        'value': 1,
    }
Example #2
0
 def modifyTransaction(
     self, transaction_hash: _Hash32, **transaction_params: Any
 ) -> HexBytes:
     assert_valid_transaction_params(cast(TxParams, transaction_params))
     current_transaction = get_required_transaction(self.web3, transaction_hash)
     current_transaction_params = extract_valid_transaction_params(current_transaction)
     new_transaction = merge(current_transaction_params, transaction_params)
     return replace_transaction(self.web3, current_transaction, new_transaction)
Example #3
0
 def modifyTransaction(self, transaction_hash, **transaction_params):
     assert_valid_transaction_params(transaction_params)
     current_transaction = get_required_transaction(self.web3,
                                                    transaction_hash)
     current_transaction_params = extract_valid_transaction_params(
         current_transaction)
     new_transaction = merge(current_transaction_params, transaction_params)
     return replace_transaction(self.web3, current_transaction,
                                new_transaction)
Example #4
0
def test_extract_valid_transaction_params_includes_invalid():
    input = {
        'from': '0x0',
        'to': '0x0',
        'gas': 21000,
        'gasPrice': 5000000,
        'value': 1,
        'tokens': 9000,
    }
    valid_transaction_params = extract_valid_transaction_params(input)
    assert valid_transaction_params == {
        'from': '0x0',
        'to': '0x0',
        'gas': 21000,
        'gasPrice': 5000000,
        'value': 1,
    }
Example #5
0
def test_extract_valid_transaction_params_invalid(transaction_params,
                                                  expected_exc_msg):
    with pytest.raises(AttributeError, match=expected_exc_msg):
        extract_valid_transaction_params(transaction_params)
Example #6
0
def test_extract_valid_transaction_params(transaction_params, expected):
    valid_transaction_params = extract_valid_transaction_params(
        transaction_params)
    assert valid_transaction_params == expected
def test_extract_valid_transaction_params_invalid(transaction_params, expected_exc_msg):
    with pytest.raises(AttributeError, match=expected_exc_msg):
        extract_valid_transaction_params(transaction_params)
def test_extract_valid_transaction_params(transaction_params, expected):
    valid_transaction_params = extract_valid_transaction_params(transaction_params)
    assert valid_transaction_params == expected
Example #9
0
 def modifyTransaction(self, transaction_hash, **transaction_params):
     assert_valid_transaction_params(transaction_params)
     current_transaction = get_required_transaction(self.web3, transaction_hash)
     current_transaction_params = extract_valid_transaction_params(current_transaction)
     new_transaction = merge(current_transaction_params, transaction_params)
     return replace_transaction(self.web3, current_transaction, new_transaction)