@polkadot/types/interfaces#IdentityInfo TypeScript Examples

The following examples show how to use @polkadot/types/interfaces#IdentityInfo. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: utils.ts    From polkadot-registrar-watcher with Apache License 2.0 7 votes vote down vote up
buildWsChallengeRequestData = (accountId: string, info: IdentityInfo): WsChallengeRequestData => {

  const accounts = {}
  if(isDataPresent(info.email)){
    accounts['email'] = info.email.value.toHuman()
  }
  if(isDataPresent(info.riot)){
    accounts['matrix'] = info.riot.value.toHuman()
  }
  if(isDataPresent(info.twitter)){
    accounts['twitter'] = info.twitter.value.toHuman()
  }
  if(isDataPresent(info.legal)){
    accounts['legal_name'] = info.legal.value.toHuman()
  }
  if(isDataPresent(info.display)){
    accounts['display_name'] = info.display.value.toHuman()
  }
  if(isDataPresent(info.web)){
    accounts['web'] = info.web.value.toHuman()
  }

  const request: WsChallengeRequestData = {
      address: accountId,
      accounts: accounts
  }
  return request
}
Example #2
Source File: utils.ts    From polkadot-registrar-watcher with Apache License 2.0 7 votes vote down vote up
isClaimChallengeCompliant = (judgements: Vec<RegistrationJudgement>, registrarIndex: number, info: IdentityInfo): boolean =>{
  let isCompliant = false
  for (const judgement of judgements) {
    if(_isOurRegistrarTargetted(judgement,registrarIndex) && !_isAlreadyJudged(judgement)) isCompliant = true
  }
  if(!_isInfoChallengeCompliant(info)) {
    // isCompliant = false // DISABLED Filtering, now it is a challenger task
  }
  
  return isCompliant
}
Example #3
Source File: utils.ts    From polkadot-registrar-watcher with Apache License 2.0 7 votes vote down vote up
extractRegistrationEntry = (key: StorageKey, exposure: Option<Registration>): {accountId: string; judgements: Vec<RegistrationJudgement>; info: IdentityInfo} => {
  const registration = exposure as Option<Registration>
  const accountId = key.args.map((k) => k.toHuman()).toString()
  const judgements = registration.unwrap().judgements
  const info = registration.unwrap().info 
  
  return {
    accountId: accountId,
    judgements: judgements,
    info: info
  }
}
Example #4
Source File: subscriber.ts    From polkadot-registrar-watcher with Apache License 2.0 6 votes vote down vote up
private _performNewChallengeAttempt = async (accountId: string): Promise<void> =>{
      const identity = await this._getIdentity(accountId)
      const judgements = identity.unwrapOrDefault().judgements
      const info: IdentityInfo = identity.unwrapOrDefault().info 
      this.logger.debug(info.toString())
      this.logger.debug(judgements.toString())
      this.logger.debug(identity.unwrapOrDefault().toString())

      if( identity.isEmpty ) {
        this.logger.info(`${accountId} has no active identity claims`)
        return
      }
      
      if( !isClaimChallengeCompliant(judgements, this.registrarIndex, info) ){
        this.logger.info(`${accountId} has a not interesting identity claim`)
        this.logger.info(`${judgements.toString()}`)
        this.logger.info(`${info.toString()}`)
        return
      }

      try {
        this.wsNewJudgementRequestHandler(buildWsChallengeRequest(accountId,info))
      } catch (error) {
        this.logger.error(`problem on performing a new challenge for account ${accountId}`)
        this.logger.error(error)
      }
    }
Example #5
Source File: utils.ts    From polkadot-registrar-watcher with Apache License 2.0 6 votes vote down vote up
buildWsChallengeRequest = (accountId: string, info: IdentityInfo): WsChallengeRequest => {

  const request: WsChallengeRequest = {
    event: 'newJudgementRequest',
    data: buildWsChallengeRequestData(accountId,info)
  }
  return request
}
Example #6
Source File: utils.ts    From polkadot-registrar-watcher with Apache License 2.0 6 votes vote down vote up
_isInfoChallengeCompliant = (info: IdentityInfo): boolean => {
  return !isDataPresent(info.web) && !isDataPresent(info.legal) && !isDataPresent(info.image) && info.additional.isEmpty
}
Example #7
Source File: identity.ts    From commonwealth with GNU General Public License v3.0 5 votes vote down vote up
private _info: IdentityInfo;