Skip to content

Unable to send order with the generated api credentials #46

@gmoutsin

Description

@gmoutsin

I have created a new account using a wallet I created with metamask. I have tried to create the credentials and send an order but I get an error saying "the order signer address has to be the address of the API KEY"

This is the minimal script I used:

host: str = os.getenv("CLOB_API_URL", "https://clob.polymarket.com")
private_key = "0xabc...def"

client = ClobClient(
    host=host,
    key=private_key,
    chain_id=137,
)

creds = client.create_or_derive_api_key()

print("CLOB_API_KEY=", creds.api_key)
print("CLOB_SECRET=", creds.api_secret)
print("CLOB_PASS_PHRASE=", creds.api_passphrase)


client = ClobClient(
    host=host,
    key=private_key,
    chain_id=137,
    creds=creds,
    signature_type=SignatureTypeV2.POLY_1271,
    funder="0x123...456" 
)



resp = client.create_and_post_order(
    order_args=OrderArgs(
        token_id="111...111",
        price=0.1,
        side=Side.BUY,
        size=10,
    ),
    options=PartialCreateOrderOptions(tick_size="0.01"),
    order_type=OrderType.GTC,
)

print(resp)

When I run this, it prints the following:

CLOB_API_KEY=abc...abc
CLOB_SECRET= xyz...xyz
CLOB_PASS_PHRASE= 123...123


[py_clob_client_v2] request error status=400 url=https://clob.polymarket.com/order body={"error":"the order signer address has to be the address of the API KEY"}

In my code, the funder address is the address I see on polymarket when I go to my profile settings.

I'm not sure how reproducible this problem is, but it is very consistent for me.

Am I doing something wrong here or there is actually a bug somewhere?

EDIT: I should clarify that I can use the credentials to see my balance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions