shared

package
v6.0.0-...-c710dba Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: Apache-2.0 Imports: 6 Imported by: 6

Documentation

Index

Constants

View Source
const (
	AdaPolicy        = "ada"
	AdaAsset         = "lovelace"
	AdaAssetIDString = AdaPolicy + "." + AdaAsset
	AdaAssetID       = AssetID(AdaAssetIDString)
)

AdaAssetID maps to Coins in the v5 Value struct.

Variables

View Source
var ErrInsufficientFunds = fmt.Errorf("insufficient funds")

Functions

func Enough

func Enough(have Value, want Value) (bool, error)

func Equal

func Equal(a, b Value) bool

func GreaterThanOrEqual

func GreaterThanOrEqual(a, b Value) bool

A should be strictly greater than B meaning for every asset in B, the amount of asset in A should be greater meaning loop over b, because if there's an asset in b that's not in a, we need to fail but if there's an asset in a that's not in b, that's fine

func LessThanOrEqual

func LessThanOrEqual(a, b Value) bool

A should be strictly less than B meaning for every asset in A, the amount of asset in B should be greater meaning loop over every A asset, because if there's an asset in a that's not in b, we need to fail but if there's an asset in b that's not in a, that's fine

Types

type AssetID

type AssetID string

func FromSeparate

func FromSeparate(policy string, assetName string) AssetID

func (AssetID) AssetName

func (a AssetID) AssetName() string

func (AssetID) AssetNameUTF8

func (a AssetID) AssetNameUTF8() (string, bool)

func (AssetID) HasAssetID

func (a AssetID) HasAssetID(re *regexp.Regexp) bool

func (AssetID) HasPolicyID

func (a AssetID) HasPolicyID(s string) bool

func (AssetID) IsZero

func (a AssetID) IsZero() bool

func (AssetID) MatchAssetName

func (a AssetID) MatchAssetName(re *regexp.Regexp) ([]string, bool)

func (AssetID) PolicyID

func (a AssetID) PolicyID() string

func (AssetID) String

func (a AssetID) String() string

type Coin

type Coin struct {
	AssetId AssetID
	Amount  num.Int
}

func CreateAdaCoin

func CreateAdaCoin(amt num.Int) Coin

type UtxoTxID

type UtxoTxID struct {
	ID string `json:"id"`
}

type Value

type Value map[string]map[string]num.Int

func Add

func Add(a Value, b Value) Value

func CreateAdaValue

func CreateAdaValue(amt int64) Value

func Subtract

func Subtract(a Value, b Value) Value

func ValueFromCoins

func ValueFromCoins(coins ...Coin) Value

func (Value) AdaLovelace

func (v Value) AdaLovelace() num.Int

func (*Value) AddAsset

func (v *Value) AddAsset(coins ...Coin)

func (Value) AssetAmount

func (v Value) AssetAmount(asset AssetID) num.Int

func (Value) AssetsExceptAda

func (v Value) AssetsExceptAda() Value

func (Value) AssetsExceptAdaCount

func (v Value) AssetsExceptAdaCount() uint32

func (Value) IsAdaPresent

func (v Value) IsAdaPresent() bool

Jump to

Keyboard shortcuts

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