AnchorQueryOptions

AnchorQueryOptions

Class where query parameters for Anchor API are defined.

Constructor

new AnchorQueryOptions(size, fromTimestamp, toTimestamp, cursor)

Creates an instance of AnchorQueryOptions.

Example
const options = new caver.kas.anchor.queryOptions(size, fromTimestamp, toTimestamp, cursor)
Parameters:
Name Type Description
size number

Maximum number of data to query.

fromTimestamp number | string | Date

The starting date of the data to be queried.

toTimestamp number | string | Date

The ending date of the data to be queried.

cursor string

Information of the last retrieved cursor.

Members

size :number

Type:
  • number

fromTimestamp :Date

Type:
  • Date

toTimestamp :Date

Type:
  • Date

cursor :string

Type:
  • string

Methods

(static) constructFromObject(obj) → {AnchorQueryOptions}

Create an instance of AnchorQueryOptions from object.
You can use object instead of AnchorQueryOptions instance when using caver.kas.anchor.
Because the function of caver.kas.anchor internally converts object to AnchorQueryOptions instance, and when converting, validation of the field defined inside Object is performed.

Example
const options = caver.kas.anchor.queryOptions.constructFromObject({ size, cursor, ... })
Parameters:
Name Type Description
obj object

An object where query parameters are defined.

Returns:
Type
AnchorQueryOptions

isValidOptions(options) → {boolean}

Make sure that only essential ones are defined for the option values defined in AnchorQueryOptions.

Example
const options = caver.kas.anchor.queryOptions.constructFromObject({ ... })
const isValid = options.isValidOptions(['size', 'cursor'])
Parameters:
Name Type Description
options Array.<string>

An array containing the names of options used in the function.

Returns:
Type
boolean