hypercore

package
v0.18.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 26, 2025 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Overview

This file implements python Hyperliquid's signing utils in golang. ref: https://github.com/hyperliquid-dex/hyperliquid-python-sdk/tree/a8edca1

Index

Constants

View Source
const (
	MainnetAPI = "https://api.hyperliquid.xyz"
	TestnetAPI = "https://api.hyperliquid-testnet.xyz"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionEVMUserModify

type ActionEVMUserModify struct {
	Type           string `json:"type"` // "evmUserModify"
	UsingBigBlocks bool   `json:"usingBigBlocks"`
}

type ActionPayload

type ActionPayload struct {
	Action    any    `json:"action"`    // The action to be performed
	Nonce     uint64 `json:"nonce"`     // Nonce for the action
	Signature SigRSV `json:"signature"` // Signature of the action
}

ActionPayload is the payload structure for actions sent to the Hypercore API.

type Client

type Client interface {
	// UseBigBlocks enables the use of big ETH-RPC blocks for account associated with the signer.
	UseBigBlocks(ctx context.Context) error
}

Client defines the interface for the hypercore client.

func NewClient

func NewClient(signer Signer) Client

NewClient creates a new hypercore mainnet client.

func NewTestnetClient

func NewTestnetClient(signer Signer) Client

NewTestnetClient creates a new hypercore testnet client.

type PhantomAgent

type PhantomAgent struct {
	Source       string   `json:"source"`       // "a" for mainnet, "b" for testnet
	ConnectionID [32]byte `json:"connectionId"` // Hash of action data
}

PhantomAgent is a HL core concept that wraps an "action" for use in EIP-712 messages.

type SigRSV

type SigRSV struct {
	R string `json:"r"`
	S string `json:"s"`
	V uint8  `json:"v"`
}

SigRSV is a signature in the R, S, V format.

type Signer

type Signer interface {
	Sign(ctx context.Context, digest []byte) ([65]byte, error)
}

func NewFireblocksSigner

func NewFireblocksSigner(client fireblocks.Client, addr common.Address) Signer

NewFireblocksSigner returns a new Signer that uses Fireblocks to sign messages.

func NewPrivateKeySigner

func NewPrivateKeySigner(privateKey *ecdsa.PrivateKey) Signer

NewPrivateKeySigner returns a new Signer that uses the provided ECDSA private key.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL