Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add Hyperliquid Integration #33

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

vaniiiii
Copy link

@vaniiiii vaniiiii commented Jan 22, 2025

Hyperliquid Integration

🚧 Phase 1 of Hyperliquid Integration

Implements trading functionality between Arbitrum and Hyperliquid including bridging, position management, and fund transfers.

This PR delivers a complete trading functionality with Hyperliquid, enabling the full trading cycle from bridging to position management.

What's Included

  • USDC bridging from Arbitrum to Hyperliquid
  • USDC withdrawal from Hyperliquid to Arbitrum
  • Perpetual position opening/closing
  • Fund transfers between spot and perpetual balances
  • Position management with leverage control
  • 100% test coverage

Action Items 🎯

  • Bridging from Arbitrum to Hyperliquid
  • Withdrawing from Hyperliquid to Arbitrum
  • SDK signing support implementation
  • Opening orders
  • Closing orders
  • Position management
  • Account metrics

Coming Soon ⏳

  • Account metrics

Test Results

✅ All tests passing
✅ 100% coverage across all files

Commands:

pnpm test # Run tests
npx vitest run --coverage # Check coverage

export const tools: AiTool[] = [
{
name: 'bridgeToHyperliquid',
description: 'Bridges native USDC tokens from Arbitrum to Hyperliquid.',
Copy link
Contributor

Choose a reason for hiding this comment

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

don't use word "native" corresponding to ERC-20 tokens. It's can be problem for AI

Copy link
Author

Choose a reason for hiding this comment

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

Fixed: 97b057b

});
console.log('Transaction result:', result);

const transferMessage = result.data[result.data.length - 1];
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider reading event info and displaying it to the user for better awareness

Copy link
Author

Choose a reason for hiding this comment

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

which data you suggest from event to show?

* @returns Promise resolving to function execution result
*/
export async function bridgeToHyperliquid({ chainName, account, amount }: Props, { sendTransactions, notify }: FunctionOptions): Promise<FunctionReturn> {
try {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it will be possible in future transfer USDT or other tokens? If yes, then consider add argument - tokenAddress

Copy link
Author

Choose a reason for hiding this comment

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

would it make more sense to add tokenSymbol instead of tokenAddress? how command call would look like with tokenAddress?

export default {
tools,
functions,
description: 'Integration with Hyperliquid Protocol',
Copy link
Contributor

@OoXooOx OoXooOx Jan 30, 2025

Choose a reason for hiding this comment

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

here main protocol description for AI. Add slightly more info.

Copy link
Author

Choose a reason for hiding this comment

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

Fixed 97b057b

@vaniiiii vaniiiii force-pushed the feature/hyperliquid branch from cbf03a9 to 59dce70 Compare January 31, 2025 22:35
@vaniiiii vaniiiii requested a review from OoXooOx January 31, 2025 23:45
@vaniiiii vaniiiii force-pushed the feature/hyperliquid branch from c58df2d to 3b5d7a2 Compare February 7, 2025 23:42
@vaniiiii vaniiiii force-pushed the feature/hyperliquid branch from ab41357 to c2fd053 Compare March 6, 2025 01:20
@vaniiiii vaniiiii changed the title feat: Add Hyperliquid Integration [PHASE 1] feat: Add Hyperliquid Integration Mar 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants