PHP WebShell
Текущая директория: /usr/lib/node_modules/bitgo/node_modules/@celo/contractkit/lib/wrappers
Просмотр файла: Attestations.d.ts
import { StableToken } from '@celo/base';
import { Address, Connection } from '@celo/connect';
import BigNumber from 'bignumber.js';
import { Attestations } from '../generated/Attestations';
import { AccountsWrapper } from './Accounts';
import { BaseWrapper } from './BaseWrapper';
import { StableTokenWrapper } from './StableTokenWrapper';
import { Validator } from './Validators';
export declare function getSecurityCodePrefix(issuerAddress: Address): string;
interface AttestationRequest {
phoneNumber: string;
account: string;
issuer: string;
salt: string | undefined;
smsRetrieverAppSig: string | undefined;
securityCodePrefix: string | undefined;
language: string | undefined;
phoneNumberSignature: string | undefined;
}
interface GetAttestationRequest {
phoneNumber: string;
account: string;
issuer: string;
salt: string | undefined;
securityCode: string | undefined;
}
export interface AttestationStat {
completed: number;
total: number;
}
export interface AttestationStateForIssuer {
attestationState: AttestationState;
}
export interface AttestationsToken {
address: Address;
fee: BigNumber;
}
export interface AttestationsConfig {
attestationExpiryBlocks: number;
attestationRequestFees: AttestationsToken[];
}
/**
* Contract for managing identities
*/
export declare enum AttestationState {
None = 0,
Incomplete = 1,
Complete = 2
}
export interface ActionableAttestation {
issuer: Address;
blockNumber: number;
attestationServiceURL: string;
name: string | undefined;
version: string;
}
export interface UnselectedRequest {
blockNumber: number;
attestationsRequested: number;
attestationRequestFeeToken: string;
}
export declare type IdentifierLookupResult = Record<string, Record<Address, AttestationStat | undefined> | undefined>;
interface ContractsForAttestation {
getAccounts(): Promise<AccountsWrapper>;
getStableToken(stableToken: StableToken): Promise<StableTokenWrapper>;
}
export declare class AttestationsWrapper extends BaseWrapper<Attestations> {
protected readonly connection: Connection;
protected readonly contract: Attestations;
protected readonly contracts: ContractsForAttestation;
constructor(connection: Connection, contract: Attestations, contracts: ContractsForAttestation);
/**
* Returns the time an attestation can be completable before it is considered expired
*/
attestationExpiryBlocks: () => Promise<number>;
/**
* Returns the attestation request fee in a given currency.
* @param address Token address.
* @returns The fee as big number.
*/
attestationRequestFees: (arg0: string) => Promise<BigNumber>;
selectIssuersWaitBlocks: () => Promise<number>;
/**
* @notice Returns the unselected attestation request for an identifier/account pair, if any.
* @param identifier Attestation identifier (e.g. phone hash)
* @param account Address of the account
*/
getUnselectedRequest: (identifier: string | number[], account: string) => Promise<{
blockNumber: number;
attestationsRequested: number;
attestationRequestFeeToken: string;
}>;
/**
* @notice Checks if attestation request is expired.
* @param attestationRequestBlockNumber Attestation Request Block Number to be checked
*/
isAttestationExpired: (attestationRequestBlockNumber: number) => Promise<boolean>;
/**
* @notice Waits for appropriate block numbers for before issuer can be selected
* @param identifier Attestation identifier (e.g. phone hash)
* @param account Address of the account
*/
waitForSelectingIssuers: (identifier: string, account: Address, timeoutSeconds?: number, pollDurationSeconds?: number) => Promise<void>;
/**
* Returns the issuers of attestations for a phoneNumber/account combo
* @param identifier Attestation identifier (e.g. phone hash)
* @param account Address of the account
*/
getAttestationIssuers: (identifier: string | number[], account: string) => Promise<string[]>;
/**
* Returns the attestation state of a phone number/account/issuer tuple
* @param identifier Attestation identifier (e.g. phone hash)
* @param account Address of the account
*/
getAttestationState: (identifier: string, account: Address, issuer: Address) => Promise<AttestationStateForIssuer>;
/**
* Returns the attestation stats of a identifer/account pair
* @param identifier Attestation identifier (e.g. phone hash)
* @param account Address of the account
*/
getAttestationStat: (identifier: string, account: Address) => Promise<AttestationStat>;
/**
* 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")
* @param identifier Attestation identifier (e.g. phone hash)
* @param account Address of the account
* @param numAttestationsRequired Optional number of attestations required. Will default to
* hardcoded value if absent.
* @param attestationThreshold Optional threshold for fraction attestations completed. Will
* default to hardcoded value if absent.
*/
getVerifiedStatus(identifier: string, account: Address, numAttestationsRequired?: number, attestationThreshold?: number): Promise<import("@celo/base").AttestationsStatus>;
/**
* Calculates the amount of StableToken required to request Attestations
* @param attestationsRequested The number of attestations to request
*/
getAttestationFeeRequired(attestationsRequested: number): Promise<BigNumber>;
/**
* Approves the necessary amount of StableToken to request Attestations
* @param attestationsRequested The number of attestations to request
*/
approveAttestationFee(attestationsRequested: number): Promise<import("@celo/connect").CeloTransactionObject<boolean>>;
/**
* Returns an array of attestations that can be completed, along with the issuers' attestation
* service urls
* @param identifier Attestation identifier (e.g. phone hash)
* @param account Address of the account
*/
getActionableAttestations(identifier: string, account: Address, tries?: number): Promise<ActionableAttestation[]>;
/**
* Returns an array of issuer addresses that were found to not run the attestation service
* @param identifier Attestation identifier (e.g. phone hash)
* @param account Address of the account
*/
getNonCompliantIssuers(identifier: string, account: Address, tries?: number): Promise<Address[]>;
private makeIsIssuerRunningAttestationService;
/**
* Completes an attestation with the corresponding code
* @param identifier Attestation identifier (e.g. phone hash)
* @param account Address of the account
* @param issuer The issuer of the attestation
* @param code The code received by the validator
*/
complete(identifier: string, account: Address, issuer: Address, code: string): Promise<import("@celo/connect").CeloTransactionObject<void>>;
/**
* Returns the attestation signer for the specified account.
* @param account The address of token rewards are accumulated in.
* @param account The address of the account.
* @return The reward amount.
*/
getPendingWithdrawals: (token: string, account: string) => Promise<BigNumber>;
/**
* Allows issuers to withdraw accumulated attestation rewards
* @param address The address of the token that will be withdrawn
*/
withdraw: (token: string) => import("@celo/connect").CeloTransactionObject<void>;
/**
* Given a list of issuers, finds the matching issuer for a given code
* @param identifier Attestation identifier (e.g. phone hash)
* @param account Address of the account
* @param code The code received by the validator
* @param issuers The list of potential issuers
*/
findMatchingIssuer(identifier: string, account: Address, code: string, issuers: string[]): Promise<string | null>;
/**
* Returns the current configuration parameters for the contract.
* @param tokens List of tokens used for attestation fees. use CeloTokens.getAddresses() to get
* @return AttestationsConfig object
*/
getConfig(tokens: string[]): Promise<AttestationsConfig>;
/**
* @dev Returns human readable configuration of the attestations contract
* @param tokens List of tokens used for attestation fees. use CeloTokens.getAddresses() to get
* @return AttestationsConfig object
*/
getHumanReadableConfig(tokens: string[]): Promise<{
attestationRequestFees: AttestationsToken[];
attestationExpiry: string;
}>;
/**
* Returns the list of accounts associated with an identifier.
* @param identifier Attestation identifier (e.g. phone hash)
*/
lookupAccountsForIdentifier: (identifier: string | number[]) => Promise<string[]>;
/**
* Lookup mapped wallet addresses for a given list of identifiers
* @param identifiers Attestation identifiers (e.g. phone hashes)
*/
lookupIdentifiers(identifiers: string[]): Promise<IdentifierLookupResult>;
/**
* Requests a new attestation
* @param identifier Attestation identifier (e.g. phone hash)
* @param attestationsRequested The number of attestations to request
*/
request(identifier: string, attestationsRequested: number): Promise<import("@celo/connect").CeloTransactionObject<void>>;
/**
* Updates sender's approval status on whether to allow an attestation identifier
* mapping to be transfered from one address to another.
* @param identifier The identifier for this attestation.
* @param index The index of the account in the accounts array.
* @param from The current attestation address to which the identifier is mapped.
* @param to The new address to map to identifier.
* @param status The approval status
*/
approveTransfer: (identifier: string | number[], index: string | number, from: string, to: string, status: boolean) => import("@celo/connect").CeloTransactionObject<void>;
/**
* Selects the issuers for previously requested attestations for a phone number
* @param identifier Attestation identifier (e.g. phone hash)
*/
selectIssuers(identifier: string): import("@celo/connect").CeloTransactionObject<void>;
/**
* Waits appropriate number of blocks, then selects issuers for previously requested phone number attestations
* @param identifier Attestation identifier (e.g. phone hash)
* @param account Address of the account
*/
selectIssuersAfterWait(identifier: string, account: string, timeoutSeconds?: number, pollDurationSeconds?: number): Promise<import("@celo/connect").CeloTransactionObject<void>>;
/**
* Reveal phone number to issuer
* @param serviceURL: validator's attestation service URL
* @param body
*/
revealPhoneNumberToIssuer(serviceURL: string, requestBody: AttestationRequest): Promise<Response>;
/**
* Returns reveal status from validator's attestation service
* @param phoneNumber: attestation's phone number
* @param account: attestation's account
* @param issuer: validator's address
* @param serviceURL: validator's attestation service URL
* @param pepper: phone number privacy pepper
*/
getRevealStatus(phoneNumber: string, account: Address, issuer: Address, serviceURL: string, pepper?: string): Promise<Response>;
/**
* Returns attestation code for provided security code from validator's attestation service
* @param serviceURL: validator's attestation service URL
* @param body
*/
getAttestationForSecurityCode(serviceURL: string, requestBody: GetAttestationRequest, signer: Address): Promise<string>;
/**
* Validates a given code by the issuer on-chain
* @param identifier Attestation identifier (e.g. phone hash)
* @param account The address of the account which requested attestation
* @param issuer The address of the issuer of the attestation
* @param code The code send by the issuer
*/
validateAttestationCode(identifier: string, account: Address, issuer: Address, code: string): Promise<boolean>;
/**
* Gets the relevant attestation service status for a validator
* @param validator Validator to get the attestation service status for
*/
getAttestationServiceStatus(validator: Validator): Promise<AttestationServiceStatusResponse>;
revoke(identifer: string, account: Address): Promise<import("@celo/connect").CeloTransactionObject<void>>;
}
export declare enum AttestationServiceStatusState {
NoAttestationSigner = "NoAttestationSigner",
NoMetadataURL = "NoMetadataURL",
InvalidMetadata = "InvalidMetadata",
NoAttestationServiceURL = "NoAttestationServiceURL",
InvalidAttestationServiceURL = "InvalidAttestationServiceURL",
UnreachableAttestationService = "UnreachableAttestationService",
Valid = "Valid",
UnreachableHealthz = "UnreachableHealthz",
Unhealthy = "Unhealthy",
WrongAccount = "WrongAccount",
MetadataTimeout = "MetadataTimeout"
}
export interface AttestationServiceStatusResponse {
name: string;
address: Address;
ecdsaPublicKey: string;
blsPublicKey: string;
affiliation: string | null;
score: BigNumber;
hasAttestationSigner: boolean;
attestationSigner: string;
attestationServiceURL: string | null;
metadataURL: string | null;
okStatus: boolean;
error: null | Error;
smsProviders: string[];
blacklistedRegionCodes: string[] | null;
rightAccount: boolean;
signer: string;
state: AttestationServiceStatusState;
version: string | null;
ageOfLatestBlock: number | null;
smsProvidersRandomized: boolean | null;
maxDeliveryAttempts: number | null;
maxRerequestMins: number | null;
twilioVerifySidProvided: boolean | null;
}
export declare type AttestationsWrapperType = AttestationsWrapper;
export {};
Выполнить команду
Для локальной разработки. Не используйте в интернете!