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
2 changes: 1 addition & 1 deletion apps/hip-3-pusher/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "hip-3-pusher"
version = "0.3.0"
version = "0.3.1"
Comment thread
devin-ai-integration[bot] marked this conversation as resolved.
description = "Hyperliquid HIP-3 market oracle pusher"
readme = "README.md"
requires-python = "==3.13.*"
Expand Down
43 changes: 43 additions & 0 deletions apps/hip-3-pusher/src/scripts/claim_testnet_drip.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import argparse
from pathlib import Path

import httpx
from eth_account import Account
from hyperliquid.utils import constants


def main() -> None:
parser = argparse.ArgumentParser(
description="Claim testnet USDC drip (1000 USDC, once per address)"
)
source = parser.add_mutually_exclusive_group(required=True)
source.add_argument(
"--private-key-file",
help="Path to private key file (address will be derived)",
)
source.add_argument(
"--address",
help="Wallet address to claim drip for",
)

args = parser.parse_args()

if args.private_key_file:
account = Account.from_key(Path(args.private_key_file).read_text().strip())
address = account.address
else:
address = args.address

print(f"Claiming testnet drip for: {address}")
print(f"Using testnet URL: {constants.TESTNET_API_URL}")

response = httpx.post(
f"{constants.TESTNET_API_URL}/info",
json={"type": "claimDrip", "user": address},
)
response.raise_for_status()
print(f"Response: {response.text}")


if __name__ == "__main__":
main()
8 changes: 7 additions & 1 deletion apps/hip-3-pusher/src/scripts/get_balances.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from hyperliquid.info import Info
from hyperliquid.utils import constants
from hyperliquid.utils.types import Meta, SpotMeta


def main() -> None:
Expand Down Expand Up @@ -30,7 +31,12 @@ def main() -> None:
print(f"Using {network_name} URL: {base_url}")
print("address:", args.address)

info = Info(base_url=base_url, skip_ws=True)
info = Info(
base_url=base_url,
skip_ws=True,
meta=Meta(universe=[]),
spot_meta=SpotMeta(universe=[], tokens=[]),
)
print("calling clearinghouseState...")
print(info.user_state(args.address))
print("calling spotClearinghouseState...")
Expand Down
8 changes: 7 additions & 1 deletion apps/hip-3-pusher/src/scripts/get_user_limit.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from hyperliquid.info import Info
from hyperliquid.utils import constants
from hyperliquid.utils.types import Meta, SpotMeta


def main() -> None:
Expand Down Expand Up @@ -30,7 +31,12 @@ def main() -> None:
print(f"Using {network_name} URL: {base_url}")
print("address:", args.address)

info = Info(base_url=base_url, skip_ws=True)
info = Info(
base_url=base_url,
skip_ws=True,
meta=Meta(universe=[]),
spot_meta=SpotMeta(universe=[], tokens=[]),
)
print("calling userRateLimit...")
print(info.user_rate_limit(args.address))

Expand Down
8 changes: 7 additions & 1 deletion apps/hip-3-pusher/src/scripts/reserve.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from hyperliquid.utils import constants
from hyperliquid.utils.constants import MAINNET_API_URL
from hyperliquid.utils.signing import get_timestamp_ms, sign_l1_action
from hyperliquid.utils.types import Meta, SpotMeta


def reserve_request_weight(exchange: Exchange, weight: int) -> dict[str, Any]:
Expand Down Expand Up @@ -69,7 +70,12 @@ def main() -> None:
print(f"Using {network_name} URL: {base_url}")

account = Account.from_key(Path(args.private_key_file).read_text().strip())
exchange = Exchange(wallet=account, base_url=base_url)
exchange = Exchange(
wallet=account,
base_url=base_url,
meta=Meta(universe=[]),
spot_meta=SpotMeta(universe=[], tokens=[]),
)
print("address:", account.address)
print("weight:", args.weight)

Expand Down
8 changes: 7 additions & 1 deletion apps/hip-3-pusher/src/scripts/send.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from eth_account import Account
from hyperliquid.exchange import Exchange
from hyperliquid.utils import constants
from hyperliquid.utils.types import Meta, SpotMeta


def main() -> None:
Expand Down Expand Up @@ -50,7 +51,12 @@ def main() -> None:
print(f"Using {network_name} URL: {base_url}")

sender_account = Account.from_key(Path(args.private_key_file).read_text().strip())
sender_exchange = Exchange(wallet=sender_account, base_url=base_url)
sender_exchange = Exchange(
wallet=sender_account,
base_url=base_url,
meta=Meta(universe=[]),
spot_meta=SpotMeta(universe=[], tokens=[]),
)
print("sender address:", sender_account.address)
print("recipient address:", args.recipient_address)
print("amount:", args.amount)
Expand Down
8 changes: 7 additions & 1 deletion apps/hip-3-pusher/src/scripts/setoracle_subdeployer.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from hyperliquid.exchange import Exchange
from hyperliquid.utils import constants
from hyperliquid.utils.signing import get_timestamp_ms, sign_l1_action
from hyperliquid.utils.types import Meta, SpotMeta


def main() -> None:
Expand Down Expand Up @@ -59,7 +60,12 @@ def main() -> None:
print(f"Using {network_name} URL: {base_url}")

deployer_account = Account.from_key(Path(args.private_key_file).read_text().strip())
deployer_exchange = Exchange(wallet=deployer_account, base_url=base_url)
deployer_exchange = Exchange(
wallet=deployer_account,
base_url=base_url,
meta=Meta(universe=[]),
spot_meta=SpotMeta(universe=[], tokens=[]),
)
print("deployer address:", deployer_account.address)
print("dex:", args.dex)
print("subdeployer address:", args.subdeployer_address)
Expand Down
8 changes: 7 additions & 1 deletion apps/hip-3-pusher/src/scripts/usd_class_transfer.py
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚩 Pre-existing bug: type=bool in argparse makes --to-perp False always True

The --to-perp argument at apps/hip-3-pusher/src/scripts/usd_class_transfer.py:25-29 uses type=bool, which is a well-known Python argparse footgun. argparse calls bool(string_value), and since bool("False") evaluates to True (any non-empty string is truthy), it's impossible to pass False through the CLI. Combined with required=True, every invocation will set to_perp=True. The fix would be to use action="store_true" / action="store_false" or a custom type function. This is pre-existing (not introduced by this PR) but worth noting since the file was touched.

(Refers to lines 25-29)

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from eth_account import Account
from hyperliquid.exchange import Exchange
from hyperliquid.utils import constants
from hyperliquid.utils.types import Meta, SpotMeta


def main() -> None:
Expand Down Expand Up @@ -51,7 +52,12 @@ def main() -> None:
print(f"Using {network_name} URL: {base_url}")

account = Account.from_key(Path(args.private_key_file).read_text().strip())
exchange = Exchange(wallet=account, base_url=base_url)
exchange = Exchange(
wallet=account,
base_url=base_url,
meta=Meta(universe=[]),
spot_meta=SpotMeta(universe=[], tokens=[]),
)
print("address:", account.address)
print("amount:", args.amount)
print("to_perp:", args.to_perp)
Expand Down
8 changes: 7 additions & 1 deletion apps/hip-3-pusher/src/scripts/user_set_abstraction.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from eth_account import Account
from hyperliquid.exchange import Exchange
from hyperliquid.utils import constants
from hyperliquid.utils.types import Meta, SpotMeta


def main() -> None:
Expand Down Expand Up @@ -42,7 +43,12 @@ def main() -> None:
print(f"Using {network_name} URL: {base_url}")

account = Account.from_key(Path(args.private_key_file).read_text().strip())
exchange = Exchange(wallet=account, base_url=base_url)
exchange = Exchange(
wallet=account,
base_url=base_url,
meta=Meta(universe=[]),
spot_meta=SpotMeta(universe=[], tokens=[]),
)
print("address:", account.address)
print("abstraction", args.abstraction)

Expand Down
Loading
Loading