Skip to content
Merged
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
10 changes: 10 additions & 0 deletions examples/spot_deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
# Set to True to set the deployer trading fee share
# See step 6 below for more details on setting the deployer trading fee share.
SET_DEPLOYER_TRADING_FEE_SHARE = False
# See step 7 below for more details on enabling quote token.
ENABLE_QUOTE_TOKEN = False
DUMMY_USER = "0x0000000000000000000000000000000000000001"


Expand Down Expand Up @@ -112,6 +114,14 @@ def main():
set_deployer_trading_fee_share_result = exchange.spot_deploy_set_deployer_trading_fee_share(token, "100%")
print(set_deployer_trading_fee_share_result)

if ENABLE_QUOTE_TOKEN:
# Step 7
#
# Note that deployer trading fee share must be zero.
# The quote token must also be allowed.
enable_quote_token_result = exchange.spot_deploy_enable_quote_token(token)
print(enable_quote_token_result)


if __name__ == "__main__":
main()
31 changes: 9 additions & 22 deletions hyperliquid/exchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def _post_action(self, action, signature, nonce):
"action": action,
"nonce": nonce,
"signature": signature,
"vaultAddress": self.vault_address if action["type"] != "usdClassTransfer" else None,
"vaultAddress": self.vault_address if action["type"] not in ["usdClassTransfer", "sendAsset"] else None,
"expiresAfter": self.expires_after,
}
logging.debug(payload)
Expand Down Expand Up @@ -701,26 +701,7 @@ def spot_deploy_user_genesis(
)

def spot_deploy_enable_freeze_privilege(self, token: int) -> Any:
timestamp = get_timestamp_ms()
action = {
"type": "spotDeploy",
"enableFreezePrivilege": {
"token": token,
},
}
signature = sign_l1_action(
self.wallet,
action,
None,
timestamp,
self.expires_after,
self.base_url == MAINNET_API_URL,
)
return self._post_action(
action,
signature,
timestamp,
)
return self.spot_deploy_token_action_inner("enableFreezePrivilege", token)

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

def spot_deploy_revoke_freeze_privilege(self, token: int) -> Any:
return self.spot_deploy_token_action_inner("revokeFreezePrivilege", token)

def spot_deploy_enable_quote_token(self, token: int) -> Any:
return self.spot_deploy_token_action_inner("enableQuoteToken", token)

def spot_deploy_token_action_inner(self, variant: str, token: int) -> Any:
timestamp = get_timestamp_ms()
action = {
"type": "spotDeploy",
"revokeFreezePrivilege": {
variant: {
"token": token,
},
}
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "hyperliquid-python-sdk"
version = "0.16.0"
version = "0.17.0"
description = "SDK for Hyperliquid API trading with Python."
readme = "README.md"
authors = ["Hyperliquid <[email protected]>"]
Expand Down