Пример #1
0
def create_signed_contract_transaction(
        private_key: str,
        contract: Contract,
        func_name: str,
        args: List[Any],
        value: int = 0,
        nonce_offset: int = 0,
        gas_price: Union[int, None] = None,
        gas_limit: int = NETWORK_CFG.GAS_LIMIT) -> str:
    """
    Creates a signed on-chain contract transaction compliant with EIP155.
    """
    if gas_price is None:
        gas_price = NETWORK_CFG.GAS_PRICE
    tx = create_contract_transaction(contract=contract,
                                     from_=privkey_to_addr(private_key),
                                     func_name=func_name,
                                     args=args,
                                     value=value,
                                     nonce_offset=nonce_offset,
                                     gas_price=gas_price,
                                     gas_limit=gas_limit)
    sign_transaction(tx, private_key, int(contract.web3.version.network))
    #    sign_transaction(tx, private_key, 1337)
    return encode_hex(rlp.encode(tx))
Пример #2
0
def create_signed_transaction(
        private_key: str,
        web3: Web3,
        to: str,
        value: int=0,
        data=b'',
        nonce_offset: int = 0,
        gas_price: int = GAS_PRICE,
        gas_limit: int = GAS_LIMIT
) -> str:
    """
    Creates a signed on-chain transaction compliant with EIP155.
    """
    tx = create_transaction(
        web3=web3,
        from_=privkey_to_addr(private_key),
        to=to,
        value=value,
        data=data,
        nonce_offset=nonce_offset,
        gas_price=gas_price,
        gas_limit=gas_limit
    )
    sign_transaction(tx, private_key, web3.version.network)
    return encode_hex(rlp.encode(tx))
Пример #3
0
def create_signed_transaction(
        private_key: str,
        web3: Web3,
        to: str,
        value: int=0,
        data=b'',
        nonce_offset: int = 0,
        gas_price: Union[int, None] = None,
        gas_limit: int = NETWORK_CFG.POT_GAS_LIMIT
) -> str:
    """
    Creates a signed on-chain transaction compliant with EIP155.
    """
    if gas_price is None:
        gas_price = NETWORK_CFG.GAS_PRICE
    tx = create_transaction(
        web3=web3,
        from_=privkey_to_addr(private_key),
        to=to,
        value=value,
        data=data,
        nonce_offset=nonce_offset,
        gas_price=gas_price,
        gas_limit=gas_limit
    )
    sign_transaction(tx, private_key, int(web3.version.network))
    return encode_hex(rlp.encode(tx))
Пример #4
0
def create_signed_contract_transaction(
        private_key: str,
        contract: Contract,
        func_name: str,
        args: List[Any],
        value: int=0,
        nonce_offset: int = 0,
        gas_price: Union[int, None] = None,
        gas_limit: int = NETWORK_CFG.GAS_LIMIT
) -> str:
    """
    Creates a signed on-chain contract transaction compliant with EIP155.
    """
    if gas_price is None:
        gas_price = NETWORK_CFG.GAS_PRICE
    tx = create_contract_transaction(
        contract=contract,
        from_=privkey_to_addr(private_key),
        func_name=func_name,
        args=args,
        value=value,
        nonce_offset=nonce_offset,
        gas_price=gas_price,
        gas_limit=gas_limit
    )
    sign_transaction(tx, private_key, int(contract.web3.version.network))
    return encode_hex(rlp.encode(tx))
Пример #5
0
def create_signed_transaction(
    web3: Web3,
    private_key: str,
    to: str,
    value: int,
) -> str:

    tx = create_transaction(web3=web3,
                            from_=privkey_to_addr(private_key),
                            to=to,
                            value=value)
    sign_transaction(tx, private_key, int(web3.version.network))
    return encode_hex(rlp.encode(tx))