Documentation
¶
Overview ¶
Package warmstorage provides the WarmStorage (FWSS) service for managing storage contracts, data sets, and pricing.
FWSS (Filecoin Warm Storage Service) is the canonical storage contract. The root synapse Client supplies the chain's known FWSS, StateView, and PDPVerifier addresses when constructing this service. Low-level callers that instantiate Service directly must provide those addresses explicitly.
Key operations: data set management (including Service.TerminateDataSet for direct FWSS teardown), constant-cost active-piece presence checks through Service.HasActivePieces, cursor-based exact counts through Service.GetActivePieceCount, Service.GetPriceList, approved-provider reads, and provider allocation.
EnhancedDataSetInfo exposes its embedded DataSetInfo fields directly. Reading a promoted field from a zero EnhancedDataSetInfo does not panic; each field retains its ordinary zero value, including nil pointer and map fields. Callers should check identifiers when they require a complete on-chain identity.
The root synapse Client wires WarmStorage together with the other write-capable services so transaction nonce allocation is coordinated for a shared signer. Standalone services create their own nonce coordinator when constructed with write dependencies.
Write methods accept WithOnSubmitted to report successful broadcast synchronously, before any receipt waiting. This notification does not indicate confirmation. Sending errors return BroadcastError with the original signed transaction and cause; a nil result does not establish that the node rejected it. Persist the hash from the callback, the result, or that transaction, then resume with Service.WaitForTransaction.
Service.TopUpCDNPaymentRails requires each amount to be within [0, 2^256-1] and at least one amount to be positive. Invalid amounts return ErrInvalidArgument before nonce acquisition or signing.
Errors are returned as wrapped sentinels or typed errors. Use errors.Is for sentinels and errors.AsType for typed errors:
- ErrNotFound: returned when a queried record (e.g. data set) does not exist. Getter methods document which lookups can produce this.
- ErrDataSetCorrelationConflict: returned when a payer-scoped client data-set ID is consumed but does not resolve to the expected data-set record. The ID must not be reused.
- ErrInvalidArgument: returned when required arguments are nil, zero, or otherwise malformed.
- ErrPDPVerifierNotConfigured: returned when a PDPVerifier-dependent read is used without configuring a PDPVerifier address.
- ErrDataSetUnavailable: returned by strict PDPVerifier-backed queries when a data set is missing or no longer live. HasActivePieces is deliberately an existence predicate and reports those data sets as false, nil; GetActivePieceCount remains a strict exact-value query and returns the sentinel.
- ErrWriteNotConfigured: returned when a write method is used without write dependencies.
- DataSetNotLiveError: returned by ValidateDataSet when PDPVerifier reports that the data set is not live. It matches ErrDataSetUnavailable.
- DataSetNotManagedError: returned by ValidateDataSet when the data set is managed by another listener.
Example ¶
Example demonstrates listing a client's data sets via warmstorage.Service. In practice a Service is obtained from synapse.Client.WarmStorage.
package main
import (
"context"
"fmt"
"log"
"github.com/ethereum/go-ethereum/common"
"github.com/strahe/synapse-go/types"
"github.com/strahe/synapse-go/warmstorage"
)
func main() {
var svc *warmstorage.Service // obtained from synapse.Client.WarmStorage()
ctx := context.Background()
payer := common.HexToAddress("0x...")
sets, err := svc.GetClientDataSets(ctx, payer, types.ListOptions{Limit: 10})
if err != nil {
log.Fatal(err)
}
for _, s := range sets {
fmt.Println(s.DataSetID)
}
}
Output:
Index ¶
- Variables
- type Backend
- type BroadcastError
- type DataSetInfo
- type DataSetNotLiveError
- type DataSetNotManagedError
- type EnhancedDataSetInfo
- type EthClient
- type NonceManager
- type Options
- type PDPConfig
- type PDPPaymentTerminatedEvent
- type PriceList
- type PriceListFees
- type PriceListLockups
- type PriceListRates
- type Service
- func (s *Service) FWSSAddress() common.Address
- func (s *Service) FindDataSetByClientDataSetID(ctx context.Context, payer common.Address, clientDataSetID types.BigInt) (*DataSetInfo, error)
- func (s *Service) GetActivePieceCount(ctx context.Context, dataSetID sdktypes.BigInt) (*big.Int, error)
- func (s *Service) GetAllClientDataSetIds(ctx context.Context, payer common.Address) ([]types.BigInt, error)
- func (s *Service) GetAllClientDataSets(ctx context.Context, payer common.Address) ([]*DataSetInfo, error)
- func (s *Service) GetAllDataSetMetadata(ctx context.Context, dataSetID types.BigInt) (map[string]string, error)
- func (s *Service) GetApprovedProviderIDs(ctx context.Context, opts types.ListOptions) ([]types.BigInt, error)
- func (s *Service) GetApprovedProvidersLength(ctx context.Context) (*big.Int, error)
- func (s *Service) GetClientDataSetIds(ctx context.Context, payer common.Address, opts sdktypes.ListOptions) ([]sdktypes.BigInt, error)
- func (s *Service) GetClientDataSets(ctx context.Context, payer common.Address, opts types.ListOptions) ([]*DataSetInfo, error)
- func (s *Service) GetClientDataSetsLength(ctx context.Context, payer common.Address) (*big.Int, error)
- func (s *Service) GetClientDataSetsWithDetails(ctx context.Context, payer common.Address, onlyManaged bool) ([]*EnhancedDataSetInfo, error)
- func (s *Service) GetDataSet(ctx context.Context, dataSetID types.BigInt) (*DataSetInfo, error)
- func (s *Service) GetOwner(ctx context.Context) (common.Address, error)
- func (s *Service) GetPDPConfig(ctx context.Context) (*PDPConfig, error)
- func (s *Service) GetPriceList(ctx context.Context) (*PriceList, error)
- func (s *Service) HasActivePieces(ctx context.Context, dataSetID sdktypes.BigInt) (bool, error)
- func (s *Service) IsOwner(ctx context.Context, addr common.Address) (bool, error)
- func (s *Service) IsProviderApproved(ctx context.Context, providerID types.BigInt) (bool, error)
- func (s *Service) IterateAllApprovedProviderIDs(ctx context.Context) iter.Seq2[types.BigInt, error]
- func (s *Service) IterateAllClientDataSetIds(ctx context.Context, payer common.Address) iter.Seq2[types.BigInt, error]
- func (s *Service) IterateAllClientDataSets(ctx context.Context, payer common.Address) iter.Seq2[*DataSetInfo, error]
- func (s *Service) PDPPaymentTerminatedEvent(receipt *ethtypes.Receipt, dataSetID sdktypes.BigInt) (*PDPPaymentTerminatedEvent, error)
- func (s *Service) PDPVerifierAddress() common.Address
- func (s *Service) TerminateDataSet(ctx context.Context, dataSetID sdktypes.BigInt, opts ...WriteOption) (*sdktypes.WriteResult, error)
- func (s *Service) TopUpCDNPaymentRails(ctx context.Context, dataSetID sdktypes.BigInt, ...) (*sdktypes.WriteResult, error)
- func (s *Service) ValidateDataSet(ctx context.Context, dataSetID sdktypes.BigInt) error
- func (s *Service) ViewAddress() common.Address
- func (s *Service) WaitForTransaction(ctx context.Context, hash common.Hash, opts ...WriteOption) (*sdktypes.WriteResult, error)
- type WriteOption
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var ErrClosed = lifecycle.ErrClosed
ErrClosed is returned when a method is called after the owning Client has been closed. It aliases the shared closed-client sentinel.
var ErrDataSetCorrelationConflict = errors.New("warmstorage: data set correlation conflict")
ErrDataSetCorrelationConflict is returned when a client data-set ID has been consumed on-chain but does not resolve to a matching data-set record. The ID must not be reused.
ErrDataSetUnavailable is returned when PDPVerifier reports that a data set does not exist or is no longer live.
var ErrInvalidArgument = errors.New("warmstorage: invalid argument")
ErrInvalidArgument is returned, wrapped, when a caller passes an argument that fails local precondition checks (nil IDs, zero addresses, etc.). Use errors.Is to detect it.
var ErrNotFound = errors.New("warmstorage: not found")
ErrNotFound is returned, wrapped via fmt.Errorf with %w, when a queried record (e.g. a data set) does not exist on-chain. Callers should use errors.Is(err, warmstorage.ErrNotFound) rather than comparing for nil results.
var ErrPDPVerifierNotConfigured = errors.New("warmstorage: PDPVerifier address not configured")
ErrPDPVerifierNotConfigured is returned when a method that relies on direct PDPVerifier reads is called on a Service that was constructed without a PDPVerifier address.
var ErrReceiptRPCFailure = types.ErrReceiptRPCFailure
ErrReceiptRPCFailure is a convenience re-export of types.ErrReceiptRPCFailure. The same value can be matched interchangeably with errors.Is.
var ErrReceiptTimeout = types.ErrReceiptTimeout
ErrReceiptTimeout is a convenience re-export of types.ErrReceiptTimeout. The same value can be matched interchangeably with errors.Is.
var ErrUninitialized = errors.New("warmstorage: service not initialized; use warmstorage.New")
ErrUninitialized is returned when a method is invoked on a zero-value Service (one that was not constructed via New).
var ErrWriteNotConfigured = errors.New("warmstorage: write backend / signer not configured")
ErrWriteNotConfigured reports a missing transaction backend, or a missing signer for a write. Receipt waiting requires only the backend.
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend interface {
bind.ContractBackend
TransactionReceipt(ctx context.Context, txHash common.Hash) (*ethtypes.Receipt, error)
BlockNumber(ctx context.Context) (uint64, error)
}
Backend extends EthClient with the Ethereum RPC methods used for writes. The root Client supplies its configured Ethereum client.
type BroadcastError ¶ added in v0.7.0
type BroadcastError = types.BroadcastError
BroadcastError is a convenience re-export of the same types.BroadcastError type. Either type can be used to match a transaction send error.
type DataSetInfo ¶
type DataSetInfo struct {
DataSetID types.BigInt
PDPRailID types.BigInt // payment rail for PDP proofs
CacheMissRailID types.BigInt // payment rail for cache-miss egress
CDNRailID types.BigInt // payment rail for CDN egress
Payer common.Address
Payee common.Address
ServiceProvider common.Address
CommissionBps *big.Int // commission rate in basis points (out of 10 000)
ClientDataSetID types.BigInt // caller-assigned ID used in EIP-712 payloads
PDPEndEpoch types.Epoch // epoch at which PDP service expires; 0 = indefinite
ProviderID types.BigInt // storage provider ID
// PendingOneTimePayments is the operation-fee total waiting to be paid from
// the lifecycle reserve.
PendingOneTimePayments *big.Int
// LifecycleReserveBalance is the current fixed lockup balance available for
// lifecycle operation fees.
LifecycleReserveBalance *big.Int
}
DataSetInfo is the FWSS StateView record for one data set.
type DataSetNotLiveError ¶ added in v0.3.0
DataSetNotLiveError is returned when PDPVerifier reports that a data set is not live, which prevents adding pieces to it.
func (*DataSetNotLiveError) Error ¶ added in v0.3.0
func (e *DataSetNotLiveError) Error() string
func (*DataSetNotLiveError) Is ¶ added in v0.5.1
func (e *DataSetNotLiveError) Is(target error) bool
Is makes DataSetNotLiveError match ErrDataSetUnavailable.
type DataSetNotManagedError ¶ added in v0.3.0
type DataSetNotManagedError struct {
DataSetID types.BigInt
Listener common.Address
ExpectedListener common.Address
}
DataSetNotManagedError is returned when a data set is live but managed by a listener other than this WarmStorage contract.
func (*DataSetNotManagedError) Error ¶ added in v0.3.0
func (e *DataSetNotManagedError) Error() string
type EnhancedDataSetInfo ¶
type EnhancedDataSetInfo struct {
DataSetInfo
PDPVerifierDataSetID sdktypes.BigInt
IsLive bool
IsManaged bool
HasActivePieces bool
WithCDN bool
Metadata map[string]string
}
EnhancedDataSetInfo extends DataSetInfo with pdpverifier-derived liveness metadata. It embeds the base record by value, so promoted DataSetInfo fields can be read from a zero value without dereferencing a nil embedded pointer. Returned by GetClientDataSetsWithDetails.
type EthClient ¶
type EthClient interface {
bind.ContractCaller
}
EthClient provides the Ethereum contract calls used for WarmStorage reads. The root Client supplies its configured Ethereum client.
type NonceManager ¶ added in v0.5.0
type NonceManager interface {
Acquire(ctx context.Context) (nonce uint64, release func(), err error)
}
NonceManager serializes transaction-nonce acquisition for one signing address. The root Client supplies a shared coordinator. On success, Acquire must return the next pending nonce and a non-nil, idempotent release function. Callers may invoke release more than once, but must invoke it after broadcasting or abandoning the transaction.
type Options ¶
type Options struct {
// Client is required; nil and typed-nil are invalid.
Client EthClient
FWSS common.Address
ViewContract common.Address
// PDPVerifier is the PDPVerifier contract address. Optional. Required
// only for methods that call PDPVerifier directly (ValidateDataSet,
// GetActivePieceCount, HasActivePieces, GetScheduledRemovals, and the
// isLive / listener decorators on GetClientDataSetsWithDetails).
PDPVerifier common.Address
// ChainID is required only when writes are used (TopUpCDNPaymentRails).
ChainID types.ChainID
// Backend provides a full RPC surface for writes. Nil or typed-nil keeps the
// Service read-only; write methods return ErrWriteNotConfigured.
Backend Backend
// Signer signs write transactions. Nil or typed-nil keeps writes disabled.
Signer signer.EVMSigner
// NonceManager is optional. The root synapse Client injects a shared
// coordinator across all write-capable services; standalone callers may
// leave this nil to create one when Backend and Signer are both set. A
// typed-nil value is treated as nil.
NonceManager NonceManager
// Logger is optional.
Logger *slog.Logger
// MaxMulticallCalls limits the number of actual contract calls in each
// dynamic Multicall3 request. Zero uses the default of 64. Negative values
// are invalid. Batches execute serially and may observe different blocks;
// this count does not bound request or response bytes, gas, or execution
// time.
MaxMulticallCalls int
// Lifecycle is checked before service operations that can touch configured
// backends. Any error returned by CheckClosed is returned without touching
// those backends. The root synapse Client injects a shared checker whose
// closed error matches ErrClosed. Nil is allowed for standalone use. A
// typed-nil value is treated as nil.
Lifecycle interface{ CheckClosed() error }
}
Options bundle the caller and contract addresses.
type PDPConfig ¶
type PDPConfig struct {
MaxProvingPeriod uint64
ChallengeWindowSize *big.Int
ChallengesPerProof *big.Int
InitChallengeWindowStart *big.Int
}
PDPConfig contains the FWSS StateView parameters that govern proving period scheduling.
type PDPPaymentTerminatedEvent ¶ added in v0.4.0
type PDPPaymentTerminatedEvent struct {
DataSetID sdktypes.BigInt
EndEpoch sdktypes.Epoch
PDPRailID sdktypes.BigInt
}
PDPPaymentTerminatedEvent is the FWSS termination event carrying the PDP rail end epoch.
func ExtractPDPPaymentTerminatedEvent ¶ added in v0.4.0
func ExtractPDPPaymentTerminatedEvent(receipt *ethtypes.Receipt) (*PDPPaymentTerminatedEvent, error)
ExtractPDPPaymentTerminatedEvent extracts the first PDPPaymentTerminated event without validating its contract address or data set. Use Service.PDPPaymentTerminatedEvent to verify both.
type PriceList ¶ added in v0.4.0
type PriceList struct {
Token common.Address
Rates PriceListRates
Fees PriceListFees
Lockups PriceListLockups
}
PriceList is the canonical warm-storage pricing view. All amounts are in base units of the payment token.
type PriceListFees ¶ added in v0.4.0
type PriceListFees struct {
CreateDataSetFee *big.Int
AddPiecesBaseFee *big.Int
AddPiecesPerPieceFee *big.Int
SchedulePieceRemovalsFee *big.Int
TerminateFee *big.Int
}
PriceListFees contains one-time operation fees.
type PriceListLockups ¶ added in v0.4.0
type PriceListLockups struct {
LifecycleReserveTarget *big.Int
ReplenishThreshold *big.Int
DefaultLockupPeriod *big.Int
CDNLockupAmount *big.Int
CacheMissLockupAmount *big.Int
CDNLockupPeriod *big.Int
}
PriceListLockups contains required lockup amounts and periods.
type PriceListRates ¶ added in v0.4.0
type PriceListRates struct {
StoragePerTiBPerMonth *big.Int
DatasetFeePerMonth *big.Int
CDNEgressPerTiB *big.Int
CacheMissEgressPerTiB *big.Int
}
PriceListRates contains recurring storage and egress rates.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service provides read access to FilecoinWarmStorageService (FWSS) and its companion StateView contract, plus a small number of writes that are semantically owned by the WarmStorage contract (TopUpCDNPaymentRails).
Most writes still flow through the payments service or the curio HTTP client. FWSS is invoked here for queries that back SDK decisions (service pricing, dataset existence, provider approval, dataset management checks).
func New ¶
New creates a Service. Both FWSS and ViewContract addresses are required. The root synapse Client supplies the canonical chain addresses; low-level callers must provide the addresses they want this Service to use.
func (*Service) FWSSAddress ¶
FWSSAddress returns the configured FWSS contract address.
func (*Service) FindDataSetByClientDataSetID ¶ added in v0.6.0
func (s *Service) FindDataSetByClientDataSetID( ctx context.Context, payer common.Address, clientDataSetID types.BigInt, ) (*DataSetInfo, error)
FindDataSetByClientDataSetID resolves a caller-owned client data-set ID to its current on-chain data-set record. ErrNotFound means no stable mapping is visible in the queried chain state. ErrDataSetCorrelationConflict means the ID was consumed but does not resolve to a matching record, so callers must not reuse it. Client data-set IDs share their payer-scoped namespace with add-pieces nonces and remain consumed after data-set deletion.
A successful result reports current chain visibility only. It does not establish transaction finality or confirm that pieces from a combined create-and-add request were added.
func (*Service) GetActivePieceCount ¶
func (s *Service) GetActivePieceCount(ctx context.Context, dataSetID sdktypes.BigInt) (*big.Int, error)
GetActivePieceCount returns the exact number of live (non-removed) pieces in the given data set. It traverses bounded cursor pages, so its cost grows with the number of pieces. Prefer Service.HasActivePieces when only presence is needed. Missing or non-live data sets return ErrDataSetUnavailable.
func (*Service) GetAllClientDataSetIds ¶ added in v0.3.1
func (s *Service) GetAllClientDataSetIds(ctx context.Context, payer common.Address) ([]types.BigInt, error)
GetAllClientDataSetIds returns every data set ID owned by payer across all pages. It materializes the full result set in memory; use IterateAllClientDataSetIds or GetClientDataSetIds with explicit pagination for large accounts.
func (*Service) GetAllClientDataSets ¶ added in v0.3.1
func (s *Service) GetAllClientDataSets(ctx context.Context, payer common.Address) ([]*DataSetInfo, error)
GetAllClientDataSets returns every data set owned by payer across all pages. It materializes the full result set in memory; use IterateAllClientDataSets or GetClientDataSets with explicit pagination for large accounts.
func (*Service) GetAllDataSetMetadata ¶
func (s *Service) GetAllDataSetMetadata(ctx context.Context, dataSetID types.BigInt) (map[string]string, error)
GetAllDataSetMetadata returns all metadata entries for the given dataset as a key/value map. The returned map is non-nil; an empty map signals "no metadata entries" (which the contract also returns when the dataset itself does not exist — the two cases are indistinguishable at this layer). Mismatched response lengths are treated as an RPC/ABI error.
func (*Service) GetApprovedProviderIDs ¶
func (s *Service) GetApprovedProviderIDs(ctx context.Context, opts types.ListOptions) ([]types.BigInt, error)
GetApprovedProviderIDs returns one page of approved-provider ids. opts.Limit must be > 0; use IterateAllApprovedProviderIDs for unbounded traversal.
func (*Service) GetApprovedProvidersLength ¶
GetApprovedProvidersLength returns the total number of approved providers.
func (*Service) GetClientDataSetIds ¶
func (s *Service) GetClientDataSetIds(ctx context.Context, payer common.Address, opts sdktypes.ListOptions) ([]sdktypes.BigInt, error)
GetClientDataSetIds returns the shallow list of data set IDs for payer with offset/limit pagination. Limit must be > 0; use IterateAllClientDataSetIds for unbounded traversal.
func (*Service) GetClientDataSets ¶
func (s *Service) GetClientDataSets(ctx context.Context, payer common.Address, opts types.ListOptions) ([]*DataSetInfo, error)
GetClientDataSets returns one page of data sets owned by payer. opts.Limit must be > 0; use IterateAllClientDataSets for unbounded traversal.
func (*Service) GetClientDataSetsLength ¶
func (s *Service) GetClientDataSetsLength(ctx context.Context, payer common.Address) (*big.Int, error)
GetClientDataSetsLength returns the total number of data sets for a payer.
func (*Service) GetClientDataSetsWithDetails ¶
func (s *Service) GetClientDataSetsWithDetails(ctx context.Context, payer common.Address, onlyManaged bool) ([]*EnhancedDataSetInfo, error)
GetClientDataSetsWithDetails returns the client's data sets enriched with pdpverifier liveness and active-piece presence. Requires the Service to have been configured with a PDPVerifier address. When onlyManaged is true, entries whose listener is not this WarmStorage contract are filtered out. Detail reads use serial Multicall3 batches; separate batches may observe different blocks. When sub-calls fail, the method returns the earliest error in data-set and operation order.
func (*Service) GetDataSet ¶
GetDataSet returns the data set record for dataSetID. Returns an error wrapping ErrNotFound when no such data set exists (the contract convention is pdpRailId == 0 for "not found"). RPC or ABI errors are wrapped and propagated as-is.
func (*Service) GetPDPConfig ¶
GetPDPConfig returns PDP proving-period parameters from FWSSView.
func (*Service) GetPriceList ¶ added in v0.4.0
GetPriceList returns the canonical warm-storage price list.
func (*Service) HasActivePieces ¶ added in v0.4.1
HasActivePieces reports whether the data set contains at least one active piece. It uses the data-set leaf count, so its cost does not grow with the total number of pieces. As an existence predicate, missing and non-live data sets deliberately report false; exact-value queries such as Service.GetActivePieceCount return ErrDataSetUnavailable instead.
func (*Service) IsProviderApproved ¶
IsProviderApproved returns true if providerID is on the approved list.
func (*Service) IterateAllApprovedProviderIDs ¶
IterateAllApprovedProviderIDs yields every approved-provider id across all pages. Semantics match IterateAllClientDataSets.
func (*Service) IterateAllClientDataSetIds ¶
func (s *Service) IterateAllClientDataSetIds(ctx context.Context, payer common.Address) iter.Seq2[types.BigInt, error]
IterateAllClientDataSetIds yields every data set ID owned by payer across all pages. Semantics match IterateAllClientDataSets but returns a shallow list of IDs (lighter-weight than the full DataSetInfo).
func (*Service) IterateAllClientDataSets ¶
func (s *Service) IterateAllClientDataSets(ctx context.Context, payer common.Address) iter.Seq2[*DataSetInfo, error]
IterateAllClientDataSets yields every data set owned by payer across all pages. It terminates cleanly when ctx is cancelled; the error yielded by the last (err != nil) pair is ctx.Err(). Break out of the range loop to stop early — the iterator performs no further RPC work after the body returns false.
func (*Service) PDPPaymentTerminatedEvent ¶ added in v0.7.1
func (s *Service) PDPPaymentTerminatedEvent(receipt *ethtypes.Receipt, dataSetID sdktypes.BigInt) (*PDPPaymentTerminatedEvent, error)
PDPPaymentTerminatedEvent extracts the configured FWSS contract's termination event for dataSetID from receipt.
func (*Service) PDPVerifierAddress ¶
PDPVerifierAddress returns the configured PDPVerifier address. Zero when the Service was constructed without a PDPVerifier.
func (*Service) TerminateDataSet ¶
func (s *Service) TerminateDataSet(ctx context.Context, dataSetID sdktypes.BigInt, opts ...WriteOption) (*sdktypes.WriteResult, error)
TerminateDataSet terminates the FWSS-managed payment rails for the given data set. It maps to FWSS.terminateService(uint256). By default it returns after broadcast with the submission hash and no receipt. WithOnSubmitted reports the submission hash before any receipt waiting. A positive WithWait waits for a receipt; waiting errors retain the submission hash in the returned WriteResult, and a failed transaction also retains its receipt. Confirmation does not wait for service expiry or data-set cleanup.
func (*Service) TopUpCDNPaymentRails ¶
func (s *Service) TopUpCDNPaymentRails( ctx context.Context, dataSetID sdktypes.BigInt, cdnAmountToAdd, cacheMissAmountToAdd *big.Int, opts ...WriteOption, ) (*sdktypes.WriteResult, error)
TopUpCDNPaymentRails tops up the CDN egress and cache-miss rails associated with dataSetID. Requires Signer + Backend.
func (*Service) ValidateDataSet ¶
ValidateDataSet verifies that the given data set is alive on the PDPVerifier contract and that its listener is this WarmStorage contract. It returns an error matching ErrDataSetUnavailable when PDPVerifier reports that the data set is missing or no longer live. Returns nil on success.
func (*Service) ViewAddress ¶
ViewAddress returns the configured StateView contract address.
func (*Service) WaitForTransaction ¶ added in v0.7.1
func (s *Service) WaitForTransaction(ctx context.Context, hash common.Hash, opts ...WriteOption) (*sdktypes.WriteResult, error)
WaitForTransaction waits for an existing transaction without broadcasting or requiring a signer. Non-positive WithWait values select five minutes; WithOnSubmitted is ignored. Errors retain the hash; Receipt is set only after the requested confirmations, including for a failed transaction. A hash does not prove broadcast, and a timeout does not prove that the transaction does not exist.
type WriteOption ¶
type WriteOption func(*writeConfig)
WriteOption configures transaction submission or receipt waiting. Nil options are ignored.
func WithConfirmations ¶
func WithConfirmations(n uint64) WriteOption
WithConfirmations requires n confirmations for successful and failed receipts, counting the inclusion block as the first. Zero waits only for inclusion. For writes it requires a positive WithWait timeout. Service.WaitForTransaction applies it with the selected wait timeout.
func WithOnSubmitted ¶ added in v0.6.0
func WithOnSubmitted(fn func(common.Hash)) WriteOption
WithOnSubmitted calls fn synchronously once a transaction is successfully broadcast, before any receipt polling. A nil fn disables notification. Callback panics propagate to the caller.
func WithWait ¶
func WithWait(timeout time.Duration) WriteOption
WithWait makes the call block until the transaction is mined, or the given timeout elapses. Zero / negative returns immediately after broadcast. For Service.WaitForTransaction, non-positive values select the default timeout.