Skip to content

Latest commit

 

History

History
41 lines (22 loc) · 7.08 KB

File metadata and controls

41 lines (22 loc) · 7.08 KB

RequestNetwork

Description

The Request Network client.

Usage

import { RequestNetwork } from "@requestnetwork/request-client.js";

Constructor Paramters

NameTypeRequired?Description
nodeConnectionConfigAxiosRequestConfigrecommendedAxios configurations
signatureProviderISignatureProviderrecommendedRequired to sign and create requests
decryptionProviderIDecryptionProvideroptionalRequired to retrieve encrypted requests
httpConfigIHttpDataAccessConfigoptionalOptions for HTTP transport (timeout, delay, retry, etc.)
paymentOptionsPaymentNetworkOptionsoptionalPayment detection options
useMockStoragebooleanoptionalStore ephemeral requests in local memory
currenciesCurrencyInput[]optionalCustom currency list
currencyManagerICurrencyManageroptionalCustom currency manager (will override currencies). A Currency manager handles a list of currencies and provides utility to retrieve and change format

Types and Interfaces

AxiosRequestConfig Properties

NameTypeRequired?Description
baseUrlstringrecommendedRequest Node URL
Many other properties...optional

ISignatureProvider Implementations

TypeDescription
Web3SignatureProviderSign using a private key inside of a wallet
EthereumPrivateKeySignatureProviderSign using a private key outside of a wallet

IDecryptionProvider Implementations

TypeDescription
EthereumPrivateKeyDecryptionProviderDecrypt using a private key outside of a wallet

IHttpDataAccessConfig Properties

NameTypeRequired?Description
requestClientVersionHeaderstringfalseName of the header containing the client version
httpRequestMaxRetrynumberfalseMaximum number of retries to attempt when http requests to the Node fail
httpRequestRetryDelaynumberfalseDelay between retry in ms
httpRequestExponentialBackoffDelaynumberfalseExponential backoff delay in ms when requests to the Node fail
httpRequestMaxExponentialBackoffDelaynumberfalseMaximum exponential backoff delay in ms when requests to the Node fail
getConfirmationMaxRetrynumberfalseMaximum number of retries to get the confirmation of a persistTransaction
getConfirmationRetryDelaynumberfalseDelay between retry in ms to get the confirmation of a persistTransaction
getConfirmationExponentialBackoffDelaynumberfalseExponential backoff delay in ms to get the confirmation of a persistTransaction
getConfirmationMaxExponentialBackoffDelaynumberfalseMaximum exponential backoff delay in ms to get the confirmation of a persistTransaction
getConfirmationDeferDelaynumberfalseDelay to wait in ms before trying for the first time to get the confirmation of a persistTransaction

PaymentNetworkOptions Properties

NameTypeRequired?Description
bitcoinDetectionProviderIBitcoinDetectionProviderfalseOverride default bitcoin payment detection
explorerApiKeysMap<ChainName, string>falseOverride explorer API keys
getSubgraphClientfunction(ChainName)falseOverride subgraph payment detection
getRpcProviderfunction(ChainName)falseOverride RPC node provider

Instance Methods

NameDescription
createRequest()Create an unencrypted request
_createEncryptedRequest()Create an encrypted request. Docs coming soon...
computeRequestId()Compute a request ID without actually creating a request
fromRequestId()Retrieve a request from a requestId
fromIdentity()Retrieve an array of requests from an Identity
fromTopic()Retrieve an array of requests from a topic