-
Notifications
You must be signed in to change notification settings - Fork 218
Open
Description
Description
When using exchange.place_order() with a valid wallet, the API returns an error saying the user doesn't exist, but with a different random address each time instead of the actual wallet address.
Environment
- hyperliquid SDK version:
0.2.4 - ethers version:
2.0.14 - Chain:
Arbitrum(mainnet)
Code to reproduce
use hyperliquid::{Exchange, Hyperliquid};
use hyperliquid::types::{Chain, exchange::request::{OrderRequest, OrderType, Limit, Tif}};
use ethers::signers::LocalWallet;
use std::sync::Arc;
let wallet: Arc<LocalWallet> = Arc::new("PRIVATE_KEY".parse().unwrap());
println!("Wallet address: {:?}", wallet.address()); // Shows correct address
let exchange: Exchange = Hyperliquid::new(Chain::Arbitrum);
let order = OrderRequest {
asset: 1,
is_buy: true,
reduce_only: false,
limit_px: "0.197".to_string(),
sz: "0.5".to_string(),
order_type: OrderType::Limit(Limit { tif: Tif::Alo }),
cloid: Some(uuid::Uuid::new_v4()),
};
let response = exchange.place_order(wallet.clone(), vec![order], None).await;
Order should be placed successfully with the wallet address 0x8c8016320127dce465340f550db9ef530c7429e6
API returns: "User or API Wallet 0x8c3ae6e7de0e0684fbfd0bf58c89c272773e5887 does not exist."
The address in the error (0x8c3ae6e7...) is different from the actual wallet address (0x8c8016...) and changes randomly on each call:
First call: 0x8c3ae6e7de0e0684fbfd0bf58c89c272773e5887
Second call: 0x406ced1d4dfb4fb79ad309c4a056cd9097d8ce5a
Third call: 0xb4e82b002a9b243c6900a4a0e2c67cf71da82a3e
The API appears to be recovering a different address via ecrecover from the EIP-712 signature. This suggests the signature validation is using a different message hash than what's being signed.
The connection_id calculation and EIP-712 Agent signature seem correct based on the SDK source code, but something in the signature process doesn't match what the API expects.
Is there a known issue with EIP-712 signatures in v0.2.4? Has anyone successfully used place_order with this version?Metadata
Metadata
Assignees
Labels
No labels