cryptobalance

package
v1.49.61 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2026 License: MIT Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Query

Types

type CryptoBalance

type CryptoBalance struct {
	mixin.Model[CryptoBalance]

	// Customer who owns the balance
	CustomerId string `json:"customerId"`

	// Blockchain
	Chain string `json:"chain"` // ethereum, solana, base, etc.

	// Token identifier
	Token string `json:"token"` // usdc, usdt, eth, sol, etc.

	// Balance in smallest unit (wei, lamports, etc.) as string for precision
	Balance string `json:"balance" orm:"default:0"`

	// Custody address for this customer+chain+token
	Address string `json:"address"`

	// Reserved amount (pending withdrawal or payment)
	Reserved string `json:"reserved,omitempty" orm:"default:0"`

	Metadata Map `json:"metadata,omitempty" orm:"default:{}"`
}

CryptoBalance tracks custodial crypto holdings for a customer.

func New

func (*CryptoBalance) Available

func (cb *CryptoBalance) Available() (*big.Int, error)

Available returns the available balance (total - reserved).

func (*CryptoBalance) Credit

func (cb *CryptoBalance) Credit(amount string) error

Credit adds to the balance.

func (*CryptoBalance) Debit

func (cb *CryptoBalance) Debit(amount string) error

Debit subtracts from the balance.

func (*CryptoBalance) IsZero

func (cb *CryptoBalance) IsZero() bool

IsZero returns true if the balance is zero or empty.

func (*CryptoBalance) Release

func (cb *CryptoBalance) Release(amount string) error

Release removes a hold on funds.

func (*CryptoBalance) Reserve

func (cb *CryptoBalance) Reserve(amount string) error

Reserve places a hold on funds.

Jump to

Keyboard shortcuts

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