コード例 #1
0
    def __call__(self, transaction: BaseTransactionFields) -> bool:

        transaction_class = self.get_appropriate_tx_class()
        tx = transaction_class(**transaction.as_dict())
        try:
            tx.validate()
        except ValidationError:
            return False
        else:
            return True
コード例 #2
0
def mk_transaction():
    return BaseTransactionFields(
        nonce=0,
        gas=21000,
        gas_price=1,
        to=os.urandom(20),
        value=random.randint(0, 100),
        data=b'',
        v=27,
        r=big_endian_to_int(os.urandom(32)),
        s=big_endian_to_int(os.urandom(32)),
    )