Value
Manipulate Cardano Value Easily
We all know the pain of conducting Value operation in Cardano. Mesh provides a full set of value methods to help converting, operating, accessing and comparing Cardano data.
Value Types Support
Convertors
Convertor functions provide utilities around round trip among Cardano onchain data and off chain JSON and Data type.
Operators
Operator functions provide utilities into performing value manipulation. They are useful in DApps which check against value payment involving calculation in value.
Accessor
Accessor functions provide utilities in obtaining keys or values of the Value type.
Comparator
Comparator functions provide utilities in comparing different Value. It helps with offchain validation before using for transaction building.
Convertor - converts assets into Cardano data Value in JSON
value converts assets into Cardano data Value in JSON with parameters:
- assets - Asset[] to convert
Converts assets into MeshValue with parameters - asset[] e.g. ada value, simple token token, complex value.
Convertor - converts assets into Cardano data Value in Mesh Data type
mValue converts assets into Cardano data value in Mesh Data type with parameters:
- assets - Asset[] to convert
Converts assets into MeshValue with parameters - asset[] e.g. ada value, simple token token, complex value.
Convertor - converts assets into MeshValue with parameters - asset[]
fromAssets converts assets into MeshValue with parameters:
- assets - the assets to convert
Converts assets into MeshValue with parameters - asset[] e.g. ada value, simple token token, complex value.
Convertor - converts the MeshValue object into an array of Asset
toAssets Convert the MeshValue object into an array of Asset
Converts the MeshValue object into an array of Asset
Convertor - converts Value (the JSON representation of Cardano data Value) into MeshValue
fromValue Convert Value (the JSON representation of Cardano data Value) into MeshValue with parameters:
- plutusValue - the value to convert
Convert Value (the JSON representation of Cardano data Value) into MeshValue.
Convertor - converts the MeshValue object into Cardano data Value in Mesh Data type
toData Convert the MashValue object into Cardano data Value in Mesh Data type
Converts the MeshValue object into Cardano data Value in Mesh Data type
Convertor - converts the MeshValue object into a JSON representation of Cardano data Value
toJSON Converts the MeshValue object into a JSON representation of Cardano data Value
Converts the MeshValue object into a JSON representation of Cardano data Value
Operator - add an asset to the Value class's value record with parameters - asset
addAsset Add an asset to the Value class's value record with parameters:
- asset - Asset to add
Add an asset to the Value class's value record with parameters - asset
Operator - add an array of assets to the Value class's value record with parameters - assets
addAssets Add an array of assets to the Value class's value record with parameters:
- assets - Asset[] to add
Add an array of assets to the Value class's value record with parameters - assets
Operator - substract an asset from the Value class's value record with parameters - asset
negateAsset Substract an asset from the Value class's value record with parameters:
- asset - Asset to substract
Substract an asset from the Value class's value record with parameters - asset
Operator - substract an array of assets from the Value class's value record with parameters - assets
negateAssets Substract an array of assets from the Value class's value record with parameters:
- assets - Asset[] to substract
Substract an array of assets from the Value class's value record with parameters - assets
Operator - merge the given values with parameters - values
merge Merge the given values
- values - The other values to merge
Merge the given values with parameters - values
Accessor - get the quantity of asset object per lovelace unit
get get the quantity of asset object per unit, with parameters
- unit - the unit to get the quantity of the assets e.g. lovelace
Get the quantity of asset object per unit
Accessor - get all asset units with no parameters needed
units get all asset units with no parameters (e.g. unit) needed
Get all asset units with no parameters needed
Comparator - check if the value is greater than or equal to another value with parameters - other
geq Check if the value is greater than or equal to another value with parameters:
- other - The MeshValue to compare against
Check if the value is greater than or equal to another value with parameters - other
Comparator - check if the value is greater than or equal to another value with parameters - unit, other
geqUnit Check if the value is greater than or equal to another value with parameters:
- unit - The unit to compare
- other - The MeshValue to compare against
Check if the value is greater than or equal to another value with parameters - unit, other
Comparator - check if the value is less than or equal to another value with parameters - other
leq Check if the value is less than or equal to another value with parameters:
- other - The MeshValue to compare against
Check if the value is less than or equal to another value with parameters - other
Comparator - check if the specific unit of value is less than or equal to that unit of another value with parameters - unit, other
leqUnit Check if the specific unit of value is less than or equal to that unit of another value with parameters:
- unit - The unit to compare
- other - The MeshValue to compare against
Check if the specific unit of value is less than or equal to that unit of another value with parameters - unit, other
Comparator - check if the value is empty
isEmpty Check if the value is empty
Check if the value is empty