RADON Type System

Pseudotypes

  • Any

  • Inner

  • Match

  • Same

  • Subscript

OP CodeNameDescription

0xFF

Fail

A catch-all used for matching.

0x00

Identity

Checks if the given argument matches the input RAD object both in type and value.

Fail

A catch-all used for matching.

Identity

Checks if the given argument matches the input RAD object both in type and value.

OP CodeTypeMethod NameMethod ParamsResponse

0x10

RADArray

none

RADInteger

0x11

RADArray

filter(Subscript)

Subscript

RADArray

0x13

RADArray

index

RADArray

0x14

RADArray

index

RADBoolean

0x15

RADArray

index

RADBytes

0x16

RADArray

index

RADFloat

0x17

RADArray

index

RADInteger

0x18

RADArray

index

RADMap

0x19

RADArray

index

RADString

0x1A

RADArray

Subscript

RADArray

0x1B

RADArray

Subscript

RADAnyType

0x22

RADBoolean

none

RADString

0x22

RADBoolean

none

RADBoolean

0x30

RADBytes

none

RADString

0x31

RADBytes

none

RADString

0x40

RADInteger

none

RADInteger

0x41

RADInteger

none

RADFloat

0x42

RADInteger

none

RADString

0x43

RADInteger

value

RADBoolean

0x44

RADInteger

value

RADBoolean

0x46

RADInteger

value

RADInteger

0x47

RADInteger

value

RADInteger

0x48

RADInteger

none

RADInteger

0x49

RADInteger

value

RADInteger

0x50

RADFloat

none

RADFloat

0x51

RADFloat

none

RADString

0x52

RADFloat

none

RADInteger

0x53

RADFloat

value

RADBoolean

0x54

RADFloat

none

RADInteger

0x55

RADFloat

value

RADBoolean

0x56

RADFloat

value

RADInteger

0x57

RADFloat

value

RADFloat

0x58

RADFloat

none

RADFloat

0x59

RADFloat

value

RADFloat

0x5B

RADFloat

none

RADInteger

0x5D

RADFloat

value

RADInteger

0x61

RADMap

key

RADArray

0x62

RADMap

key

RADBoolean

0x63

RADMap

key

RADBytes

0x64

RADMap

key

RADFloat

0x65

RADMap

key

RADInteger

0x66

RADMap

key

RADMap

0x67

RADMap

key

RADString

0x68

RADMap

none

RADArray

0x69

RADMap

none

RADArray

0x70

RADString

none

RADBoolean

0x72

RADString

none

RADFloat

0x73

RADString

none

RADInteger

0x74

RADString

none

RADInteger

0x75

RADString

value

RADBoolean

0x76

RADString

value

RADArray

0x77

RADString

value

RADMap

0x78

RADString

value

RADMap

0x79

RADString

none

RADString

0x7A

RADString

none

RADString

RADArray

RADArray.count()

The method count counts the number of elements in the input Array. There are no parameters.

RADArray.filter(Subscript)

The filter method discards the items in the input array that do not match the given filter subscript.

Example:

// Example Source data 
// {"data": [{"id": "one"},{"id": "two"},{"id": "three"}]}

// Retrieve a sublist from an array by applying a filter to each entry. 
Witnet.Source("https://...")
  .parseJSONMap()
  .getArray("data")
  .filter(
    new Witnet.Script([ Witnet.TYPES.MAP ])
      .getString("id")
      .match({ "one": true }, false )
  )
// Returns [{"id": "one"}]

RADArray.getArray(RADInteger)

The getArray method returns a RADArray object for the given index.

RADArray.getBoolean(RADInteger)

The getBoolean method returns a RADBoolean object for the given index.

RADArray.getBytes(RADInteger)

The getBytes method returns a RADBytes object for the given index.

RADArray.getFloat(RADInteger)

The getFloat method returns a RADFloat object for the given index.

RADArray.getInteger(RADInteger)

The getInteger method returns a RADInteger object for the given index.

RADArray.getMap(RADInteger)

The getMap method returns a RADMap structure for the given index.

RADArray.getString(RADInteger)

The getString method returns a RADBoolean object for the given index.

RADArray.map(Subscript)

The map method applies the given subscript on all the elements in the input Array.

RADArray.reduce(Subscript)

The reduce method reduces all the items in the input Array into a single item by applying a reducer function.

RADBoolean

RADBoolean.asString()

The asString method represents the input Boolean value as a string.

e.g. "True" or "False"

RADBoolean.negate()

The negate method reverses the input Boolean.

It returns "True" if the value is "False", and returns "False" if the value is "True".

RADBytes

RADBytes.asString()

The asString method returns the input Bytes as a hexadecimal String.

RADBytes.hash()

The hash method computes the SHA256 hash in the input Bytes.

RADInteger

RADInteger.absolute()

The absolute method Calculates the absolute value of the input Integer.

RADInteger.asFloat()

The asFloat method Returns the input Integer as a Float.

RADInteger.asString()

The asString method Returns the input Integer as a String.

RADInteger.greaterThan(RADInteger)

The greaterThan method Checks if the input Integer is greater than the given argument.

RADInteger.lessThan(RADInteger)

The lessThan method checks if the input Integer is less than the given argument.

RADInteger.modulo(RADInteger)

The modulo method calculates the integer division of the input Integer

RADInteger.multiply(RADInteger)

The multiply method multiplies the input Integer by the given factor.

RADInteger.negate()

The negate method calculates the negative of the input Integer.

RADInteger.power(RADInteger)

The power method calculates the input raise to the power of the given exponent.

RADFloat

RADFloat.absolute()

The absolute method computes the absolute value of the input Float.

RADFloat.asString()

The asString method returns the input Float as a String.

RADFloat.ceiling()

The ceiling method computes the lowest Integer value greater than or equal to the input Float.

RADFloat.greaterThan()

The greaterThan method compares if the input Float is greater than the provided input.

RADFloat.floor()

The floor method computes the greatest Integer less than or equal to the input Float.

RADFloat.lessThan()

The lessThan method compares if the input Float is less than the provided argument.

RADFloat.modulo()

The modulo method computes the division of the input Float.

RADFloat.multiply(RADFloat)

The multiply method multiplies the input Float by the given factor.

RADFloat.negate()

The negate method computes the negative of the input Float.

RADFloat.power()

The power method computes the input Float raised to the power of the provided exponent.

RADFloat.round()

The round method rounds the Integer part from the input Float.

RADFloat.truncate()

The truncate method takes the Integer part from the input Float.

RADMap

RADMap.getArray(RADString)

The getArray method returns an Array structure.

RADMap.getBoolean(RADString)

The getBoolean method returns a Boolean.

RADMap.getBytes(RADString)

The getBytes method returns an array of Bytes.

RADMap.getFloat(RADString)

The getFloat method returns a Float.

RADMap.getInteger(RADString)

The getInteger method returns an Integer

RADMap.getMap(RADString)

The getMap method returns a Map structure.

RADMap.getString(RADString)

The getString method returns a String.

RADMap.keys()

The keys method obtains a list with the key names of the input Map.

RADMap.valuesAsArray()

The valuesAsArray method obtains a list with the values of the input Map.

RADString

RADString.asBoolean()

The asBoolean method parses the input String as a Boolean value.

There are no method parameters and it returns a RADBoolean.

RADString.asFloat()

The asFloat method parses the input String as a Float value.

There are no method parameters.

RADString.asInteger()

The asInteger method parses the input String as an Integer value.

There are no method parameters.

RADString.length()

The length method counts the number of characters of the input String.

There are no method parameters.

RADString.match(RADString)

The match method matches the input String with the given subscript and returns a Boolean value.

Method Params:

String value

RADString.parseJSONArray(RADString)

The parseJSONArray method interprets the input String as a JSON-encoded Array.

Method Params:

String value The input value must be a valid JSON Array or it will return an JsonParse error.

RADString.parseJSONMap(RADString)

The parseJSONMap method interprets the input String as a JSON-encoded Map.

Method Params:

String value The input value must be a valid JSON-encoded Map or it will return a JsonParse error.

RADString.parseXMLMap(RADString)

The parseXMLMap method interprets the input String as an XML-encoded Map.

Method Params:

String value The input value must be a valid XML-encoded Map or it will return a JsonParse error.

RADString.toLowerCase()

The toLowerCase method converts the input String to lowercase.

RADString.toUpperCase()

The toUpperCase method converts the input String to uppercase.

Last updated