Documentation ¶
Index ¶
- Constants
- Variables
- func AliasIDFromAliasOutput(out *iotago.AliasOutput, outID iotago.OutputID) iotago.AliasID
- func BaseTokensDecimalsToEthereumDecimals(value uint64, baseTokenDecimals uint32) *big.Int
- func CloneMap[K comparable, T Cloneable[T]](base map[K]T) map[K]T
- func CloneSlice[T Cloneable[T]](base []T) []T
- func CreateDirectoryForFilePath(filePath string, perm os.FileMode) error
- func DecodeHexBinaryMarshaled(dataHex string, value encoding.BinaryUnmarshaler) error
- func DecodeSliceHexBinaryMarshaled[M encoding.BinaryUnmarshaler](dataHex []string, values []M) error
- func EncodeHexBinaryMarshaled(value encoding.BinaryMarshaler) (string, error)
- func EncodeSliceHexBinaryMarshaled[M encoding.BinaryMarshaler](values []M) ([]string, error)
- func EthereumDecimalsToBaseTokenDecimals(value *big.Int, baseTokenDecimals uint32) uint64
- func ExecuteIfNotNil(function func())
- func ExistsFilePath(filePath string) (bool, error)
- func GentleTruncate(s string, length int) string
- func GetHashValue(obj interface{ ... }) hashing.HashValue
- func IsSlug(s string) bool
- func IsZeroBigInt(bi *big.Int) bool
- func MakeRange(from, to int) []int
- func MinUint64(a, b uint64) uint64
- func MustTokenScheme(tokenScheme iotago.TokenScheme) *iotago.SimpleTokenScheme
- func NFTIDFromNFTOutput(nftOutput *iotago.NFTOutput, outputID iotago.OutputID) iotago.NFTID
- func NewPseudoRand(seed ...int64) *rand.Rand
- func OutputFromBytes(data []byte) (iotago.Output, error)
- func PrefixHex(data []byte, prefixLen int) string
- func Same[V Equated[V]](a, b []V) bool
- func SliceShortString[E ShortStringable](slice []E) string
- func TerminateCmdWhenTestStops(cmd *exec.Cmd)
- func TimeOrNever(t time.Time) string
- func TimeOrNever2(t time.Time, never string) string
- func ToBigInt(i interface{}) *big.Int
- func ValidPermutation(perm []uint16) bool
- type BitVector
- type Cloneable
- type ComparableAddress
- type ComparableString
- type Equated
- type Permutation16
- type Ratio32
- func (ratio Ratio32) Bytes() []byte
- func (ratio Ratio32) HasZeroComponent() bool
- func (ratio Ratio32) IsValid() bool
- func (ratio Ratio32) IsZero() bool
- func (ratio *Ratio32) Read(r io.Reader) error
- func (ratio *Ratio32) Set(s string) error
- func (ratio Ratio32) String() string
- func (ratio Ratio32) Type() string
- func (ratio *Ratio32) Write(w io.Writer) error
- func (ratio Ratio32) XCeil64(y uint64) uint64
- func (ratio Ratio32) XFloor64(y uint64) uint64
- func (ratio Ratio32) YCeil64(x uint64) uint64
- func (ratio Ratio32) YFloor64(x uint64) uint64
- type ShortStringable
- type SliceStruct
- func (s *SliceStruct[E]) Add(elem E)
- func (s *SliceStruct[E]) Clone() *SliceStruct[E]
- func (s *SliceStruct[E]) CloneDeep(cloneFun func(E) E) *SliceStruct[E]
- func (s *SliceStruct[E]) ContainsBy(fun func(E) bool) bool
- func (s *SliceStruct[E]) Find(fun func(E) bool) (E, bool)
- func (s *SliceStruct[E]) ForEach(forEachFun func(int, E) bool) bool
- func (s *SliceStruct[E]) Get(index int) E
- func (s *SliceStruct[E]) Length() int
- func (s *SliceStruct[E]) Set(index int, elem E)
- type Timer
Constants ¶
const RatioByteSize = serializer.UInt32ByteSize + serializer.UInt32ByteSize
A + B
const WindowsOS = "windows"
Variables ¶
Functions ¶
func AliasIDFromAliasOutput ¶ added in v0.3.0
func BaseTokensDecimalsToEthereumDecimals ¶ added in v0.3.6
base tokens => wei
func CloneMap ¶ added in v1.0.3
func CloneMap[K comparable, T Cloneable[T]](base map[K]T) map[K]T
CloneMap clones every element in the the map into cloned and returns the cloned map.
func CloneSlice ¶ added in v1.0.3
func CloneSlice[T Cloneable[T]](base []T) []T
CloneSlice clones every element in the the slice into cloned and returns the cloned slice.
func CreateDirectoryForFilePath ¶ added in v1.0.3
func DecodeHexBinaryMarshaled ¶ added in v1.0.3
func DecodeHexBinaryMarshaled(dataHex string, value encoding.BinaryUnmarshaler) error
func DecodeSliceHexBinaryMarshaled ¶ added in v1.0.3
func DecodeSliceHexBinaryMarshaled[M encoding.BinaryUnmarshaler](dataHex []string, values []M) error
func EncodeHexBinaryMarshaled ¶ added in v1.0.3
func EncodeHexBinaryMarshaled(value encoding.BinaryMarshaler) (string, error)
func EncodeSliceHexBinaryMarshaled ¶ added in v1.0.3
func EncodeSliceHexBinaryMarshaled[M encoding.BinaryMarshaler](values []M) ([]string, error)
func EthereumDecimalsToBaseTokenDecimals ¶ added in v0.3.6
wei => base tokens
func ExecuteIfNotNil ¶ added in v1.0.3
func ExecuteIfNotNil(function func())
func ExistsFilePath ¶ added in v0.1.0
ExistsFilePath returns whether the given file or directory exists.
func GentleTruncate ¶ added in v0.1.0
func GetHashValue ¶
func IsZeroBigInt ¶ added in v0.3.0
func MakeRange ¶ added in v0.2.0
MakeRange returns slice with a range of elements starting from to up to-1, inclusive
func MustTokenScheme ¶ added in v0.3.0
func MustTokenScheme(tokenScheme iotago.TokenScheme) *iotago.SimpleTokenScheme
func NFTIDFromNFTOutput ¶ added in v0.3.0
func NewPseudoRand ¶ added in v1.0.3
func Same ¶ added in v1.0.3
Checks two slices, if they represent the same sets (same elements, maybe a different order).
func SliceShortString ¶ added in v1.0.3
func SliceShortString[E ShortStringable](slice []E) string
func TerminateCmdWhenTestStops ¶ added in v0.3.0
func TimeOrNever ¶ added in v1.0.3
func ValidPermutation ¶
Types ¶
type BitVector ¶ added in v0.3.0
type BitVector interface { SetBits(positions []int) BitVector AsInts() []int Bytes() []byte Read(r io.Reader) error Write(w io.Writer) error }
func FixedSizeBitVectorFromBytes ¶ added in v1.0.3
func NewFixedSizeBitVector ¶ added in v0.3.0
type ComparableAddress ¶ added in v1.0.3
type ComparableAddress struct {
// contains filtered or unexported fields
}
func NewComparableAddress ¶ added in v1.0.3
func NewComparableAddress(address iotago.Address) *ComparableAddress
func (*ComparableAddress) Address ¶ added in v1.0.3
func (c *ComparableAddress) Address() iotago.Address
func (*ComparableAddress) Key ¶ added in v1.0.3
func (c *ComparableAddress) Key() string
func (*ComparableAddress) String ¶ added in v1.0.3
func (c *ComparableAddress) String() string
type ComparableString ¶ added in v1.0.3
type ComparableString string
func (ComparableString) Key ¶ added in v1.0.3
func (c ComparableString) Key() string
func (ComparableString) String ¶ added in v1.0.3
func (c ComparableString) String() string
type Permutation16 ¶
type Permutation16 struct {
// contains filtered or unexported fields
}
Permutation16 deterministic permutation of integers from 0 to size-1
func NewPermutation16 ¶
func NewPermutation16(size uint16, seedOptional ...int64) (*Permutation16, error)
HINT: Seed should only be provided in tests to obtain predicted test results. If used in production, the seed should not be set, because it will be generated using cryptographically secure random number generator. The seed itself will be used to initialize a pseudo random number generator which is used to shuffle the permutations. Unless the permutations must be exactly the same between different calls (probable from different nodes). In the latter case, the seed should be the same for all the calls which expect the same permutation. This function always returns a permutation; error should be considered as a warning that permutation was seeded incorrectly.
func (*Permutation16) Current ¶
func (perm *Permutation16) Current() uint16
func (*Permutation16) ForEach ¶ added in v0.3.0
func (perm *Permutation16) ForEach(f func(i uint16) bool)
func (*Permutation16) GetArray ¶
func (perm *Permutation16) GetArray() []uint16
func (*Permutation16) Next ¶
func (perm *Permutation16) Next() uint16
func (*Permutation16) NextNoCycles ¶ added in v0.3.0
func (perm *Permutation16) NextNoCycles() uint16
If the whole permutation is obtained, reshuffles it to avoid cycles
func (*Permutation16) Shuffle ¶
func (perm *Permutation16) Shuffle() *Permutation16
type Ratio32 ¶ added in v0.3.0
type Ratio32 struct { A uint32 `json:"a" swagger:"min(0),required"` B uint32 `json:"b" swagger:"min(0),required"` }
Ratio32 represents a ratio (a:b) between two quantities, expressed as two uint32 values.
func Ratio32FromBytes ¶ added in v0.3.0
func Ratio32FromString ¶ added in v1.0.3
func (Ratio32) HasZeroComponent ¶ added in v1.0.3
func (*Ratio32) Set ¶ added in v0.3.0
Set is part of the pflag.Value interface. It accepts a string in the form "a:b".
type ShortStringable ¶ added in v1.0.3
type ShortStringable interface {
ShortString() string
}
type SliceStruct ¶ added in v1.0.3
type SliceStruct[E any] struct { // contains filtered or unexported fields }
Putting slice into a map is not acceptable as if you want to append to slice, you'll have to re-include the appended slice into the map.
func NewSliceStruct ¶ added in v1.0.3
func NewSliceStruct[E any](elems ...E) *SliceStruct[E]
func NewSliceStructLength ¶ added in v1.0.3
func NewSliceStructLength[E any](length int) *SliceStruct[E]
func NewSliceStructLengthCapacity ¶ added in v1.0.3
func NewSliceStructLengthCapacity[E any](length, capacity int) *SliceStruct[E]
func (*SliceStruct[E]) Add ¶ added in v1.0.3
func (s *SliceStruct[E]) Add(elem E)
func (*SliceStruct[E]) Clone ¶ added in v1.0.3
func (s *SliceStruct[E]) Clone() *SliceStruct[E]
Returns a reference to new SliceStruct with exactly the same elements
func (*SliceStruct[E]) CloneDeep ¶ added in v1.0.3
func (s *SliceStruct[E]) CloneDeep(cloneFun func(E) E) *SliceStruct[E]
Returns a reference to new SliceStruct with every element of the old SliceStruct cloned using provided function
func (*SliceStruct[E]) ContainsBy ¶ added in v1.0.3
func (s *SliceStruct[E]) ContainsBy(fun func(E) bool) bool
func (*SliceStruct[E]) Find ¶ added in v1.0.3
func (s *SliceStruct[E]) Find(fun func(E) bool) (E, bool)
func (*SliceStruct[E]) ForEach ¶ added in v1.0.3
func (s *SliceStruct[E]) ForEach(forEachFun func(int, E) bool) bool
func (*SliceStruct[E]) Get ¶ added in v1.0.3
func (s *SliceStruct[E]) Get(index int) E
func (*SliceStruct[E]) Length ¶ added in v1.0.3
func (s *SliceStruct[E]) Length() int
func (*SliceStruct[E]) Set ¶ added in v1.0.3
func (s *SliceStruct[E]) Set(index int, elem E)