Install & Initialize

import CommunitiesID from '@communitiesid/id';

const OPTIONS: CommunitiesIDInput = {
  isTestnet: false,
  openseaKey: '<Your opensea api key>',
  Ethereum: {
    RPCUrl: '<Your rpc url for this chain>'
    // generateSign is required to call writing methods, like mint, renew
    generateSigner: provider => new ethers.Wallet(process.env.PRIVATE_KEY || '', provider)
  },
  Polygon: {
    RPCUrl: '<Your rpc url for this chain>'
  },
  Base: {
    RPCUrl: '<Your rpc url for this chain>'
  },
  OP: {
    RPCUrl: '<Your rpc url for this chain>'
  },
  BSC: {
    RPCUrl: '<Your rpc url for this chain>'
  },
  Scroll: {
    RPCUrl: '<Your rpc url for this chain>'
  },
  // This is for resolve name for space id only
  arbitrum: {
    RPCUrl: '<Your rpc url for this chain>'
  },
}

const { resolver, collector, operator } = new CommunitiesID(options);

You can also initialize it with provider (except arbitrum, because it is only used for resolve name for space id)

const OPTIONS: CommunitiesIDInput = {
  isTestnet: false,
  openseaKey: '<Your opensea api key>',
  Ethereum: {
    provider: new ethers.providers.JsonRpcProvider('xxx')
  },
  ...
}

If you want to use this sdk on communitiesID testnet, you can initialize it like this:

const OPTIONS: CommunitiesIDInput = {
  isTestnet: true,
  ...
}

Last updated