Skip to content

Commit d01888e

Browse files
authored
Version 0.17.0 (#188)
1 parent 782b688 commit d01888e

File tree

3 files changed

+20
-23
lines changed

3 files changed

+20
-23
lines changed

examples/spot_deploy.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
# Set to True to set the deployer trading fee share
1515
# See step 6 below for more details on setting the deployer trading fee share.
1616
SET_DEPLOYER_TRADING_FEE_SHARE = False
17+
# See step 7 below for more details on enabling quote token.
18+
ENABLE_QUOTE_TOKEN = False
1719
DUMMY_USER = "0x0000000000000000000000000000000000000001"
1820

1921

@@ -112,6 +114,14 @@ def main():
112114
set_deployer_trading_fee_share_result = exchange.spot_deploy_set_deployer_trading_fee_share(token, "100%")
113115
print(set_deployer_trading_fee_share_result)
114116

117+
if ENABLE_QUOTE_TOKEN:
118+
# Step 7
119+
#
120+
# Note that deployer trading fee share must be zero.
121+
# The quote token must also be allowed.
122+
enable_quote_token_result = exchange.spot_deploy_enable_quote_token(token)
123+
print(enable_quote_token_result)
124+
115125

116126
if __name__ == "__main__":
117127
main()

hyperliquid/exchange.py

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def _post_action(self, action, signature, nonce):
7373
"action": action,
7474
"nonce": nonce,
7575
"signature": signature,
76-
"vaultAddress": self.vault_address if action["type"] != "usdClassTransfer" else None,
76+
"vaultAddress": self.vault_address if action["type"] not in ["usdClassTransfer", "sendAsset"] else None,
7777
"expiresAfter": self.expires_after,
7878
}
7979
logging.debug(payload)
@@ -701,26 +701,7 @@ def spot_deploy_user_genesis(
701701
)
702702

703703
def spot_deploy_enable_freeze_privilege(self, token: int) -> Any:
704-
timestamp = get_timestamp_ms()
705-
action = {
706-
"type": "spotDeploy",
707-
"enableFreezePrivilege": {
708-
"token": token,
709-
},
710-
}
711-
signature = sign_l1_action(
712-
self.wallet,
713-
action,
714-
None,
715-
timestamp,
716-
self.expires_after,
717-
self.base_url == MAINNET_API_URL,
718-
)
719-
return self._post_action(
720-
action,
721-
signature,
722-
timestamp,
723-
)
704+
return self.spot_deploy_token_action_inner("enableFreezePrivilege", token)
724705

725706
def spot_deploy_freeze_user(self, token: int, user: str, freeze: bool) -> Any:
726707
timestamp = get_timestamp_ms()
@@ -747,10 +728,16 @@ def spot_deploy_freeze_user(self, token: int, user: str, freeze: bool) -> Any:
747728
)
748729

749730
def spot_deploy_revoke_freeze_privilege(self, token: int) -> Any:
731+
return self.spot_deploy_token_action_inner("revokeFreezePrivilege", token)
732+
733+
def spot_deploy_enable_quote_token(self, token: int) -> Any:
734+
return self.spot_deploy_token_action_inner("enableQuoteToken", token)
735+
736+
def spot_deploy_token_action_inner(self, variant: str, token: int) -> Any:
750737
timestamp = get_timestamp_ms()
751738
action = {
752739
"type": "spotDeploy",
753-
"revokeFreezePrivilege": {
740+
variant: {
754741
"token": token,
755742
},
756743
}

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ build-backend = "poetry.core.masonry.api"
55

66
[tool.poetry]
77
name = "hyperliquid-python-sdk"
8-
version = "0.16.0"
8+
version = "0.17.0"
99
description = "SDK for Hyperliquid API trading with Python."
1010
readme = "README.md"
1111
authors = ["Hyperliquid <[email protected]>"]

0 commit comments

Comments
 (0)