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 skills/hyperliquid-plugin/.claude-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "hyperliquid-plugin",
"description": "Hyperliquid on-chain perpetuals DEX — check positions, get market prices, place and cancel perpetual orders on Hyperliquid L1 (chain_id 999).",
"version": "0.4.3",
"version": "0.4.4",
"author": {
"name": "GeoGu360",
"github": "GeoGu360"
Expand Down
2 changes: 1 addition & 1 deletion skills/hyperliquid-plugin/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion skills/hyperliquid-plugin/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "hyperliquid-plugin"
version = "0.4.3"
version = "0.4.4"
edition = "2021"

[[bin]]
Expand Down
2 changes: 1 addition & 1 deletion skills/hyperliquid-plugin/SKILL.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
name: hyperliquid-plugin
description: Hyperliquid DEX — trade perps & spot, deposit from Arbitrum, withdraw to Arbitrum, transfer between perp and spot accounts, manage gas on HyperEVM.
version: "0.4.3"
version: "0.4.4"
author: GeoGu360
tags:
- perps
Expand Down
2 changes: 1 addition & 1 deletion skills/hyperliquid-plugin/plugin.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
schema_version: 1
name: hyperliquid-plugin
version: "0.4.3"
version: "0.4.4"
description: "Trade perpetuals on Hyperliquid - check positions, get prices, place market/limit orders with TP/SL brackets, close positions, deposit USDC"
author:
name: GeoGu360
Expand Down
18 changes: 14 additions & 4 deletions skills/hyperliquid-plugin/src/commands/get_gas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,20 @@ pub async fn run(args: GetGasArgs) -> anyhow::Result<()> {
let approve_calldata = data["data"].as_str().unwrap_or("");
let approve_value = parse_wei(data["value"].as_str().unwrap_or("0x0"));

// Skip if allowance is already sufficient
let existing = erc20_allowance(USDC_ARBITRUM, &wallet, approve_to, ARBITRUM_RPC)
.await
.unwrap_or(0);
// Skip if allowance is already sufficient.
// EVM-012: surface RPC errors instead of silent unwrap_or(0) — that turned
// a transient publicnode hiccup into an unnecessary re-approve.
let existing = match erc20_allowance(USDC_ARBITRUM, &wallet, approve_to, ARBITRUM_RPC).await {
Ok(v) => v,
Err(e) => {
println!("{}", super::error_response(
&format!("Failed to read USDC allowance for relay solver {}: {:#}", approve_to, e),
"RPC_ERROR",
"Public Arbitrum RPC may be limited; retry shortly.",
));
return Ok(());
}
};

if existing < usdc_units as u128 {
eprintln!("Approving USDC to relay solver...");
Expand Down
9 changes: 9 additions & 0 deletions skills/hyperliquid-plugin/src/onchainos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ use std::process::Command;
use serde_json::Value;
use sha3::{Digest, Keccak256};

/// `--biz-type` / `--strategy`: attribution to the onchainos backend.
/// Source-of-truth for the plugin name is Cargo.toml's `[package]` `name`.
const BIZ_TYPE: &str = "dapp";
const STRATEGY: &str = env!("CARGO_PKG_NAME");

/// Execute an EVM contract call via onchainos wallet contract-call.
/// chain_id: the EVM chain (e.g. 42161 for Arbitrum).
/// to: contract address.
Expand Down Expand Up @@ -29,6 +34,10 @@ pub fn wallet_contract_call(
let mut args = vec![
"wallet".to_string(),
"contract-call".to_string(),
"--biz-type".to_string(),
BIZ_TYPE.to_string(),
"--strategy".to_string(),
STRATEGY.to_string(),
"--chain".to_string(),
chain_id.to_string(),
"--to".to_string(),
Expand Down
Loading