Skip to content

Latest commit

 

History

History
445 lines (248 loc) · 14.1 KB

File metadata and controls

445 lines (248 loc) · 14.1 KB

Defined in: packages/enduser/src/CommunityClient.ts:27

Client for Community Managers (ROLE_COMMUNITY)

Extends

Constructors

Constructor

new CommunityClient(config): CommunityClient

Defined in: packages/enduser/src/CommunityClient.ts:32

Parameters

Parameter Type
config CommunityClientConfig

Returns

CommunityClient

Overrides

BaseClient.constructor

Properties

client

client: WalletClient

Defined in: packages/core/src/clients/BaseClient.ts:6

Inherited from

BaseClient.client


entryPointAddress?

protected optional entryPointAddress: `0x${string}`

Defined in: packages/core/src/clients/BaseClient.ts:12

Inherited from

BaseClient.entryPointAddress


factoryAddress?

optional factoryAddress: `0x${string}`

Defined in: packages/enduser/src/CommunityClient.ts:29


gTokenAddress?

protected optional gTokenAddress: `0x${string}`

Defined in: packages/core/src/clients/BaseClient.ts:9

Inherited from

BaseClient.gTokenAddress


gTokenStakingAddress?

protected optional gTokenStakingAddress: `0x${string}`

Defined in: packages/core/src/clients/BaseClient.ts:10

Inherited from

BaseClient.gTokenStakingAddress


paymasterFactoryAddress?

protected optional paymasterFactoryAddress: `0x${string}`

Defined in: packages/core/src/clients/BaseClient.ts:11

Inherited from

BaseClient.paymasterFactoryAddress


publicClient?

optional publicClient: PublicClient

Defined in: packages/core/src/clients/BaseClient.ts:7

Inherited from

BaseClient.publicClient


registryAddress?

protected optional registryAddress: `0x${string}`

Defined in: packages/core/src/clients/BaseClient.ts:8

Inherited from

BaseClient.registryAddress


reputationAddress?

optional reputationAddress: `0x${string}`

Defined in: packages/enduser/src/CommunityClient.ts:30


sbtAddress?

optional sbtAddress: `0x${string}`

Defined in: packages/enduser/src/CommunityClient.ts:28

Methods

airdropSBT()

airdropSBT(users, roleId, options?): Promise<`0x${string}`>

Defined in: packages/enduser/src/CommunityClient.ts:309

Airdrop SBTs to users to make them members

Parameters

Parameter Type
users `0x${string}`[]
roleId bigint
options? TransactionOptions

Returns

Promise<`0x${string}`>


createCommunityToken()

createCommunityToken(params, options?): Promise<`0x${string}`>

Defined in: packages/enduser/src/CommunityClient.ts:50

Create a new Community Token (xPNTs) and register it. Note: In the current architecture, creating a community often involves:

  1. Registering the ROLE_COMMUNITY on Registry (if not exists) -> usually manual or self-register
  2. Deploying a Token (xPNTs) via Factory
  3. Linking the Token to the Community in Registry

Parameters

Parameter Type
params CreateCommunityParams
options? TransactionOptions

Returns

Promise<`0x${string}`>


getAddress()

getAddress(): `0x${string}`

Defined in: packages/core/src/clients/BaseClient.ts:34

Get the account address of the connected wallet

Returns

`0x${string}`

Inherited from

BaseClient.getAddress


getCommunityInfo()

getCommunityInfo(communityAddress?): Promise<{ description: string; ensName: string; logoURI: string; name: string; stakeAmount: bigint; website: string; }>

Defined in: packages/enduser/src/CommunityClient.ts:76

Get Community Details (Decodes Role Metadata)

Parameters

Parameter Type Description
communityAddress? `0x${string}` The address of the community manager (defaults to self)

Returns

Promise<{ description: string; ensName: string; logoURI: string; name: string; stakeAmount: bigint; website: string; }>


getStartPublicClient()

getStartPublicClient(): PublicClient | WalletClient<Transport, Chain | undefined, Account | undefined>

Defined in: packages/core/src/clients/BaseClient.ts:41

Helper to ensure public client exists or fallback to wallet client (if it supports read)

Returns

PublicClient | WalletClient<Transport, Chain | undefined, Account | undefined>

Inherited from

BaseClient.getStartPublicClient


registerAsCommunity()

registerAsCommunity(params, options?): Promise<`0x${string}`>

Defined in: packages/enduser/src/CommunityClient.ts:166

Register self as a Community Manager. This method handles all necessary steps:

  1. Checks and approves GToken to GTokenStaking
  2. Encodes CommunityRoleData with provided parameters
  3. Calls registerRoleSelf on Registry

Parameters

Parameter Type Description
params { description?: string; ensName?: string; logoURI?: string; name: string; stakeAmount?: bigint; website?: string; } Community registration parameters
params.description? string -
params.ensName? string -
params.logoURI? string -
params.name? string -
params.stakeAmount? bigint -
params.website? string -
options? TransactionOptions Transaction options

Returns

Promise<`0x${string}`>

Transaction hash


requireEntryPoint()

protected requireEntryPoint(): `0x${string}`

Defined in: packages/core/src/clients/BaseClient.ts:73

Returns

`0x${string}`

Inherited from

BaseClient.requireEntryPoint


requireGToken()

protected requireGToken(): `0x${string}`

Defined in: packages/core/src/clients/BaseClient.ts:52

Returns

`0x${string}`

Inherited from

BaseClient.requireGToken


requireGTokenStaking()

protected requireGTokenStaking(): `0x${string}`

Defined in: packages/core/src/clients/BaseClient.ts:59

Returns

`0x${string}`

Inherited from

BaseClient.requireGTokenStaking


requirePaymasterFactory()

protected requirePaymasterFactory(): `0x${string}`

Defined in: packages/core/src/clients/BaseClient.ts:66

Returns

`0x${string}`

Inherited from

BaseClient.requirePaymasterFactory


requireRegistry()

protected requireRegistry(): `0x${string}`

Defined in: packages/core/src/clients/BaseClient.ts:45

Returns

`0x${string}`

Inherited from

BaseClient.requireRegistry


revokeMembership()

revokeMembership(userAddr, options?): Promise<`0x${string}`>

Defined in: packages/enduser/src/CommunityClient.ts:360

Revoke membership (Burn SBT)

Parameters

Parameter Type
userAddr `0x${string}`
options? TransactionOptions

Returns

Promise<`0x${string}`>


setReputationRule()

setReputationRule(ruleId, ruleConfig, options?): Promise<`0x${string}`>

Defined in: packages/enduser/src/CommunityClient.ts:336

Parameters

Parameter Type
ruleId bigint
ruleConfig any
options? TransactionOptions

Returns

Promise<`0x${string}`>


setupCommunity()

setupCommunity(params, options?): Promise<{ hashes: `0x${string}`[]; tokenAddress: `0x${string}`; }>

Defined in: packages/enduser/src/CommunityClient.ts:234

One-click Setup: Register Community + Deploy Token Orchestrates the complete community initialization flow.

Parameters

Parameter Type
params { description?: string; logoURI?: string; name: string; stakeAmount?: bigint; tokenName: string; tokenSymbol: string; website?: string; }
params.description? string
params.logoURI? string
params.name? string
params.stakeAmount? bigint
params.tokenName? string
params.tokenSymbol? string
params.website? string
options? TransactionOptions

Returns

Promise<{ hashes: `0x${string}`[]; tokenAddress: `0x${string}`; }>


transferCommunityTokenOwnership()

transferCommunityTokenOwnership(tokenAddress, newOwner, options?): Promise<`0x${string}`>

Defined in: packages/enduser/src/CommunityClient.ts:377

Transfer ownership of the Community Token

Parameters

Parameter Type
tokenAddress `0x${string}`
newOwner `0x${string}`
options? TransactionOptions

Returns

Promise<`0x${string}`>