ConsumerParameterBuilder
Builder class used to build custom parameters.
Consumer parameters are key/value pairs which can be provided during service consumption. Official OceanProtocol Consumer Parameters documentation
Usage
import { ConsumerParameterBuilder, ServiceBuilder, ServiceTypes, FileTypes } from '@deltadao/nautilus'
const consumerParameterBuilder = new ConsumerParameterBuilder()
const numberParameter = consumerParameterBuilder
.setType('number')
.setName('numberEntries')
.setLabel('Number of Entries')
.setDescription('Set the number of entries used for computation.')
.setDefault(12)
.setRequired(false)
.build()
const builder = new ServiceBuilder({ serviceType: ServiceTypes.ACCESS, fileType: FileTypes.URL})
const service = builder.addConsumerParameter(numberParameter)
We can use the ServiceBuilder
in combination with the ConsumerParameterBuilder
to add the parameter to the service metadata.
The supported types of parameters are 'text'
, 'number'
, 'boolean'
and 'select'
.