mirror of
https://github.com/NoFxAiOS/nofx.git
synced 2026-06-06 05:51:19 +08:00
The Hyperliquid wallet-connect flow signs configuration values that
must match what the server expects and what the order placement layer
sends on-chain. The same constants live in four call sites:
- trader/hyperliquid/trader.go (used at order placement)
- api/handler_hyperliquid_wallet.go (returned by the connect endpoint
and validated on submit)
- web/src/components/common/HyperliquidWalletConnect.tsx
(signed by the user during connect)
- trader/hyperliquid/builder_fee_test.go
(pins the trader-side value)
Refresh all four together so the surfaces stay in lockstep.
19 lines
673 B
Go
19 lines
673 B
Go
package hyperliquid
|
|
|
|
import "testing"
|
|
|
|
func TestDefaultBuilderIsHardcodedToApprovedFeeTier(t *testing.T) {
|
|
if defaultBuilder == nil {
|
|
t.Fatal("defaultBuilder is nil")
|
|
}
|
|
if got := defaultBuilder.Builder; got != "0x891dc6f05ad47a3c1a05da55e7a7517971faaf0d" {
|
|
t.Fatalf("defaultBuilder.Builder = %s, want hardcoded NOFX builder", got)
|
|
}
|
|
// Fee is in tenths of a basis point: 50 = 5 bps = 0.05% (万5).
|
|
// Must match defaultHyperliquidBuilderMaxFee on the API side and the
|
|
// frontend HYPERLIQUID_BUILDER_MAX_FEE constant the user signs against.
|
|
if got := defaultBuilder.Fee; got != 50 {
|
|
t.Fatalf("defaultBuilder.Fee = %d, want hardcoded 50 for 0.05%%", got)
|
|
}
|
|
}
|