Skip to main content

Clubs Configuration

Clubs configuration is way to maintain each clubs's state. It follow type description from @clubs-core library.

To add @clubs-core in you project

npm i @devprotocol/clubs-core

Follwing is the schema used for defining clubs's configuration.

ClubsConfiguration = Readonly<{
readonly name: string
readonly twitterHandle: string
readonly description: string
readonly url: string
readonly propertyAddress: string
readonly adminRolePoints: number
readonly chainId: number
readonly rpcUrl: string
readonly options?: ClubsPluginOptions
readonly plugins: readonly ClubsPlugin[]
}>
RequiredTypeDescription
nameRequiredstringIt is the clubs's name and is different from the domain name.It can be changed/edited unlike domain name
twitterHandlestringTwitter handle of the clubs.
descriptionstringDescription of the clubs.
urlRequiredstringURL of the clubs. The URL is in format <domain>.clubs.place
propertyAddressRequiredstringERC20 address of tokenized project a.k.a property tokens
adminRolePointsRequirednumberNumber of property tokens required to get admis rights of a clubs
chainIdRequirednumberChainId of the network on which the clubs is deployed
rpcUrlRequiredstringRPC URL of the network on which the clubs is deployed
optionsClubsPluginOptionsOptions for the plugins
pluginsRequiredreadonly ClubsPlugin[ ]List of plugins that are enabled for the clubs.

To access options value, loop over the options array and find the option with the required key.

import type { ClubsConfiguration } from '@devprotocol/clubs-core'
let config: ClubsConfiguration = {...}
const optionValue = config.options?.find(option => option.key === '<keyName>')?.value

For storing config in db in a serialized manner, @clubs-core also offer encode function and decode for vice-versa.

import { encode, decode } from '@devprotocol/clubs-core'


const config:ClubsConfiguration = {...}
const encoded = encode(config)
const decoded = decode(encoded)

ClubsPlugin

The ClubsPlugin type is a TypeScript type that represents a plugin for a club configuration. It is defined as a readonly object with the following properties.

ClubsPlugin = Readonly<{
readonly id: string
readonly enable?: boolean
readonly options: ClubsPluginOptions
}>
keytypedescription
idstringidentifies the plugin
enablebooleanenables/disables the plugin
optionsClubsPluginOptionsoptions for the plugin