async-hyperliquid 0.3.9__tar.gz → 0.3.10__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {async_hyperliquid-0.3.9 → async_hyperliquid-0.3.10}/PKG-INFO +1 -1
- {async_hyperliquid-0.3.9 → async_hyperliquid-0.3.10}/pyproject.toml +1 -1
- {async_hyperliquid-0.3.9 → async_hyperliquid-0.3.10}/src/async_hyperliquid/async_hyperliquid.py +21 -0
- {async_hyperliquid-0.3.9 → async_hyperliquid-0.3.10}/src/async_hyperliquid/exchange.py +1 -1
- {async_hyperliquid-0.3.9 → async_hyperliquid-0.3.10}/src/async_hyperliquid/utils/constants.py +7 -0
- {async_hyperliquid-0.3.9 → async_hyperliquid-0.3.10}/src/async_hyperliquid/utils/signing.py +16 -3
- {async_hyperliquid-0.3.9 → async_hyperliquid-0.3.10}/src/async_hyperliquid/utils/types.py +4 -0
- {async_hyperliquid-0.3.9 → async_hyperliquid-0.3.10}/LICENSE +0 -0
- {async_hyperliquid-0.3.9 → async_hyperliquid-0.3.10}/README.md +0 -0
- {async_hyperliquid-0.3.9 → async_hyperliquid-0.3.10}/src/async_hyperliquid/__init__.py +0 -0
- {async_hyperliquid-0.3.9 → async_hyperliquid-0.3.10}/src/async_hyperliquid/async_api.py +0 -0
- {async_hyperliquid-0.3.9 → async_hyperliquid-0.3.10}/src/async_hyperliquid/info.py +0 -0
- {async_hyperliquid-0.3.9 → async_hyperliquid-0.3.10}/src/async_hyperliquid/utils/__init__.py +0 -0
- {async_hyperliquid-0.3.9 → async_hyperliquid-0.3.10}/src/async_hyperliquid/utils/decorators.py +0 -0
- {async_hyperliquid-0.3.9 → async_hyperliquid-0.3.10}/src/async_hyperliquid/utils/miscs.py +0 -0
{async_hyperliquid-0.3.9 → async_hyperliquid-0.3.10}/src/async_hyperliquid/async_hyperliquid.py
RENAMED
|
@@ -28,6 +28,7 @@ from async_hyperliquid.utils.types import (
|
|
|
28
28
|
OrderType,
|
|
29
29
|
Portfolio,
|
|
30
30
|
LimitOrder,
|
|
31
|
+
Abstraction,
|
|
31
32
|
UserDeposit,
|
|
32
33
|
AccountState,
|
|
33
34
|
GroupOptions,
|
|
@@ -58,6 +59,7 @@ from async_hyperliquid.utils.signing import (
|
|
|
58
59
|
sign_usd_class_transfer_action,
|
|
59
60
|
sign_approve_builder_fee_action,
|
|
60
61
|
sign_user_dex_abstraction_action,
|
|
62
|
+
sign_user_set_abstraction_action,
|
|
61
63
|
sign_convert_to_multi_sig_user_action,
|
|
62
64
|
)
|
|
63
65
|
from async_hyperliquid.utils.constants import (
|
|
@@ -1032,5 +1034,24 @@ class AsyncHyperliquid(AsyncAPI):
|
|
|
1032
1034
|
action, vault=self.vault, expires=self.expires
|
|
1033
1035
|
)
|
|
1034
1036
|
|
|
1037
|
+
async def user_set_abstraction(
|
|
1038
|
+
self, abstraction: Abstraction, address: str | None = None
|
|
1039
|
+
):
|
|
1040
|
+
if address is None:
|
|
1041
|
+
address = self.address
|
|
1042
|
+
|
|
1043
|
+
nonce = get_timestamp_ms()
|
|
1044
|
+
action = {
|
|
1045
|
+
"type": "userSetAbstraction",
|
|
1046
|
+
"user": address.lower(),
|
|
1047
|
+
"abstraction": abstraction,
|
|
1048
|
+
"nonce": nonce,
|
|
1049
|
+
}
|
|
1050
|
+
sig = sign_user_set_abstraction_action(
|
|
1051
|
+
self.account, action, self.is_mainnet
|
|
1052
|
+
)
|
|
1053
|
+
|
|
1054
|
+
return await self.exchange.post_action_with_sig(action, sig, nonce)
|
|
1055
|
+
|
|
1035
1056
|
|
|
1036
1057
|
AsyncHyper = AsyncHyperliquid
|
|
@@ -25,7 +25,7 @@ class ExchangeAPI(AsyncAPI):
|
|
|
25
25
|
address: str | None = None,
|
|
26
26
|
):
|
|
27
27
|
self.account = account
|
|
28
|
-
self.address = address or account.address
|
|
28
|
+
self.address = address or account.address
|
|
29
29
|
self.is_mainnet = base_url == MAINNET_API_URL
|
|
30
30
|
super().__init__(Endpoint.EXCHANGE, base_url, session)
|
|
31
31
|
|
{async_hyperliquid-0.3.9 → async_hyperliquid-0.3.10}/src/async_hyperliquid/utils/constants.py
RENAMED
|
@@ -99,3 +99,10 @@ USER_DEX_ABSTRACTION_SIGN_TYPES = [
|
|
|
99
99
|
{"name": "enabled", "type": "bool"},
|
|
100
100
|
{"name": "nonce", "type": "uint64"},
|
|
101
101
|
]
|
|
102
|
+
|
|
103
|
+
USER_SET_ABSTRACTION_SIGN_TYPES = [
|
|
104
|
+
{"name": "hyperliquidChain", "type": "string"},
|
|
105
|
+
{"name": "user", "type": "address"},
|
|
106
|
+
{"name": "abstraction", "type": "string"},
|
|
107
|
+
{"name": "nonce", "type": "uint64"},
|
|
108
|
+
]
|
|
@@ -28,8 +28,9 @@ from async_hyperliquid.utils.constants import (
|
|
|
28
28
|
STAKING_TRANSFER_SIGN_TYPES,
|
|
29
29
|
MULTI_SIG_ENVELOPE_SIGN_TYPES,
|
|
30
30
|
USD_CLASS_TRANSFER_SIGN_TYPES,
|
|
31
|
-
CONVERT_TO_MULTI_SIG_USER_SIGN_TYPES,
|
|
32
31
|
USER_DEX_ABSTRACTION_SIGN_TYPES,
|
|
32
|
+
USER_SET_ABSTRACTION_SIGN_TYPES,
|
|
33
|
+
CONVERT_TO_MULTI_SIG_USER_SIGN_TYPES,
|
|
33
34
|
)
|
|
34
35
|
|
|
35
36
|
|
|
@@ -40,7 +41,7 @@ def address_to_bytes(address: str) -> bytes:
|
|
|
40
41
|
def hash_action(
|
|
41
42
|
action: dict, vault: str | None, nonce: int, expires: int | None = None
|
|
42
43
|
) -> bytes:
|
|
43
|
-
data: bytes = msgpack.packb(action)
|
|
44
|
+
data: bytes = msgpack.packb(action)
|
|
44
45
|
data += nonce.to_bytes(8, "big")
|
|
45
46
|
|
|
46
47
|
if vault is None:
|
|
@@ -114,7 +115,7 @@ def round_float(x: float) -> str:
|
|
|
114
115
|
|
|
115
116
|
def ensure_order_type(order_type: OrderType) -> OrderType:
|
|
116
117
|
if "limit" in order_type:
|
|
117
|
-
return {"limit": order_type["limit"]}
|
|
118
|
+
return {"limit": order_type["limit"]} # type: ignore
|
|
118
119
|
elif "trigger" in order_type:
|
|
119
120
|
return {
|
|
120
121
|
"trigger": {
|
|
@@ -357,3 +358,15 @@ def sign_user_dex_abstraction_action(
|
|
|
357
358
|
"HyperliquidTransaction:UserDexAbstraction",
|
|
358
359
|
is_mainnet,
|
|
359
360
|
)
|
|
361
|
+
|
|
362
|
+
|
|
363
|
+
def sign_user_set_abstraction_action(
|
|
364
|
+
wallet: LocalAccount, action: dict, is_mainnet: bool
|
|
365
|
+
):
|
|
366
|
+
return sign_user_signed_action(
|
|
367
|
+
wallet,
|
|
368
|
+
action,
|
|
369
|
+
USER_SET_ABSTRACTION_SIGN_TYPES,
|
|
370
|
+
"HyperliquidTransaction:UserSetAbstraction",
|
|
371
|
+
is_mainnet,
|
|
372
|
+
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{async_hyperliquid-0.3.9 → async_hyperliquid-0.3.10}/src/async_hyperliquid/utils/__init__.py
RENAMED
|
File without changes
|
{async_hyperliquid-0.3.9 → async_hyperliquid-0.3.10}/src/async_hyperliquid/utils/decorators.py
RENAMED
|
File without changes
|
|
File without changes
|