Documentation
¶
Index ¶
- Constants
- Variables
- func IsInsufficientFundError(err error) bool
- func IsMetadataOverride(err error) bool
- func NewStringFromValue(value Value) (string, error)
- func ParseMonetary(mon Monetary) error
- func ValidateAccountAddress(acc AccountAddress) error
- func ValidateAsset(ass Asset) error
- func ValidatePortionSpecific(p Portion) error
- func ValueEquals(lhs, rhs Value) bool
- type AccountAddress
- type Address
- type Addresses
- type Allotment
- type Asset
- type ErrInsufficientFund
- type ErrInvalidScript
- type ErrInvalidVars
- type ErrMetadataOverride
- type ErrMissingMetadata
- type ErrNegativeAmount
- type Funding
- func (f Funding) Concat(other Funding) (Funding, error)
- func (lhs Funding) Equals(rhs Funding) bool
- func (f Funding) GetAsset() Asset
- func (Funding) GetType() Type
- func (f Funding) Reverse() Funding
- func (f Funding) String() string
- func (f Funding) Take(amount *MonetaryInt) (Funding, Funding, error)
- func (f Funding) TakeMax(amount *MonetaryInt) (Funding, Funding)
- func (f Funding) Total() *MonetaryInt
- type FundingPart
- type HasAsset
- type Monetary
- type MonetaryInt
- func (a *MonetaryInt) Add(b *MonetaryInt) *MonetaryInt
- func (a *MonetaryInt) Cmp(b *MonetaryInt) int
- func (a *MonetaryInt) Eq(b *MonetaryInt) bool
- func (a *MonetaryInt) Equal(b *MonetaryInt) bool
- func (MonetaryInt) GetType() Type
- func (a *MonetaryInt) Gt(b *MonetaryInt) bool
- func (a *MonetaryInt) Gte(b *MonetaryInt) bool
- func (a *MonetaryInt) Lt(b *MonetaryInt) bool
- func (a *MonetaryInt) Lte(b *MonetaryInt) bool
- func (a *MonetaryInt) Ltz() bool
- func (a *MonetaryInt) MarshalJSON() ([]byte, error)
- func (a *MonetaryInt) MarshalText() ([]byte, error)
- func (a *MonetaryInt) Neg() *MonetaryInt
- func (a *MonetaryInt) OrZero() *MonetaryInt
- func (a *MonetaryInt) String() string
- func (a *MonetaryInt) Sub(b *MonetaryInt) *MonetaryInt
- func (a *MonetaryInt) Uint64() uint64
- func (a *MonetaryInt) UnmarshalJSON(b []byte) error
- func (a *MonetaryInt) UnmarshalText(b []byte) error
- type Number
- type Portion
- type String
- type Type
- type Value
- type ValueJSON
Constants ¶
View Source
const ( TypeAccount = Type(iota + 1) // address of an account TypeAsset // name of an asset TypeNumber // 64bit unsigned integer TypeString // string TypeMonetary // [asset number] TypePortion // rational number between 0 and 1 both inclusive TypeAllotment // list of portions TypeAmount // either ALL or a SPECIFIC number TypeFunding // (asset, []{amount, account}) )
Variables ¶
View Source
var ( ErrScriptFailed = errors.New("script exited with error code") ErrResourcesNotInitialized = errors.New("resources not initialized") ErrBalancesNotInitialized = errors.New("balances not initialized") ErrResourceNotFound = errors.New("resource not found") )
View Source
var Zero = NewMonetaryInt(0)
Functions ¶
func IsInsufficientFundError ¶
func IsMetadataOverride ¶
func NewStringFromValue ¶
func ParseMonetary ¶
func ValidateAccountAddress ¶
func ValidateAccountAddress(acc AccountAddress) error
func ValidateAsset ¶
func ValidatePortionSpecific ¶
func ValueEquals ¶
Types ¶
type AccountAddress ¶
type AccountAddress string
func (AccountAddress) GetType ¶
func (AccountAddress) GetType() Type
func (AccountAddress) String ¶
func (a AccountAddress) String() string
type Address ¶
type Address uint16
Address represents an address in the machine's resources, which include constants (literals) and variables passed to the program
func NewAddress ¶
type Allotment ¶
func NewAllotment ¶
func (Allotment) Allocate ¶
func (a Allotment) Allocate(amount *MonetaryInt) []*MonetaryInt
type ErrInsufficientFund ¶
type ErrInsufficientFund struct {
// contains filtered or unexported fields
}
func NewErrInsufficientFund ¶
func NewErrInsufficientFund(f string, args ...any) *ErrInsufficientFund
func (*ErrInsufficientFund) Error ¶
func (e *ErrInsufficientFund) Error() string
func (*ErrInsufficientFund) Is ¶
func (e *ErrInsufficientFund) Is(err error) bool
type ErrInvalidScript ¶
type ErrInvalidScript struct {
// contains filtered or unexported fields
}
func NewErrInvalidScript ¶
func NewErrInvalidScript(f string, args ...any) *ErrInvalidScript
func (*ErrInvalidScript) Error ¶
func (e *ErrInvalidScript) Error() string
func (*ErrInvalidScript) Is ¶
func (e *ErrInvalidScript) Is(err error) bool
type ErrInvalidVars ¶
type ErrInvalidVars struct {
// contains filtered or unexported fields
}
func NewErrInvalidVars ¶
func NewErrInvalidVars(f string, args ...any) *ErrInvalidVars
func (*ErrInvalidVars) Error ¶
func (e *ErrInvalidVars) Error() string
func (*ErrInvalidVars) Is ¶
func (e *ErrInvalidVars) Is(err error) bool
type ErrMetadataOverride ¶
type ErrMetadataOverride struct {
// contains filtered or unexported fields
}
func NewErrMetadataOverride ¶
func NewErrMetadataOverride(key string) *ErrMetadataOverride
func (*ErrMetadataOverride) Error ¶
func (e *ErrMetadataOverride) Error() string
func (*ErrMetadataOverride) Is ¶
func (e *ErrMetadataOverride) Is(err error) bool
type ErrMissingMetadata ¶
type ErrMissingMetadata struct {
// contains filtered or unexported fields
}
func NewErrMissingMetadata ¶
func NewErrMissingMetadata(f string, args ...any) *ErrMissingMetadata
func (*ErrMissingMetadata) Error ¶
func (e *ErrMissingMetadata) Error() string
func (*ErrMissingMetadata) Is ¶
func (e *ErrMissingMetadata) Is(err error) bool
type ErrNegativeAmount ¶
type ErrNegativeAmount struct {
// contains filtered or unexported fields
}
func NewErrNegativeAmount ¶
func NewErrNegativeAmount(f string, args ...any) *ErrNegativeAmount
func (*ErrNegativeAmount) Error ¶
func (e *ErrNegativeAmount) Error() string
func (*ErrNegativeAmount) Is ¶
func (e *ErrNegativeAmount) Is(err error) bool
type Funding ¶
type Funding struct { Asset Asset Parts []FundingPart }
func (Funding) Total ¶
func (f Funding) Total() *MonetaryInt
type FundingPart ¶
type FundingPart struct { Amount *MonetaryInt Account AccountAddress }
func (FundingPart) Equals ¶
func (lhs FundingPart) Equals(rhs FundingPart) bool
type Monetary ¶
type Monetary struct { Asset Asset `json:"asset"` Amount *MonetaryInt `json:"amount"` }
type MonetaryInt ¶
func NewMonetaryInt ¶
func NewMonetaryInt(i int64) *MonetaryInt
func NewMonetaryIntFromBigInt ¶
func NewMonetaryIntFromBigInt(v *big.Int) *MonetaryInt
func ParseMonetaryInt ¶
func ParseMonetaryInt(s string) (*MonetaryInt, error)
func (*MonetaryInt) Add ¶
func (a *MonetaryInt) Add(b *MonetaryInt) *MonetaryInt
func (*MonetaryInt) Cmp ¶
func (a *MonetaryInt) Cmp(b *MonetaryInt) int
func (*MonetaryInt) Eq ¶
func (a *MonetaryInt) Eq(b *MonetaryInt) bool
func (*MonetaryInt) Equal ¶
func (a *MonetaryInt) Equal(b *MonetaryInt) bool
func (MonetaryInt) GetType ¶
func (MonetaryInt) GetType() Type
func (*MonetaryInt) Gt ¶
func (a *MonetaryInt) Gt(b *MonetaryInt) bool
func (*MonetaryInt) Gte ¶
func (a *MonetaryInt) Gte(b *MonetaryInt) bool
func (*MonetaryInt) Lt ¶
func (a *MonetaryInt) Lt(b *MonetaryInt) bool
func (*MonetaryInt) Lte ¶
func (a *MonetaryInt) Lte(b *MonetaryInt) bool
func (*MonetaryInt) Ltz ¶
func (a *MonetaryInt) Ltz() bool
func (*MonetaryInt) MarshalJSON ¶
func (a *MonetaryInt) MarshalJSON() ([]byte, error)
func (*MonetaryInt) MarshalText ¶
func (a *MonetaryInt) MarshalText() ([]byte, error)
func (*MonetaryInt) Neg ¶
func (a *MonetaryInt) Neg() *MonetaryInt
func (*MonetaryInt) OrZero ¶
func (a *MonetaryInt) OrZero() *MonetaryInt
func (*MonetaryInt) String ¶
func (a *MonetaryInt) String() string
func (*MonetaryInt) Sub ¶
func (a *MonetaryInt) Sub(b *MonetaryInt) *MonetaryInt
func (*MonetaryInt) Uint64 ¶
func (a *MonetaryInt) Uint64() uint64
func (*MonetaryInt) UnmarshalJSON ¶
func (a *MonetaryInt) UnmarshalJSON(b []byte) error
func (*MonetaryInt) UnmarshalText ¶
func (a *MonetaryInt) UnmarshalText(b []byte) error
type Portion ¶
func NewPortionRemaining ¶
func NewPortionRemaining() Portion
func ParsePortionSpecific ¶
type ValueJSON ¶
type ValueJSON struct { Type string `json:"type"` Value json.RawMessage `json:"value"` }
Source Files
¶
Click to show internal directories.
Click to hide internal directories.