debug

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: May 8, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package debug exposes the operator / observability endpoints of a Bee node: health and readiness, version + API-version checks, addresses / topology / peers, node info and status (full + per-peer + per-neighborhood), chain / reserve / redistribution state, balances and accounting, settlements, chequebook (balance + cheques + cashout), stake (deposit / withdraw / migrate), pending transactions, welcome message, and runtime loggers.

Get a *Service handle from github.com/ethswarm-tools/bee-go.Client.Debug.

Mirrors bee-js's Bee.getHealth / getNodeInfo / getStatus / getTopology / getPeers / getChainState / getReserveState / getStake / getAllBalances / getAllSettlements / getWalletBalance / chequebook + cashout / pending-transactions / loggers fan-out, plus a few Bee-only endpoints (/accounting, /status/peers, /status/neighborhoods, /connect/{multiaddr}) that bee-js does not expose today.

Index

Constants

View Source
const (
	SupportedBeeVersionExact = "2.7.2-rc1-83612d37"
	SupportedAPIVersion      = "8.0.0"
)

Pinned versions of the Bee node + API that this client targets. Used by IsSupportedExactVersion / IsSupportedAPIVersion. Mirrors bee-js's SUPPORTED_BEE_VERSION_EXACT / SUPPORTED_API_VERSION constants.

Variables

View Source
var LogLevels = []string{"none", "error", "warning", "info", "debug", "all"}

LogLevels lists the verbosity tokens accepted by Bee's PUT /loggers/{exp}/{verbosity} route (pkg/api/logger.go on the Bee server). Anything outside this set is rejected with a 400; [SetLogger] validates client-side before sending.

View Source
var SupportedBeeVersion = strings.SplitN(SupportedBeeVersionExact, "-", 2)[0]

SupportedBeeVersion is SupportedBeeVersionExact stripped of the git short-sha suffix.

Functions

This section is empty.

Types

type AddressesResponse

type AddressesResponse struct {
	Overlay      string   `json:"overlay"`
	Underlay     []string `json:"underlay"`
	Ethereum     string   `json:"ethereum"`
	PublicKey    string   `json:"publicKey"`
	PssPublicKey string   `json:"pssPublicKey"`
}

AddressesResponse represents the node's addresses.

type Balance

type Balance struct {
	Peer    string   `json:"peer"`
	Balance *big.Int `json:"balance"`
}

Balance represents the balance with a peer.

func (*Balance) UnmarshalJSON

func (b *Balance) UnmarshalJSON(data []byte) error

type BalancesResponse

type BalancesResponse struct {
	Balances []Balance `json:"balances"`
}

BalancesResponse represents the list of balances.

type BeeVersions

type BeeVersions struct {
	SupportedBeeVersion    string
	SupportedBeeAPIVersion string
	BeeVersion             string
	BeeAPIVersion          string
}

BeeVersions reports the version pair the connected node advertises against the version pair this client was built for.

type CashoutResult

type CashoutResult struct {
	Recipient  string   `json:"recipient"`
	LastPayout *big.Int `json:"-"`
	Bounced    bool     `json:"bounced"`
}

CashoutResult describes the on-chain outcome of a previous cashout.

func (*CashoutResult) UnmarshalJSON

func (c *CashoutResult) UnmarshalJSON(b []byte) error

UnmarshalJSON handles the bigint-as-string LastPayout field.

type ChainStateResponse

type ChainStateResponse struct {
	ChainTip     uint64
	Block        uint64
	TotalAmount  *big.Int
	CurrentPrice uint64
}

ChainStateResponse represents the chain state. TotalAmount and CurrentPrice arrive as bigint-encoded strings on the wire.

func (*ChainStateResponse) UnmarshalJSON

func (c *ChainStateResponse) UnmarshalJSON(b []byte) error

type Cheque

type Cheque struct {
	Beneficiary string   `json:"beneficiary"`
	Chequebook  string   `json:"chequebook"`
	Payout      *big.Int `json:"-"`
}

Cheque is one peer's last sent or received cheque.

func (*Cheque) UnmarshalJSON

func (c *Cheque) UnmarshalJSON(b []byte) error

UnmarshalJSON handles the bigint-as-string Payout field.

type ChequebookBalanceResponse

type ChequebookBalanceResponse struct {
	TotalBalance     *big.Int `json:"totalBalance"`
	AvailableBalance *big.Int `json:"availableBalance"`
}

ChequebookBalanceResponse represents the chequebook balance.

func (*ChequebookBalanceResponse) UnmarshalJSON

func (c *ChequebookBalanceResponse) UnmarshalJSON(b []byte) error

type ChequesResponse

type ChequesResponse struct {
	LastCheques []LastCheque `json:"lastcheques"`
}

type HealthResponse

type HealthResponse struct {
	Status     string `json:"status"`
	Version    string `json:"version"`
	APIVersion string `json:"apiVersion"`
}

HealthResponse is the structured response from GET /health.

type LastCashoutAction

type LastCashoutAction struct {
	Peer             string         `json:"peer"`
	UncashedAmount   *big.Int       `json:"-"`
	TransactionHash  *string        `json:"transactionHash"`
	LastCashedCheque *Cheque        `json:"lastCashedCheque"`
	Result           *CashoutResult `json:"result"`
}

LastCashoutAction is the response from GET /chequebook/cashout/{peer}. LastCashedCheque, TransactionHash and Result are nil when no cashout has happened yet for that peer.

func (*LastCashoutAction) UnmarshalJSON

func (l *LastCashoutAction) UnmarshalJSON(b []byte) error

UnmarshalJSON handles the bigint-as-string UncashedAmount field.

type LastCheque

type LastCheque struct {
	Peer         string `json:"peer"`
	LastReceived *struct {
		Beneficiary string   `json:"beneficiary"`
		Chequebook  string   `json:"chequebook"`
		Payout      *big.Int `json:"payout"`
	} `json:"lastreceived"`
}

func (*LastCheque) UnmarshalJSON

func (l *LastCheque) UnmarshalJSON(b []byte) error

type Logger

type Logger struct {
	Logger    string `json:"logger"`
	Verbosity string `json:"verbosity"`
	Subsystem string `json:"subsystem"`
	ID        string `json:"id"`
}

Logger is one entry in the LoggerResponse.Loggers list.

type LoggerResponse

type LoggerResponse struct {
	Tree    json.RawMessage `json:"tree"`
	Loggers []Logger        `json:"loggers"`
}

LoggerResponse is the response from /loggers and /loggers/{exp}: the flat logger list plus a tree representation. Tree is intentionally raw JSON — the structure is recursive and rarely needed in code.

type Neighborhood

type Neighborhood struct {
	Neighborhood            string `json:"neighborhood"`
	ReserveSizeWithinRadius int    `json:"reserveSizeWithinRadius"`
	Proximity               uint8  `json:"proximity"`
}

Neighborhood describes one neighborhood the node knows about: its binary prefix string, the reserve size within radius, and the proximity order.

type NodeInfo

type NodeInfo struct {
	BeeMode           string `json:"beeMode"`
	ChequebookEnabled bool   `json:"chequebookEnabled"`
	SwapEnabled       bool   `json:"swapEnabled"`
}

NodeInfo represents the Bee node configuration.

type Peer

type Peer struct {
	Address  string `json:"address"`
	FullNode bool   `json:"fullNode"`
}

Peer represents a connected peer.

type PeerAccounting

type PeerAccounting struct {
	Balance                  *big.Int
	ConsumedBalance          *big.Int
	ThresholdReceived        *big.Int
	ThresholdGiven           *big.Int
	CurrentThresholdReceived *big.Int
	CurrentThresholdGiven    *big.Int
	SurplusBalance           *big.Int
	ReservedBalance          *big.Int
	ShadowReservedBalance    *big.Int
	GhostBalance             *big.Int
}

PeerAccounting describes the full accounting state with one peer: settlement balances, the configured + dynamic credit/debit thresholds, and the various reserved/surplus/ghost positions Bee tracks. All monetary fields are PLUR (BZZ base units).

Bee node endpoint: GET /accounting. Not exposed by bee-js; useful for monitoring swap state at finer granularity than /balances.

func (*PeerAccounting) UnmarshalJSON

func (p *PeerAccounting) UnmarshalJSON(b []byte) error

UnmarshalJSON handles the bigint-as-string fields Bee emits.

type PeerCheques

type PeerCheques struct {
	Peer         string  `json:"peer"`
	LastReceived *Cheque `json:"lastreceived"`
	LastSent     *Cheque `json:"lastsent"`
}

PeerCheques is the response from GET /chequebook/cheque/{peer}: the last sent and received cheques for that peer (either may be nil).

type PeerStatus

type PeerStatus struct {
	StatusResponse
	RequestFailed bool `json:"requestFailed,omitempty"`
}

PeerStatus is one entry in the StatusPeers response. It mirrors StatusResponse but adds RequestFailed (set when Bee couldn't reach the peer in time and the rest of the snapshot is zero-valued).

type PeersResponse

type PeersResponse struct {
	Peers []Peer `json:"peers"`
}

PeersResponse represents the list of peers.

type RedistributionStateResponse

type RedistributionStateResponse struct {
	MinimumGasFunds    *big.Int `json:"minimumGasFunds"`
	HasSufficientFunds bool     `json:"hasSufficientFunds"`
	IsFrozen           bool     `json:"isFrozen"`
	IsFullySynced      bool     `json:"isFullySynced"`
	Phase              string   `json:"phase"`
	Round              uint64   `json:"round"`
	LastWonRound       uint64   `json:"lastWonRound"`
	LastPlayedRound    uint64   `json:"lastPlayedRound"`
	LastFrozenRound    uint64   `json:"lastFrozenRound"`
	LastSelectedRound  uint64   `json:"lastSelectedRound"`
	// Bee returns this as a fractional float (e.g. 37.96302), not an
	// integer.
	LastSampleDurationSeconds float64  `json:"lastSampleDurationSeconds"`
	Block                     uint64   `json:"block"`
	Reward                    *big.Int `json:"reward"`
	Fees                      *big.Int `json:"fees"`
	IsHealthy                 bool     `json:"isHealthy"`
}

RedistributionStateResponse represents the redistribution state.

func (*RedistributionStateResponse) UnmarshalJSON

func (r *RedistributionStateResponse) UnmarshalJSON(b []byte) error

type ReserveStateResponse

type ReserveStateResponse struct {
	Radius        uint8 `json:"radius"`
	StorageRadius uint8 `json:"storageRadius"`
	Commitment    int64 `json:"commitment"`
}

ReserveStateResponse represents the reserve state.

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service is the operator / observability endpoint group: health, versions, peers, accounting, chequebook, stake, transactions, loggers, and chain / reserve / redistribution state. Get one from the top-level Client.Debug field rather than constructing it directly.

func NewService

func NewService(baseURL *url.URL, httpClient *http.Client) *Service

NewService wires up a debug.Service against a Bee base URL and HTTP client. The top-level bee.NewClient calls this for you.

func (*Service) Addresses

func (s *Service) Addresses(ctx context.Context) (AddressesResponse, error)

Addresses retrieves the node's addresses.

func (*Service) CancelPendingTransaction

func (s *Service) CancelPendingTransaction(ctx context.Context, txHash string, gasPrice *big.Int) (string, error)

CancelPendingTransaction cancels a pending transaction by replacing it with a zero-value tx at the same nonce. gasPrice is optional (nil = let Bee pick) — when non-nil it's sent in the gas-price header so the replacement bumps the fee. Mirrors bee-js Bee.cancelPendingTransaction.

func (*Service) CashoutLastCheque

func (s *Service) CashoutLastCheque(ctx context.Context, peer string, gasPrice *big.Int) (string, error)

CashoutLastCheque cashes out the last received cheque for the peer. gasPrice is optional (nil = let Bee pick); when non-nil it's sent in the gas-price header. Returns the cashout transaction hash.

Mirrors bee-js Bee.cashoutLastCheque.

func (*Service) ChainState

func (s *Service) ChainState(ctx context.Context) (ChainStateResponse, error)

ChainState retrieves the current chain state.

func (*Service) CheckConnection

func (s *Service) CheckConnection(ctx context.Context) error

CheckConnection pings the base URL and returns the response error if the node is unreachable. Mirrors bee-js Bee.checkConnection.

func (*Service) ChequebookAddress added in v1.2.0

func (s *Service) ChequebookAddress(ctx context.Context) (string, error)

ChequebookAddress returns the on-chain chequebook contract address served at GET /chequebook/address. Bee returns either a "chequebookAddress" (camelCase) or "chequebook_address" (snake_case) JSON key depending on version; we accept both. Mirrors bee-rs DebugApi::chequebook_address and bee-py client.debug.chequebook_address.

func (*Service) ConnectPeer

func (s *Service) ConnectPeer(ctx context.Context, multiaddr string) (string, error)

ConnectPeer manually dials a peer at the given multiaddress (e.g. "/dns/bee.example.com/tcp/1634/p2p/16Uiu2HAm…"). Returns the resulting overlay address. The leading "/" is added by Bee, so callers may pass the multiaddress with or without it.

Bee node endpoint: POST /connect/{multi-address}. Not exposed by bee-js.

func (*Service) DepositBZZToChequebook

func (s *Service) DepositBZZToChequebook(ctx context.Context, amount *big.Int) (string, error)

DepositBZZToChequebook is the bee-js name for DepositTokens.

func (*Service) DepositStake

func (s *Service) DepositStake(ctx context.Context, amount *big.Int) (string, error)

DepositStake is the bee-js name for Stake.

func (*Service) DepositTokens

func (s *Service) DepositTokens(ctx context.Context, amount *big.Int) (string, error)

DepositTokens deposits tokens into the chequebook.

func (*Service) GetAccounting

func (s *Service) GetAccounting(ctx context.Context) (map[string]PeerAccounting, error)

GetAccounting returns per-peer accounting info keyed by peer overlay address. Strictly richer than GetBalances. Bee-only endpoint (not in bee-js).

func (*Service) GetAllPendingTransactions

func (s *Service) GetAllPendingTransactions(ctx context.Context) ([]TransactionInfo, error)

GetAllPendingTransactions returns every pending transaction the Bee node knows about. Mirrors bee-js Bee.getAllPendingTransactions.

func (*Service) GetBalances

func (s *Service) GetBalances(ctx context.Context) ([]Balance, error)

GetBalances retrieves the balances with all known peers.

func (*Service) GetBlocklist

func (s *Service) GetBlocklist(ctx context.Context) ([]Peer, error)

GetBlocklist retrieves the list of blocklisted peers.

func (*Service) GetChequebookBalance

func (s *Service) GetChequebookBalance(ctx context.Context) (ChequebookBalanceResponse, error)

GetChequebookBalance retrieves the chequebook balance.

func (*Service) GetConsumed

func (s *Service) GetConsumed(ctx context.Context) ([]Balance, error)

GetConsumed retrieves the past due consumption balances with all known peers.

func (*Service) GetHealth

func (s *Service) GetHealth(ctx context.Context) (HealthResponse, error)

GetHealth returns the structured /health payload (version, apiVersion, status). Mirrors bee-js Bee.getHealth.

func (*Service) GetLastCashoutAction

func (s *Service) GetLastCashoutAction(ctx context.Context, peer string) (LastCashoutAction, error)

GetLastCashoutAction returns the last cashout state (transaction hash, cashed cheque, on-chain result) for a peer. Mirrors bee-js Bee.getLastCashoutAction.

func (*Service) GetLastChequesForPeer

func (s *Service) GetLastChequesForPeer(ctx context.Context, peer string) (PeerCheques, error)

GetLastChequesForPeer returns the last sent + received cheques for a specific peer overlay. Mirrors bee-js Bee.getLastChequesForPeer.

func (*Service) GetLoggers

func (s *Service) GetLoggers(ctx context.Context) (LoggerResponse, error)

GetLoggers returns every logger registered in the running node. Mirrors bee-js Bee.getLoggers.

func (*Service) GetLoggersByExpression

func (s *Service) GetLoggersByExpression(ctx context.Context, expression string) (LoggerResponse, error)

GetLoggersByExpression returns loggers matching the given regex / subsystem expression. The expression is base64-encoded into the URL per the Bee /loggers/{exp} contract. Mirrors bee-js Bee.getLoggersByExpression.

func (*Service) GetPastDueConsumptionBalances

func (s *Service) GetPastDueConsumptionBalances(ctx context.Context) ([]Balance, error)

GetPastDueConsumptionBalances is the bee-js alias for GetConsumed. Both hit /consumed and return one entry per peer.

func (*Service) GetPastDueConsumptionPeerBalance

func (s *Service) GetPastDueConsumptionPeerBalance(ctx context.Context, address string) (*Balance, error)

GetPastDueConsumptionPeerBalance is the bee-js alias for GetPeerConsumed.

func (*Service) GetPeerBalance

func (s *Service) GetPeerBalance(ctx context.Context, address string) (*Balance, error)

GetPeerBalance retrieves the balance with a specific peer.

func (*Service) GetPeerConsumed

func (s *Service) GetPeerConsumed(ctx context.Context, address string) (*Balance, error)

GetPeerConsumed retrieves the past due consumption balance with a specific peer.

func (*Service) GetPendingTransaction

func (s *Service) GetPendingTransaction(ctx context.Context, txHash string) (TransactionInfo, error)

GetPendingTransaction returns the info for a single pending transaction by its hash. Mirrors bee-js Bee.getPendingTransaction.

func (*Service) GetStake

func (s *Service) GetStake(ctx context.Context) (*big.Int, error)

GetStake retrieves the amount of staked BZZ.

func (*Service) GetVersions

func (s *Service) GetVersions(ctx context.Context) (BeeVersions, error)

GetVersions returns the version pair the connected node advertises alongside the version pair this client targets. Mirrors bee-js Bee.getVersions.

func (*Service) GetWallet

func (s *Service) GetWallet(ctx context.Context) (WalletResponse, error)

GetWallet retrieves the node's wallet addresses and balances.

func (*Service) GetWelcomeMessage

func (s *Service) GetWelcomeMessage(ctx context.Context) (string, error)

GetWelcomeMessage returns the P2P welcome message the node greets new peers with. Mirrors bee-js Bee.getWelcomeMessage.

func (*Service) GetWithdrawableStake

func (s *Service) GetWithdrawableStake(ctx context.Context) (*big.Int, error)

GetWithdrawableStake retrieves the amount of withdrawable staked BZZ.

func (*Service) Health

func (s *Service) Health(ctx context.Context) (bool, error)

Health checks if the Bee node is healthy. Returns true on a 2xx response from /health. For the structured payload (version, apiVersion, status) use GetHealth.

func (*Service) IsConnected

func (s *Service) IsConnected(ctx context.Context) bool

IsConnected reports whether the base API URL responds at all (does not require /health). Mirrors bee-js Bee.isConnected.

func (*Service) IsGateway

func (s *Service) IsGateway(ctx context.Context) (bool, error)

IsGateway reports whether the node is running in gateway mode. The /gateway endpoint returns 404 outside gateway mode, in which case false is returned without an error. Mirrors bee-js Bee.isGateway.

func (*Service) IsSupportedAPIVersion

func (s *Service) IsSupportedAPIVersion(ctx context.Context) (bool, error)

IsSupportedAPIVersion reports whether the connected node's apiVersion shares a major-semver number with SupportedAPIVersion. This is the looser check most callers want. Mirrors bee-js Bee.isSupportedAPIVersion.

func (*Service) IsSupportedExactVersion

func (s *Service) IsSupportedExactVersion(ctx context.Context) (bool, error)

IsSupportedExactVersion reports whether the connected node's version matches SupportedBeeVersionExact byte-for-byte (most strict — mostly useful for CI). Mirrors bee-js Bee.isSupportedExactVersion.

func (*Service) LastCheques

func (s *Service) LastCheques(ctx context.Context) (ChequesResponse, error)

LastCheques retrieves the last cheques for all peers.

func (*Service) MigrateStake

func (s *Service) MigrateStake(ctx context.Context) (string, error)

MigrateStake migrates the stake.

func (*Service) NodeInfo

func (s *Service) NodeInfo(ctx context.Context) (*NodeInfo, error)

NodeInfo returns information about the Bee node configuration.

func (*Service) PeerSettlement

func (s *Service) PeerSettlement(ctx context.Context, peer string) (Settlement, error)

PeerSettlement retrieves the sent and received settlement totals for a specific peer. Mirrors bee-js Bee.getSettlements (note the per-peer naming).

func (*Service) Peers

func (s *Service) Peers(ctx context.Context) (PeersResponse, error)

Peers retrieves the list of connected peers.

func (*Service) PendingTransactions

func (s *Service) PendingTransactions(ctx context.Context) ([]string, error)

PendingTransactions retrieves the list of pending transaction hashes. For full transaction info use GetAllPendingTransactions.

func (*Service) PingPeer

func (s *Service) PingPeer(ctx context.Context, address string) (*string, error)

PingPeer pings a peer.

func (*Service) RCHash

func (s *Service) RCHash(ctx context.Context, depth int, anchor1 string, anchor2 string) (float64, error)

RCHash retrieves the RCHash estimate.

func (*Service) Readiness

func (s *Service) Readiness(ctx context.Context) (bool, error)

Readiness checks if the Bee node is ready to serve requests.

func (*Service) RebroadcastPendingTransaction

func (s *Service) RebroadcastPendingTransaction(ctx context.Context, txHash string) (string, error)

RebroadcastPendingTransaction replays a pending transaction to the network. Useful when the original drops out of mempool. Mirrors bee-js Bee.rebroadcastPendingTransaction.

func (*Service) RedistributionState

func (s *Service) RedistributionState(ctx context.Context) (RedistributionStateResponse, error)

RedistributionState retrieves the redistribution state.

func (*Service) RemovePeer

func (s *Service) RemovePeer(ctx context.Context, address string) error

RemovePeer removes a peer from the node.

func (*Service) ReserveState

func (s *Service) ReserveState(ctx context.Context) (ReserveStateResponse, error)

ReserveState retrieves the reserve state.

func (*Service) SetLogger added in v1.2.0

func (s *Service) SetLogger(ctx context.Context, expression, verbosity string) error

SetLogger sets the verbosity of every logger matching expression. The expression is base64-encoded into the URL per the Bee PUT /loggers/{exp}/{verbosity} contract. verbosity must be one of LogLevels ("none|error|warning|info|debug|all"); anything else is rejected client-side with an Argument error before the request is built.

Pass "." as expression to bump every logger at once (Bee treats it as a regex match-all). Mirrors bee-rs DebugApi::set_logger and bee-py client.debug.set_logger.

func (*Service) SetLoggerVerbosity deprecated

func (s *Service) SetLoggerVerbosity(ctx context.Context, expression string) error

SetLoggerVerbosity is broken — Bee's actual route is PUT /loggers/{exp}/{verbosity}; verbosity is mandatory in the path. This method emits PUT /loggers/{exp} which 404s on every real Bee build. It only ever "succeeded" against mock servers wired to the wrong path.

Deprecated: use Service.SetLogger instead — it takes both the expression and verbosity and emits the correct path. Kept for backwards compatibility; returns an error explaining the breakage.

func (*Service) SetWelcomeMessage

func (s *Service) SetWelcomeMessage(ctx context.Context, message string) error

SetWelcomeMessage updates the P2P welcome message. Mirrors bee-js Bee.setWelcomeMessage.

func (*Service) Settlements

func (s *Service) Settlements(ctx context.Context) (SettlementsResponse, error)

Settlements retrieves a list of settlements.

func (*Service) Stake

func (s *Service) Stake(ctx context.Context, amount *big.Int) (string, error)

Stake stakes a given amount of tokens.

func (*Service) Status

func (s *Service) Status(ctx context.Context) (StatusResponse, error)

Status checks the status of the Bee node components.

func (*Service) StatusNeighborhoods

func (s *Service) StatusNeighborhoods(ctx context.Context) ([]Neighborhood, error)

StatusNeighborhoods returns reserve statistics per neighborhood. Useful for storage-layer diagnostics.

Bee node endpoint: GET /status/neighborhoods. Not exposed by bee-js.

func (*Service) StatusPeers

func (s *Service) StatusPeers(ctx context.Context) ([]PeerStatus, error)

StatusPeers returns the status snapshot of every currently connected peer (bee mode, reserve size, sync state, …). Snapshots are gathered in parallel by the Bee node with a 10-second per-peer timeout; peers that don't respond have RequestFailed=true.

Bee node endpoint: GET /status/peers. Not exposed by bee-js.

func (*Service) Topology

func (s *Service) Topology(ctx context.Context) (TopologyResponse, error)

Topology retrieves the node topology.

func (*Service) WithdrawBZZ

func (s *Service) WithdrawBZZ(ctx context.Context, amount *big.Int, address string) (string, error)

WithdrawBZZ withdraws BZZ tokens from the wallet.

func (*Service) WithdrawBZZFromChequebook

func (s *Service) WithdrawBZZFromChequebook(ctx context.Context, amount *big.Int) (string, error)

WithdrawBZZFromChequebook is the bee-js name for WithdrawTokens.

func (*Service) WithdrawBZZToExternalWallet

func (s *Service) WithdrawBZZToExternalWallet(ctx context.Context, amount *big.Int, address string) (string, error)

WithdrawBZZToExternalWallet is the bee-js name for WithdrawBZZ.

func (*Service) WithdrawDAI

func (s *Service) WithdrawDAI(ctx context.Context, amount *big.Int, address string) (string, error)

WithdrawDAI withdraws Native tokens (DAI/ETH) from the wallet.

func (*Service) WithdrawDAIToExternalWallet

func (s *Service) WithdrawDAIToExternalWallet(ctx context.Context, amount *big.Int, address string) (string, error)

WithdrawDAIToExternalWallet is the bee-js name for WithdrawDAI.

func (*Service) WithdrawSurplusStake

func (s *Service) WithdrawSurplusStake(ctx context.Context) (string, error)

WithdrawSurplusStake withdraws surplus stake.

func (*Service) WithdrawTokens

func (s *Service) WithdrawTokens(ctx context.Context, amount *big.Int) (string, error)

WithdrawTokens withdraws tokens from the chequebook.

type Settlement

type Settlement struct {
	Peer     string   `json:"peer"`
	Received *big.Int `json:"received"`
	Sent     *big.Int `json:"sent"`
}

Settlement represents a settlement with a peer.

func (*Settlement) UnmarshalJSON

func (s *Settlement) UnmarshalJSON(b []byte) error

type SettlementsResponse

type SettlementsResponse struct {
	TotalReceived *big.Int     `json:"totalReceived"`
	TotalSent     *big.Int     `json:"totalSent"`
	Settlements   []Settlement `json:"settlements"`
}

SettlementsResponse represents list of settlements.

func (*SettlementsResponse) UnmarshalJSON

func (s *SettlementsResponse) UnmarshalJSON(b []byte) error

type StatusResponse

type StatusResponse struct {
	Overlay                 string  `json:"overlay"`
	Proximity               int     `json:"proximity"`
	BeeMode                 string  `json:"beeMode"`
	ReserveSize             int64   `json:"reserveSize"`
	ReserveSizeWithinRadius int64   `json:"reserveSizeWithinRadius"`
	PullsyncRate            float64 `json:"pullsyncRate"`
	StorageRadius           int     `json:"storageRadius"`
	ConnectedPeers          int     `json:"connectedPeers"`
	NeighborhoodSize        int     `json:"neighborhoodSize"`
	BatchCommitment         int64   `json:"batchCommitment"`
	IsReachable             bool    `json:"isReachable"`
	LastSyncedBlock         int64   `json:"lastSyncedBlock"`
	CommittedDepth          int     `json:"committedDepth"`
	IsWarmingUp             bool    `json:"isWarmingUp"`
}

StatusResponse represents the node status.

type TopologyResponse

type TopologyResponse struct {
	BaseAddr       string `json:"baseAddr"`
	Population     int    `json:"population"`
	Connected      int    `json:"connected"`
	Timestamp      string `json:"timestamp"`
	NnLowWatermark int    `json:"nnLowWatermark"`
	Depth          uint8  `json:"depth"`
}

TopologyResponse represents the node topology.

type TransactionInfo

type TransactionInfo struct {
	TransactionHash string   `json:"transactionHash"`
	To              string   `json:"to"`
	Nonce           uint64   `json:"nonce"`
	GasPrice        *big.Int `json:"-"`
	GasLimit        uint64   `json:"gasLimit"`
	GasTipBoost     int      `json:"gasTipBoost"`
	GasTipCap       *big.Int `json:"-"`
	GasFeeCap       *big.Int `json:"-"`
	Data            string   `json:"data"`
	Created         string   `json:"created"`
	Description     string   `json:"description"`
	Value           *big.Int `json:"-"`
}

TransactionInfo describes a pending Bee transaction. Mirrors bee-js TransactionInfo. Created is the RFC3339 string Bee emits — left as a string so the caller can parse it with whatever timezone handling they prefer.

func (*TransactionInfo) UnmarshalJSON

func (t *TransactionInfo) UnmarshalJSON(b []byte) error

UnmarshalJSON handles the big.Int-as-string fields that Bee emits.

type WalletResponse

type WalletResponse struct {
	BzzAddress         string   `json:"bzzAddress"`
	NativeAddress      string   `json:"nativeAddress"`
	Chequebook         string   `json:"chequebook"`
	BzzBalance         *big.Int `json:"bzzBalance"`         // Added
	NativeTokenBalance *big.Int `json:"nativeTokenBalance"` // Added
	ChainID            int64    `json:"chainID"`            // Added
	WalletAddress      string   `json:"walletAddress"`      // Added
}

WalletResponse represents the node's wallet addresses and balances.

func (*WalletResponse) UnmarshalJSON

func (w *WalletResponse) UnmarshalJSON(b []byte) error

Jump to

Keyboard shortcuts

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