idconv

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package idconv converts between the SDK's typed uint64 identifiers (types.DataSetID, types.ProviderID, ...) and the *big.Int values used by generated contract bindings.

All conversions go through this package so we have a single, audited location that:

  • Uses *big.Int.SetUint64 / IsUint64 / Uint64 (never int64, which would silently wrap for IDs above math.MaxInt64).
  • Rejects nil and out-of-range values with clear errors instead of panicking or truncating.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Big

func Big[T ~uint64](id T) *big.Int

Big returns a fresh *big.Int holding id, using SetUint64 so the full uint64 range round-trips without relying on int64.

func BigSlice

func BigSlice[T ~uint64](ids []T) []*big.Int

BigSlice applies Big to every element of ids.

func Safe

func Safe[T ~uint64](name string, v *big.Int) (T, error)

Safe converts v into a typed identifier, returning an error when v is nil, negative, or exceeds math.MaxUint64. name is used as the error prefix so the caller site is always recoverable.

func SafeSlice

func SafeSlice[T ~uint64](name string, values []*big.Int) ([]T, error)

SafeSlice applies Safe to every element of values; the returned slice has the same length as values. name is used as the element error prefix; each element's index is appended for context.

Types

This section is empty.

Jump to

Keyboard shortcuts

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