pybotters.helpers.hyperliquid¶
Signing helpers for Hyperliquid API.
Construct EIP-712 typed data
Sign EIP-712 typed data
- pybotters.helpers.hyperliquid.construct_l1_action(action: Mapping[str, object], nonce: int, is_mainnet: bool, vault_address: str | None = None, expires_after: int | None = None) tuple[EIP712Domain, Mapping[str, Sequence[MessageType]], PhantomAgentMessage]¶
Construct EIP-712 typed data for Hyperliquid L1 action.
- パラメータ:
action -- Hyperqilid
actionobjectnonce -- nonce for signing
is_mainnet -- True for mainnet, False for testnet
vault_address -- (optional) vault address
- 戻り値:
tuple[EIP712Domain, MessageTypes, PhantomAgentMessage]
- pybotters.helpers.hyperliquid.construct_user_signed_action(action: Mapping[str, object], message_types: Mapping[str, Sequence[MessageType]] | None = None) tuple[EIP712Domain, Mapping[str, Sequence[MessageType]], Mapping[str, object]]¶
Construct EIP-712 typed data for Hyperliquid user signed action.
- パラメータ:
action -- Hyperqilid
actionobjectmessage_types -- (optional) message types. If not provided, it will be generated by
generate_message_types().
- 戻り値:
tuple[EIP712Domain, MessageTypes, PhantomAgentMessage]
- pybotters.helpers.hyperliquid.sign_typed_data(private_key: str, domain_data: EIP712Domain, message_types: Mapping[str, Sequence[MessageType]], message_data: Mapping[str, object]) Signature¶
Sign EIP-712 typed data with private key.
- パラメータ:
private_key -- Your API wallet private key
domain_data -- EIP-712 domain data
message_types -- EIP-712 message types
message_data -- EIP-712 message data
- 戻り値:
Signature
- pybotters.helpers.hyperliquid.generate_message_types(message_data: Mapping[str, object]) Mapping[str, Sequence[MessageType]]¶
Generate message types from message data.
- パラメータ:
message_data -- Hyperqilid message data
- 戻り値:
MessageTypes
Infer Solidity Types from Python types. This is a basic conversion and not complete.
- pybotters.helpers.hyperliquid.get_timestamp_ms() int¶
Get current timestamp in milliseconds that can be used as time or nonce.
- 戻り値:
int
Functions
|
Construct EIP-712 typed data for Hyperliquid L1 action. |
|
Construct EIP-712 typed data for Hyperliquid user signed action. |
|
Generate message types from message data. |
Get current timestamp in milliseconds that can be used as time or nonce. |
|
|
Sign EIP-712 typed data with private key. |
Classes
TypedDict for EIP-712 domain data. |
|
TypedDict for EIP-712 message type. |
|
TypedDict for Phantom Agent message. |
|
TypedDict for signature. |