Files
zeekayandHanzo Dev 938b06d485 Stop requiring the node this module is imported by
proto required luxfi/node and luxfi/node required proto, with no replace
directive on either side. The cycle was not load-bearing: most of it was proto
reaching into the node for packages proto already owns — p/warp, p/txs,
p/signer, p/stakeable, p/security, x/txs — which now name themselves.

Two were real. The UTXO components moved here, where the chains that use them
already live, and the node is the only other caller, so that dependency now
runs one way. And p/config held the node's chain manager to queue a chain the
P-Chain had accepted a CreateChainTx for; it calls one method, so it declares
one method. A P-Chain that imports the node to describe QueueChainCreation is
what made two modules require each other.

Dropping the requirement dropped a registration with it: lux.ParseUTXO is a
registry filled by an init, which the node used to link in on proto's behalf.
The packages that call it now say so themselves.

Co-authored-by: Hanzo Dev <[email protected]>
2026-09-06 12:49:55 -07:00

85 lines
3.4 KiB
Go

// Copyright (C) 2019-2025, Lux Industries, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package api
import (
"github.com/luxfi/ids"
"github.com/luxfi/util/json"
"github.com/luxfi/proto/p/signer"
"github.com/luxfi/vm/types"
)
// Staker is the representation of a staker sent via RPC.
type Staker struct {
TxID ids.ID `json:"txID"`
StartTime json.Uint64 `json:"startTime"`
EndTime json.Uint64 `json:"endTime"`
Weight json.Uint64 `json:"weight,omitempty"`
StakeAmount *json.Uint64 `json:"stakeAmount,omitempty"`
NodeID ids.NodeID `json:"nodeID"`
}
// Owner is the representation of an owner sent via RPC.
type Owner struct {
Locktime json.Uint64 `json:"locktime"`
Threshold json.Uint32 `json:"threshold"`
Addresses []string `json:"addresses"`
}
// Delegator is the representation of a delegator sent via RPC.
type Delegator struct {
Staker
RewardOwner *Owner `json:"rewardOwner,omitempty"`
PotentialReward *json.Uint64 `json:"potentialReward,omitempty"`
}
// PrimaryDelegator is the representation of a primary delegator sent via RPC.
type PrimaryDelegator struct {
Staker
RewardOwner *Owner `json:"rewardOwner,omitempty"`
PotentialReward *json.Uint64 `json:"potentialReward,omitempty"`
}
// PermissionlessValidator is the representation of a permissionless validator sent via RPC.
type PermissionlessValidator struct {
Staker
// L1 Validator fields
ValidationID *ids.ID `json:"validationID,omitempty"`
RemainingBalanceOwner *Owner `json:"remainingBalanceOwner,omitempty"`
DeactivationOwner *Owner `json:"deactivationOwner,omitempty"`
MinNonce *json.Uint64 `json:"minNonce,omitempty"`
Balance *json.Uint64 `json:"balance,omitempty"`
// Standard validator fields
ValidationRewardOwner *Owner `json:"validationRewardOwner,omitempty"`
DelegationRewardOwner *Owner `json:"delegationRewardOwner,omitempty"`
PotentialReward *json.Uint64 `json:"potentialReward,omitempty"`
AccruedDelegateeReward *json.Uint64 `json:"accruedDelegateeReward,omitempty"`
DelegationFee json.Float32 `json:"delegationFee"`
Uptime *json.Float32 `json:"uptime,omitempty"`
Connected *bool `json:"connected,omitempty"`
Signer *signer.ProofOfPossession `json:"signer,omitempty"`
DelegatorCount *json.Uint64 `json:"delegatorCount,omitempty"`
DelegatorWeight *json.Uint64 `json:"delegatorWeight,omitempty"`
Delegators *[]PrimaryDelegator `json:"delegators,omitempty"`
}
// BaseL1Validator contains the shared fields for L1 validators.
type BaseL1Validator struct {
ValidationID *ids.ID `json:"validationID,omitempty"`
PublicKey *types.JSONByteSlice `json:"publicKey,omitempty"`
RemainingBalanceOwner *Owner `json:"remainingBalanceOwner,omitempty"`
DeactivationOwner *Owner `json:"deactivationOwner,omitempty"`
MinNonce *json.Uint64 `json:"minNonce,omitempty"`
}
// APIL1Validator is the representation of an L1 validator sent via RPC.
type APIL1Validator struct {
NodeID ids.NodeID `json:"nodeID"`
StartTime json.Uint64 `json:"startTime"`
Weight json.Uint64 `json:"weight"`
Balance *json.Uint64 `json:"balance,omitempty"`
BaseL1Validator
}