@celo/contractkit"wrappers/Attestations"AttestationsWrapper

Class: AttestationsWrapper

Hierarchy

AttestationsWrapper

Index

Constructors

Properties

Accessors

Methods

Constructors

constructor

+ new AttestationsWrapper(kit: ContractKit, contract: Attestations): AttestationsWrapper

Inherited from BaseWrapper.constructor

Defined in packages/sdk/contractkit/src/wrappers/BaseWrapper.ts:30

Parameters:

Name Type
kit ContractKit
contract Attestations

Returns: AttestationsWrapper

Properties

approveTransfer

approveTransfer: function = proxySend(this.kit, this.contract.methods.approveTransfer)

Defined in packages/sdk/contractkit/src/wrappers/Attestations.ts:538

Updates sender's approval status on whether to allow an attestation identifier mapping to be transfered from one address to another.

param The identifier for this attestation.

param The index of the account in the accounts array.

param The current attestation address to which the identifier is mapped.

param The new address to map to identifier.

param The approval status

Type declaration:

▸ (...args: InputArgs): CeloTransactionObject‹Output›

Parameters:

Name Type
...args InputArgs

attestationExpiryBlocks

attestationExpiryBlocks: function = proxyCall( this.contract.methods.attestationExpiryBlocks, undefined, valueToInt )

Defined in packages/sdk/contractkit/src/wrappers/Attestations.ts:108

Returns the time an attestation can be completable before it is considered expired

Type declaration:

▸ (...args: InputArgs): Promise‹Output›

Parameters:

Name Type
...args InputArgs

attestationRequestFees

attestationRequestFees: function = proxyCall( this.contract.methods.attestationRequestFees, undefined, valueToBigNumber )

Defined in packages/sdk/contractkit/src/wrappers/Attestations.ts:119

Returns the attestation request fee in a given currency.

param Token address.

returns The fee as big number.

Type declaration:

▸ (...args: InputArgs): Promise‹Output›

Parameters:

Name Type
...args InputArgs

eventTypes

eventTypes: EventsEnum‹T› = Object.keys(this.events).reduce>( (acc, key) => ({ ...acc, [key]: key }), {} as any )

Inherited from BaseWrapper.eventTypes

Defined in packages/sdk/contractkit/src/wrappers/BaseWrapper.ts:61


events

events: Attestations["events"] = this.contract.events

Inherited from BaseWrapper.events

Defined in packages/sdk/contractkit/src/wrappers/BaseWrapper.ts:59


getAttestationIssuers

getAttestationIssuers: function = proxyCall(this.contract.methods.getAttestationIssuers)

Defined in packages/sdk/contractkit/src/wrappers/Attestations.ts:192

Returns the issuers of attestations for a phoneNumber/account combo

param Attestation identifier (e.g. phone hash)

param Address of the account

Type declaration:

▸ (...args: InputArgs): Promise‹Output›

Parameters:

Name Type
...args InputArgs

getAttestationStat

getAttestationStat: function = proxyCall( this.contract.methods.getAttestationStats, undefined, (stat) => ({ completed: valueToInt(stat[0]), total: valueToInt(stat[1]) }) )

Defined in packages/sdk/contractkit/src/wrappers/Attestations.ts:214

Returns the attestation stats of a identifer/account pair

param Attestation identifier (e.g. phone hash)

param Address of the account

Type declaration:

▸ (identifier: string, account: Address): Promise‹AttestationStat

Parameters:

Name Type
identifier string
account Address

getAttestationState

getAttestationState: function = proxyCall( this.contract.methods.getAttestationState, undefined, (state) => ({ attestationState: valueToInt(state[0]) }) )

Defined in packages/sdk/contractkit/src/wrappers/Attestations.ts:199

Returns the attestation state of a phone number/account/issuer tuple

param Attestation identifier (e.g. phone hash)

param Address of the account

Type declaration:

▸ (identifier: string, account: Address, issuer: Address): Promise‹AttestationStateForIssuer

Parameters:

Name Type
identifier string
account Address
issuer Address

getPendingWithdrawals

getPendingWithdrawals: function = proxyCall( this.contract.methods.pendingWithdrawals, undefined, valueToBigNumber )

Defined in packages/sdk/contractkit/src/wrappers/Attestations.ts:395

Returns the attestation signer for the specified account.

param The address of token rewards are accumulated in.

param The address of the account.

returns The reward amount.

Type declaration:

▸ (token: string, account: string): Promise‹BigNumber›

Parameters:

Name Type
token string
account string

getUnselectedRequest

getUnselectedRequest: function = proxyCall( this.contract.methods.getUnselectedRequest, undefined, (res) => ({ blockNumber: valueToInt(res[0]), attestationsRequested: valueToInt(res[1]), attestationRequestFeeToken: res[2], }) )

Defined in packages/sdk/contractkit/src/wrappers/Attestations.ts:136

notice Returns the unselected attestation request for an identifier/account pair, if any.

param Attestation identifier (e.g. phone hash)

param Address of the account

Type declaration:

▸ (...args: InputArgs): Promise‹Output›

Parameters:

Name Type
...args InputArgs

lookupAccountsForIdentifier

lookupAccountsForIdentifier: function = proxyCall(this.contract.methods.lookupAccountsForIdentifier)

Defined in packages/sdk/contractkit/src/wrappers/Attestations.ts:474

Returns the list of accounts associated with an identifier.

param Attestation identifier (e.g. phone hash)

Type declaration:

▸ (...args: InputArgs): Promise‹Output›

Parameters:

Name Type
...args InputArgs

methodIds

methodIds: Record‹keyof T["methods"], string› = Object.keys(this.contract.methods).reduce, string>>( (acc, method: Methods) => { const methodABI = this.contract.options.jsonInterface.find((item) => item.name === method)

  acc[method] =
    methodABI === undefined
      ? '0x'
      : this.kit.connection.getAbiCoder().encodeFunctionSignature(methodABI)

  return acc
},
{} as any

)

Inherited from BaseWrapper.methodIds

Defined in packages/sdk/contractkit/src/wrappers/BaseWrapper.ts:66


selectIssuersWaitBlocks

selectIssuersWaitBlocks: function = proxyCall( this.contract.methods.selectIssuersWaitBlocks, undefined, valueToInt )

Defined in packages/sdk/contractkit/src/wrappers/Attestations.ts:125

Type declaration:

▸ (...args: InputArgs): Promise‹Output›

Parameters:

Name Type
...args InputArgs

withdraw

withdraw: function = proxySend(this.kit, this.contract.methods.withdraw)

Defined in packages/sdk/contractkit/src/wrappers/Attestations.ts:405

Allows issuers to withdraw accumulated attestation rewards

param The address of the token that will be withdrawn

Type declaration:

▸ (...args: InputArgs): CeloTransactionObject‹Output›

Parameters:

Name Type
...args InputArgs

Accessors

address

get address(): string

Inherited from BaseWrapper.address

Defined in packages/sdk/contractkit/src/wrappers/BaseWrapper.ts:35

Contract address

Returns: string

Methods

approveAttestationFee

approveAttestationFee(attestationsRequested: number): Promise‹CeloTransactionObject‹boolean››

Defined in packages/sdk/contractkit/src/wrappers/Attestations.ts:261

Approves the necessary amount of StableToken to request Attestations

Parameters:

Name Type Description
attestationsRequested number The number of attestations to request

Returns: Promise‹CeloTransactionObject‹boolean››


complete

complete(identifier: string, account: Address, issuer: Address, code: string): Promise‹CeloTransactionObject‹void››

Defined in packages/sdk/contractkit/src/wrappers/Attestations.ts:371

Completes an attestation with the corresponding code

Parameters:

Name Type Description
identifier string Attestation identifier (e.g. phone hash)
account Address Address of the account
issuer Address The issuer of the attestation
code string The code received by the validator

Returns: Promise‹CeloTransactionObject‹void››


findMatchingIssuer

findMatchingIssuer(identifier: string, account: Address, code: string, issuers: string[]): Promise‹string | null›

Defined in packages/sdk/contractkit/src/wrappers/Attestations.ts:414

Given a list of issuers, finds the matching issuer for a given code

Parameters:

Name Type Description
identifier string Attestation identifier (e.g. phone hash)
account Address Address of the account
code string The code received by the validator
issuers string[] The list of potential issuers

Returns: Promise‹string | null›


getActionableAttestations

getActionableAttestations(identifier: string, account: Address, tries: number): Promise‹ActionableAttestation[]›

Defined in packages/sdk/contractkit/src/wrappers/Attestations.ts:273

Returns an array of attestations that can be completed, along with the issuers' attestation service urls

Parameters:

Name Type Default Description
identifier string - Attestation identifier (e.g. phone hash)
account Address - Address of the account
tries number 3 -

Returns: Promise‹ActionableAttestation[]›


getAttestationFeeRequired

getAttestationFeeRequired(attestationsRequested: number): Promise‹BigNumber‹››

Defined in packages/sdk/contractkit/src/wrappers/Attestations.ts:251

Calculates the amount of StableToken required to request Attestations

Parameters:

Name Type Description
attestationsRequested number The number of attestations to request

Returns: Promise‹BigNumber‹››


getAttestationForSecurityCode

getAttestationForSecurityCode(serviceURL: string, requestBody: GetAttestationRequest, signer: Address): Promise‹string›

Defined in packages/sdk/contractkit/src/wrappers/Attestations.ts:610

Returns attestation code for provided security code from validator's attestation service

Parameters:

Name Type
serviceURL string
requestBody GetAttestationRequest
signer Address

Returns: Promise‹string›


getAttestationServiceStatus

getAttestationServiceStatus(validator: Validator): Promise‹AttestationServiceStatusResponse

Defined in packages/sdk/contractkit/src/wrappers/Attestations.ts:687

Gets the relevant attestation service status for a validator

Parameters:

Name Type Description
validator Validator Validator to get the attestation service status for

Returns: Promise‹AttestationServiceStatusResponse


getConfig

getConfig(tokens?: string[]): Promise‹AttestationsConfig

Defined in packages/sdk/contractkit/src/wrappers/Attestations.ts:443

Returns the current configuration parameters for the contract.

Parameters:

Name Type Description
tokens? string[] List of tokens used for attestation fees.

Returns: Promise‹AttestationsConfig

AttestationsConfig object


getHumanReadableConfig

getHumanReadableConfig(tokens?: string[]): Promise‹object›

Defined in packages/sdk/contractkit/src/wrappers/Attestations.ts:462

dev Returns human readable configuration of the attestations contract

Parameters:

Name Type
tokens? string[]

Returns: Promise‹object›

AttestationsConfig object


getNonCompliantIssuers

getNonCompliantIssuers(identifier: string, account: Address, tries: number): Promise‹Address[]›

Defined in packages/sdk/contractkit/src/wrappers/Attestations.ts:296

Returns an array of issuer addresses that were found to not run the attestation service

Parameters:

Name Type Default Description
identifier string - Attestation identifier (e.g. phone hash)
account Address - Address of the account
tries number 3 -

Returns: Promise‹Address[]›


getPastEvents

getPastEvents(event: Events‹Attestations›, options: PastEventOptions): Promise‹EventLog[]›

Inherited from BaseWrapper.getPastEvents

Defined in packages/sdk/contractkit/src/wrappers/BaseWrapper.ts:55

Contract getPastEvents

Parameters:

Name Type
event Events‹Attestations›
options PastEventOptions

Returns: Promise‹EventLog[]›


getRevealStatus

getRevealStatus(phoneNumber: string, account: Address, issuer: Address, serviceURL: string, pepper?: undefined | string): Promise‹Response‹››

Defined in packages/sdk/contractkit/src/wrappers/Attestations.ts:586

Returns reveal status from validator's attestation service

Parameters:

Name Type
phoneNumber string
account Address
issuer Address
serviceURL string
pepper? undefined | string

Returns: Promise‹Response‹››


getVerifiedStatus

getVerifiedStatus(identifier: string, account: Address, numAttestationsRequired?: undefined | number, attestationThreshold?: undefined | number): Promise‹AttestationsStatus›

Defined in packages/sdk/contractkit/src/wrappers/Attestations.ts:233

Returns the verified status of an identifier/account pair indicating whether the attestation stats for a given pair are completed beyond a certain threshold of confidence (aka "verified")

Parameters:

Name Type Description
identifier string Attestation identifier (e.g. phone hash)
account Address Address of the account
numAttestationsRequired? undefined | number Optional number of attestations required. Will default to hardcoded value if absent.
attestationThreshold? undefined | number Optional threshold for fraction attestations completed. Will default to hardcoded value if absent.

Returns: Promise‹AttestationsStatus›


isAttestationExpired

isAttestationExpired(attestationRequestBlockNumber: number): Promise‹boolean›

Defined in packages/sdk/contractkit/src/wrappers/Attestations.ts:150

notice Checks if attestation request is expired.

Parameters:

Name Type Description
attestationRequestBlockNumber number Attestation Request Block Number to be checked

Returns: Promise‹boolean›


lookupIdentifiers

lookupIdentifiers(identifiers: string[]): Promise‹IdentifierLookupResult

Defined in packages/sdk/contractkit/src/wrappers/Attestations.ts:480

Lookup mapped wallet addresses for a given list of identifiers

Parameters:

Name Type Description
identifiers string[] Attestation identifiers (e.g. phone hashes)

Returns: Promise‹IdentifierLookupResult


request

request(identifier: string, attestationsRequested: number): Promise‹CeloTransactionObject‹void››

Defined in packages/sdk/contractkit/src/wrappers/Attestations.ts:521

Requests a new attestation

Parameters:

Name Type Description
identifier string Attestation identifier (e.g. phone hash)
attestationsRequested number The number of attestations to request

Returns: Promise‹CeloTransactionObject‹void››


revealPhoneNumberToIssuer

revealPhoneNumberToIssuer(serviceURL: string, requestBody: AttestationRequest): Promise‹Response‹››

Defined in packages/sdk/contractkit/src/wrappers/Attestations.ts:568

Reveal phone number to issuer

Parameters:

Name Type
serviceURL string
requestBody AttestationRequest

Returns: Promise‹Response‹››


revoke

revoke(identifer: string, account: Address): Promise‹CeloTransactionObject‹void››

Defined in packages/sdk/contractkit/src/wrappers/Attestations.ts:814

Parameters:

Name Type
identifer string
account Address

Returns: Promise‹CeloTransactionObject‹void››


selectIssuers

selectIssuers(identifier: string): CeloTransactionObject‹void›

Defined in packages/sdk/contractkit/src/wrappers/Attestations.ts:544

Selects the issuers for previously requested attestations for a phone number

Parameters:

Name Type Description
identifier string Attestation identifier (e.g. phone hash)

Returns: CeloTransactionObject‹void›


selectIssuersAfterWait

selectIssuersAfterWait(identifier: string, account: string, timeoutSeconds?: undefined | number, pollDurationSeconds?: undefined | number): Promise‹CeloTransactionObject‹void››

Defined in packages/sdk/contractkit/src/wrappers/Attestations.ts:553

Waits appropriate number of blocks, then selects issuers for previously requested phone number attestations

Parameters:

Name Type Description
identifier string Attestation identifier (e.g. phone hash)
account string Address of the account
timeoutSeconds? undefined | number -
pollDurationSeconds? undefined | number -

Returns: Promise‹CeloTransactionObject‹void››


validateAttestationCode

validateAttestationCode(identifier: string, account: Address, issuer: Address, code: string): Promise‹boolean›

Defined in packages/sdk/contractkit/src/wrappers/Attestations.ts:660

Validates a given code by the issuer on-chain

Parameters:

Name Type Description
identifier string Attestation identifier (e.g. phone hash)
account Address The address of the account which requested attestation
issuer Address The address of the issuer of the attestation
code string The code send by the issuer

Returns: Promise‹boolean›


version

version(): Promise‹NonNullable‹T["methods"] extends object ? ContractVersion<> : never››

Inherited from BaseWrapper.version

Defined in packages/sdk/contractkit/src/wrappers/BaseWrapper.ts:39

Returns: Promise‹NonNullable‹T["methods"] extends object ? ContractVersion<> : never››


waitForSelectingIssuers

waitForSelectingIssuers(identifier: string, account: Address, timeoutSeconds: number, pollDurationSeconds: number): Promise‹void›

Defined in packages/sdk/contractkit/src/wrappers/Attestations.ts:162

notice Waits for appropriate block numbers for before issuer can be selected

Parameters:

Name Type Default Description
identifier string - Attestation identifier (e.g. phone hash)
account Address - Address of the account
timeoutSeconds number 120 -
pollDurationSeconds number 1 -

Returns: Promise‹void›