so am trying out the /txs
endpoint and am getting the following error response:
{'message': "'eyJra...LFQzOLA' not a valid key=value pair (missing equal-sign) in Authorization header: 'Bearer eyJra...LFQzOLA'."}
here is my request body:
{
'value': 0,
'gas': 101379,
'chainId': 80001,
'gasPrice': 50000000000,
'from': '0xC52A1435fC79e130058d3Ab3040Cc149e50684fA',
'nonce': 18,
'to': '0x5714b30B1E511873700df2CC9aa3B88Eec51F0f1',
'data': '0xe5f4e139000000000000000000000000000000000000000000000001158e460913d00000000000000000000000000000e11a86849d99f524cac3e7a0ec1241828e332c62',
'signature': '0x7182d5c3c1c0a39f2588cd0d2a5db586673352cddce7a620e7c5b6282eab9df03b2b5622e12f799fc7e9e2bc4613cf55555ff7b9e5b10c6cea9d7d9f1b896e881b'
}
And here is the full code:
import requests
import boto3
from pycognito.aws_srp import AWSSRP
boto = boto3.client('cognito-idp', region_name="us-west-2")
aws = AWSSRP(
username=os.environ.get("RELAYER_API_KEY"),
password=os.environ.get("RELAYER_API_SECRET")
pool_id="us-west-2_iLmIggsiy",
client_id="1bpd19lcr33qvg5cr3oi79rdap"
pool_region="us-west-2",
)
tokens = aws.authenticate_user()
bearer_token = tokens['AuthenticationResult']['AccessToken']
headers = {
"Accept": "application/json",
"Content-Type": "application/json",
"X-Api-Key": os.environ.get("RELAYER_API_KEY"),
"Authorization": f"Bearer {bearer_token}"
}
payload = {
'value': 0,
'gas': 101379,
'chainId': 80001,
'gasPrice': 50000000000,
'from': '0xC52A1435fC79e130058d3Ab3040Cc149e50684fA',
'nonce': 18,
'to': '0x5714b30B1E511873700df2CC9aa3B88Eec51F0f1',
'data': '0xe5f4e139000000000000000000000000000000000000000000000001158e460913d00000000000000000000000000000e11a86849d99f524cac3e7a0ec1241828e332c62',
'signature': '0x7182d5c3c1c0a39f2588cd0d2a5db586673352cddce7a620e7c5b6282eab9df03b2b5622e12f799fc7e9e2bc4613cf55555ff7b9e5b10c6cea9d7d9f1b896e881b'
}
response = requests.post(
"https://api.defender.openzeppelin.com/relayer/txs",
json=payload,
headers=self.headers,
timeout=8,
).json()
However, this same authorization and headers setup works sucessfully with GET
requests like:
requests.get(
"https://api.defender.openzeppelin.com/relayer/txs",
headers=headers,
timeout=8,
)
Anything I might be missing?