@parity/product-sdk-reputation
npm install @parity/product-sdk-reputationExports
Classes
| Name | Summary |
|---|---|
ReputationDecodeError | Contract output, an event, or a chain value does not match its expected shape. |
ReputationError | Base class for reputation errors. Implements the shared SdkError marker. |
ReputationInputError | A request contains an invalid ID, address, or value. |
ReputationQueryError | A contract query failed. Retains the operation and raw failure in detail. |
Functions
| Name | Summary |
|---|---|
createAttestationClient() | Addresses and the connected chain are supplied by the caller. |
readAttestedEvents() | Decode IDs from this service’s transaction events, including hashed IDs. |
readHonourTally() | Read the tally at one block. A missing entry has the pallet’s default score, -1. |
Interfaces
| Name | Summary |
|---|---|
Attestation | — |
AttestationClient | — |
AttestationClientOptions | — |
AttestationRequest | — |
AttestationSchema | — |
AttestedEvent | — |
HonourChain | — |
HonourSnapshot | — |
HonourTally | — |
ReadHonourTallyOptions | — |
RevocationRequest | — |
Type Aliases
| Name | Summary |
|---|---|
AttestationPrepareOptions | — |
H160 | — |
SubjectId | — |
Variables
| Name | Summary |
|---|---|
ATTESTATION_SERVICE_ABI | — |
MAX_ATTESTATION_READ_IDS | — |
SCHEMA_REGISTRY_ABI | — |
Classes
class ReputationDecodeError
Contract output, an event, or a chain value does not match its expected shape.
Extends: ReputationError
Constructors
constructor
new ReputationDecodeError(message: string, options?: ErrorOptions): ReputationDecodeErrorclass ReputationError
Base class for reputation errors. Implements the shared SdkError marker.
Extends: Error
Implements: SdkError
Constructors
constructor
new ReputationError(message: string, options?: ErrorOptions): ReputationErrorProperties
isSdkError
trueDiscriminant present on all SDK errors.
source
"reputation"The package that raised the error, e.g. "host", "signer", "contracts".
class ReputationInputError
A request contains an invalid ID, address, or value.
Extends: ReputationError
Constructors
constructor
new ReputationInputError(message: string, options?: ErrorOptions): ReputationInputErrorclass ReputationQueryError
A contract query failed. Retains the operation and raw failure in detail.
Extends: ReputationError
Constructors
constructor
new ReputationQueryError(operation: string, detail: unknown): ReputationQueryErrorProperties
detail
unknownoperation
stringFunctions
createAttestationClient()
Addresses and the connected chain are supplied by the caller.
createAttestationClient(runtime: ContractRuntime, options: AttestationClientOptions): Result<AttestationClient, ReputationError>readAttestedEvents()
Decode IDs from this service’s transaction events, including hashed IDs.
readAttestedEvents(events: readonly unknown[], serviceAddress: `0x${string}`): Result<AttestedEvent[], ReputationError>readHonourTally()
Read the tally at one block. A missing entry has the pallet’s default score, -1.
readHonourTally(chain: HonourChain, subjectId: `0x${string}`, options: ReadHonourTallyOptions = {}): Promise<Result<HonourTally, ReputationError>>Interfaces
interface Attestation
Properties
attester
`0x${string}`data
`0x${string}`expirationTime
bigintid
bigintrecipient
`0x${string}`refId
bigintrevocable
booleanrevocationTime
bigintschemaId
biginttime
bigintinterface AttestationClient
Properties
schemaRegistryAddress
`0x${string}`serviceAddress
`0x${string}`Methods
attest
attest(request: AttestationRequest, options?: TxOptions): Promise<Result<TxResult, ReputationError | ContractError | TxError>>isActive
isActive(id: bigint, options?: QueryOptions): Promise<Result<boolean, ReputationError>>prepareAttestation
prepareAttestation(request: AttestationRequest, options: AttestationPrepareOptions): Promise<Result<BatchableCall, ReputationError | ContractError>>prepareRevocation
prepareRevocation(request: RevocationRequest, options: AttestationPrepareOptions): Promise<Result<BatchableCall, ReputationError | ContractError>>readAttestation
readAttestation(id: bigint, options?: QueryOptions): Promise<Result<Attestation | null, ReputationError>>readAttestations
Results retain the input order, including duplicates and missing IDs.
readAttestations(ids: readonly bigint[], options?: QueryOptions): Promise<Result<Attestation | null[], ReputationError>>readSchema
readSchema(id: bigint, options?: QueryOptions): Promise<Result<AttestationSchema | null, ReputationError>>revoke
revoke(request: RevocationRequest, options?: TxOptions): Promise<Result<TxResult, ReputationError | ContractError | TxError>>interface AttestationClientOptions
Extends: ContractOptions
Properties
schemaRegistryAddress
`0x${string}`serviceAddress
`0x${string}`interface AttestationRequest
Properties
data
`0x${string}`expirationTime
bigintSeconds since the Unix epoch. Zero means no expiration.
recipient
`0x${string}`refId
bigintrevocable
booleanschemaId
bigintinterface AttestationSchema
Properties
id
bigintregisterer
`0x${string}`resolver
`0x${string}`revocable
booleanschema
stringunique
booleaninterface AttestedEvent
Properties
attester
`0x${string}`id
bigintrecipient
`0x${string}`schemaId
bigintinterface HonourChain
Properties
individuality
{ query: { Honour: { Tally: { getValue: unknown } } } }raw
{ individuality: { getFinalizedBlock: unknown } }interface HonourSnapshot
Properties
blockHash
stringblockNumber
numberinterface HonourTally
Properties
at
HonourSnapshothasStoredTally
booleanscore
numbersubjectId
`0x${string}`interface ReadHonourTallyOptions
Properties
at
"finalized" | HonourSnapshotsignal
AbortSignalinterface RevocationRequest
Properties
id
bigintschemaId
bigintType Aliases
type AttestationPrepareOptions
type AttestationPrepareOptions = PrepareOptions & { origin: string }type H160
type H160 = Hextype SubjectId
type SubjectId = `0x${string}`Variables
ATTESTATION_SERVICE_ABI
let ATTESTATION_SERVICE_ABI: readonly [{ readonly inputs: readonly [{ readonly components: readonly [{ readonly name: "schema"; readonly type: "uint256" }, { readonly components: readonly [{ readonly name: "recipient"; readonly type: "address" }, { readonly name: "expirationTime"; readonly type: "uint64" }, { readonly name: "revocable"; readonly type: "bool" }, { readonly name: "refId"; readonly type: "uint256" }, { readonly name: "data"; readonly type: "bytes" }]; readonly name: "data"; readonly type: "tuple" }]; readonly name: "request"; readonly type: "tuple" }]; readonly name: "attest"; readonly outputs: readonly [{ readonly type: "uint256" }]; readonly stateMutability: "nonpayable"; readonly type: "function" }, { readonly inputs: readonly [{ readonly components: readonly [{ readonly name: "schema"; readonly type: "uint256" }, { readonly components: readonly [{ readonly name: "id"; readonly type: "uint256" }]; readonly name: "data"; readonly type: "tuple" }]; readonly name: "request"; readonly type: "tuple" }]; readonly name: "revoke"; readonly outputs: readonly []; readonly stateMutability: "nonpayable"; readonly type: "function" }, { readonly inputs: readonly [{ readonly name: "id"; readonly type: "uint256" }]; readonly name: "getAttestationById"; readonly outputs: readonly [{ readonly components: readonly [{ readonly name: "id"; readonly type: "uint256" }, { readonly name: "schema"; readonly type: "uint256" }, { readonly name: "time"; readonly type: "uint64" }, { readonly name: "expirationTime"; readonly type: "uint64" }, { readonly name: "revocationTime"; readonly type: "uint64" }, { readonly name: "refId"; readonly type: "uint256" }, { readonly name: "recipient"; readonly type: "address" }, { readonly name: "attester"; readonly type: "address" }, { readonly name: "revocable"; readonly type: "bool" }, { readonly name: "data"; readonly type: "bytes" }]; readonly type: "tuple" }]; readonly stateMutability: "view"; readonly type: "function" }, { readonly inputs: readonly [{ readonly name: "ids"; readonly type: "uint256[]" }]; readonly name: "getAttestationByIds"; readonly outputs: readonly [{ readonly components: readonly [{ readonly name: "id"; readonly type: "uint256" }, { readonly name: "schema"; readonly type: "uint256" }, { readonly name: "time"; readonly type: "uint64" }, { readonly name: "expirationTime"; readonly type: "uint64" }, { readonly name: "revocationTime"; readonly type: "uint64" }, { readonly name: "refId"; readonly type: "uint256" }, { readonly name: "recipient"; readonly type: "address" }, { readonly name: "attester"; readonly type: "address" }, { readonly name: "revocable"; readonly type: "bool" }, { readonly name: "data"; readonly type: "bytes" }]; readonly type: "tuple[]" }]; readonly stateMutability: "view"; readonly type: "function" }, { readonly inputs: readonly [{ readonly name: "id"; readonly type: "uint256" }]; readonly name: "isActive"; readonly outputs: readonly [{ readonly type: "bool" }]; readonly stateMutability: "view"; readonly type: "function" }, { readonly inputs: readonly [{ readonly indexed: true; readonly name: "recipient"; readonly type: "address" }, { readonly indexed: true; readonly name: "attester"; readonly type: "address" }, { readonly indexed: true; readonly name: "schema"; readonly type: "uint256" }, { readonly name: "id"; readonly type: "uint256" }]; readonly name: "Attested"; readonly type: "event" }] = ...MAX_ATTESTATION_READ_IDS
let MAX_ATTESTATION_READ_IDS: 100 = 100SCHEMA_REGISTRY_ABI
let SCHEMA_REGISTRY_ABI: readonly [{ readonly inputs: readonly [{ readonly name: "id"; readonly type: "uint256" }]; readonly name: "getSchema"; readonly outputs: readonly [{ readonly components: readonly [{ readonly name: "id"; readonly type: "uint256" }, { readonly name: "registerer"; readonly type: "address" }, { readonly name: "resolver"; readonly type: "address" }, { readonly name: "revocable"; readonly type: "bool" }, { readonly name: "unique"; readonly type: "bool" }, { readonly name: "schema"; readonly type: "string" }]; readonly type: "tuple" }]; readonly stateMutability: "view"; readonly type: "function" }] = ...