def _build_execute_transfer_limit_payload(account, token, to, amount, paymentToken, payment, signatures): return "0x7e7b6dbb" + \ account[2:].zfill(64) + \ token[2:].zfill(64) + \ to[2:].zfill(64) + \ int_to_hex(amount)[2:].zfill(64) + \ paymentToken[2:].zfill(64) + \ int_to_hex(payment)[2:].zfill(64) + \ int_to_hex(224)[2:].zfill(64) + \ int_to_hex(65)[2:].zfill(64) + \ signatures[2:].zfill(96)
def _build_execute_allowance_transfer_payload(account, token, to, amount, paymentToken, payment, delegate, signatures): return "0x4515641a" + \ account[2:].zfill(64) + \ token[2:].zfill(64) + \ to[2:].zfill(64) + \ int_to_hex(amount)[2:].zfill(64) + \ paymentToken[2:].zfill(64) + \ int_to_hex(payment)[2:].zfill(64) + \ delegate[2:].zfill(64) + \ int_to_hex(256)[2:].zfill(64) + \ int_to_hex(65)[2:].zfill(64) + \ signatures[2:].zfill(96)
def _estimate_transaction_eoa(address, value=0, data=""): data = { "from": sender, "to": address, "value": "0x0" if value == 0 else int_to_hex(value), "data": data } response = rpc_call("eth_estimateGas", [data]) result = response.get("result") if not result: raise RpcException(response.get("error")) return {'estimate': parse_int_or_hex(result)}
def call(address, value=0, data=""): data = { "from": _relayer(), "to": address, "value": "0x0" if value == 0 else int_to_hex(value), "data": data } response = rpc_call("eth_call", [data, "latest"]) result = response.get("result") if not result: raise RpcException(response.get("error")) return result
def _build_get_safe_transaction_hash_payload(to, value, data, operation, safeTxGas, baseGas, gasPrice, gasToken, refundReceiver, nonce): return "0xd8d11f78" + \ to[2:].zfill(64) + \ int_to_hex(value)[2:].zfill(64) + \ int_to_hex(320)[2:].zfill(64) + \ int_to_hex(operation)[2:].zfill(64) + \ int_to_hex(safeTxGas)[2:].zfill(64) + \ int_to_hex(baseGas)[2:].zfill(64) + \ int_to_hex(gasPrice)[2:].zfill(64) + \ gasToken[2:].zfill(64) + \ refundReceiver[2:].zfill(64) + \ int_to_hex(nonce)[2:].zfill(64) + \ int_to_hex(int(len(data[2:]) / 2))[2:].zfill(64) + \ data[2:]