Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions hyperliquid/exchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -1078,17 +1078,18 @@ def c_validator_unregister(self) -> Any:

def multi_sig(self, multi_sig_user, inner_action, signatures, nonce, vault_address=None):
multi_sig_user = multi_sig_user.lower()
is_mainnet = self.base_url == MAINNET_API_URL
chain_id = "0xa4b1" if is_mainnet else "0x66eee"
multi_sig_action = {
"type": "multiSig",
"signatureChainId": "0x66eee",
"signatureChainId": chain_id,
"signatures": signatures,
"payload": {
"multiSigUser": multi_sig_user,
"outerSigner": self.wallet.address.lower(),
"action": inner_action,
},
}
is_mainnet = self.base_url == MAINNET_API_URL
signature = sign_multi_sig_action(
self.wallet,
multi_sig_action,
Expand Down
32 changes: 28 additions & 4 deletions hyperliquid/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -608,11 +608,35 @@ def delegator_history(self, user: str) -> Any:
"""
return self.post("/info", {"type": "delegatorHistory", "user": user})

def query_order_by_oid(self, user: str, oid: int) -> Any:
return self.post("/info", {"type": "orderStatus", "user": user, "oid": oid})
def query_order_by_oid(self, user: str, oid: int, dex: str = "") -> Any:
"""Query order status by order ID.

def query_order_by_cloid(self, user: str, cloid: Cloid) -> Any:
return self.post("/info", {"type": "orderStatus", "user": user, "oid": cloid.to_raw()})
POST /info

Args:
user (str): Onchain address in 42-character hexadecimal format.
oid (int): Order ID.
dex (str): Optional DEX identifier (defaults to "" for the original DEX).

Returns:
Order status.
"""
return self.post("/info", {"type": "orderStatus", "user": user, "oid": oid, "dex": dex})

def query_order_by_cloid(self, user: str, cloid: Cloid, dex: str = "") -> Any:
"""Query order status by client order ID.

POST /info

Args:
user (str): Onchain address in 42-character hexadecimal format.
cloid (Cloid): Client order ID.
dex (str): Optional DEX identifier (defaults to "" for the original DEX).

Returns:
Order status.
"""
return self.post("/info", {"type": "orderStatus", "user": user, "oid": cloid.to_raw(), "dex": dex})

def query_referral_state(self, user: str) -> Any:
return self.post("/info", {"type": "referral", "user": user})
Expand Down
7 changes: 3 additions & 4 deletions hyperliquid/utils/signing.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,8 @@ def sign_l1_action(wallet, action, active_pool, nonce, expires_after, is_mainnet
def sign_user_signed_action(wallet, action, payload_types, primary_type, is_mainnet):
# signatureChainId is the chain used by the wallet to sign and can be any chain.
# hyperliquidChain determines the environment and prevents replaying an action on a different chain.
action["signatureChainId"] = "0x66eee"
if "signatureChainId" not in action:
action["signatureChainId"] = "0xa4b1" if is_mainnet else "0x66eee"
action["hyperliquidChain"] = "Mainnet" if is_mainnet else "Testnet"
data = user_signed_payload(primary_type, payload_types, action)
return sign_inner(wallet, data)
Expand Down Expand Up @@ -312,9 +313,7 @@ def sign_multi_sig_l1_action_payload(


def sign_multi_sig_action(wallet, action, is_mainnet, vault_address, nonce, expires_after):
action_without_tag = action.copy()
del action_without_tag["type"]
multi_sig_action_hash = action_hash(action_without_tag, vault_address, nonce, expires_after)
multi_sig_action_hash = action_hash(action, vault_address, nonce, expires_after)
envelope = {
"multiSigActionHash": multi_sig_action_hash,
"nonce": nonce,
Expand Down