Skip to content

@passes/reqs / Exports / RequestTopic

Class: RequestTopic<TRequestBody, TResultBody>

Builds an Envelope-v0x00 request topic interface.

Implements

Type parameters

Name
TRequestBody
TResultBody

Hierarchy

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new RequestTopic<TRequestBody, TResultBody>(params): RequestTopic<TRequestBody, TResultBody>

Type parameters

Name
TRequestBody
TResultBody

Parameters

NameType
paramsRequestTopicParams<TRequestBody, TResultBody>

Returns

RequestTopic<TRequestBody, TResultBody>

Defined in

request-topic.js:33

Properties

abi

abi: PassesABI

Defined in

request-topic.js:37


id

id: string

Defined in

request-topic.js:34


requestBodyCodec

requestBodyCodec: Codec<TRequestBody>

Defined in

request-topic.js:35


resultBodyCodec

resultBodyCodec: Codec<TResultBody>

Defined in

request-topic.js:36


Errors

Static Errors: Object

Type declaration

NameType
ABI_NOT_AVAILABLEtypeof RequestTopicABINotAvailable
INCORRECT_TOPICtypeof RequestTopicIncorrectTopicError

Defined in

request-topic.js:112

Methods

decodeRequest

decodeRequest(bytes): Promise<TRequestBody>

Decodes an envelope-v0x00 request into a structured request body.

Parameters

NameType
bytesUint8Array

Returns

Promise<TRequestBody>

Defined in

request-topic.js:59


decodeResult

decodeResult(bytes): Promise<RequestResult<TResultBody>>

Decodes an envelope-v0x00 request into a structured request body.

Parameters

NameType
bytesUint8Array

Returns

Promise<RequestResult<TResultBody>>

Defined in

request-topic.js:86


encodeRequest

encodeRequest(body): Promise<Uint8Array>

Encodes a structured request body into an envelope-v0x00 request.

Parameters

NameType
bodyTRequestBody

Returns

Promise<Uint8Array>

Defined in

request-topic.js:46


encodeResult

encodeResult(result): Promise<Uint8Array>

Encodes a structured result body into an envelope-v0x00 result.

Parameters

NameType
resultRequestResult<TResultBody>

Returns

Promise<Uint8Array>

Defined in

request-topic.js:71


resolveABI

resolveABI(): PassesABI

A helper for resolving the PassesABI. If the instance has no abi property, it returns document.passes if it's available.

Returns

PassesABI

Throws

  • document.passes must be available if abi is not passed.

Defined in

request-topic.js:150


sendRequest

sendRequest(reqBody): Promise<RequestResult<TResultBody>>

Sends a request.

Parameters

NameType
reqBodyTRequestBody

Returns

Promise<RequestResult<TResultBody>>

Defined in

request-topic.js:105


toString

toString(): string

Returns a string representation of the request topic.

Returns

string

Defined in

request-topic.js:175


withABI

withABI(abi): RequestTopic<TRequestBody, TResultBody>

Returns a new RequestTopic instance with the same id and codecs, but with a new ABI.

Parameters

NameType
abiPassesABI

Returns

RequestTopic<TRequestBody, TResultBody>

Defined in

request-topic.js:162