Skip to main content

Class: HttpMetaMaskDataAccess#

"http-metamask-data-access".HttpMetaMaskDataAccess

Exposes a Data-Access module over HTTP

Hierarchy#

Implements#

  • IDataAccess

Constructors#

constructor#

+ new HttpMetaMaskDataAccess(__namedParameters: { ethereumProviderUrl: string ; httpConfig: Partial<IHttpDataAccessConfig> ; nodeConnectionConfig: AxiosRequestConfig<any> ; web3: any }): HttpMetaMaskDataAccess

Overrides HttpDataAccess.constructor

Defined in request-client.js/src/http-metamask-data-access.ts:26

Creates an instance of HttpDataAccess.

Parameters:#

NameTypeDefault value
__namedParameters{ ethereumProviderUrl: string ; httpConfig: Partial<IHttpDataAccessConfig> ; nodeConnectionConfig: AxiosRequestConfig<any> ; web3: any }{
httpConfig: {},
nodeConnectionConfig: {},
} |

Returns: HttpMetaMaskDataAccess

Properties#

axiosConfig#

Protected axiosConfig: AxiosRequestConfig

Inherited from HttpDataAccess.axiosConfig

Defined in request-client.js/src/http-data-access.ts:25

Configuration that will be sent to axios for each request. We can also create a AxiosInstance with axios.create() but it dramatically complicates testing.


cache#

cache: { [channelId:string]: { [ipfsHash:string]: { block: IBlock ; storageMeta: any } | null; }; }

Defined in request-client.js/src/http-metamask-data-access.ts:18

Cache block persisted directly (in case the node did not have the time to retrieve it) (public for easier testing)


httpConfig#

Protected httpConfig: IHttpDataAccessConfig

Inherited from HttpDataAccess.httpConfig

Defined in request-client.js/src/http-data-access.ts:19

Configuration that overrides http-config-defaults,

see httpConfigDefaults for the default configuration.


networkName#

Private networkName: string = ""

Defined in request-client.js/src/http-metamask-data-access.ts:26


provider#

Private provider: JsonRpcProvider | Web3Provider

Defined in request-client.js/src/http-metamask-data-access.ts:25


submitterContract#

Private submitterContract: Contract | undefined

Defined in request-client.js/src/http-metamask-data-access.ts:24

Methods#

_getStatus#

_getStatus(detailed?: boolean): Promise<any>

Inherited from HttpDataAccess._getStatus

Defined in request-client.js/src/http-data-access.ts:184

Gets information from the node (version, files etc...)

Parameters:#

NameTypeDescription
detailed?booleanif true get the list of files hashes

Returns: Promise<any>


close#

close(): Promise<void>

Inherited from HttpDataAccess.close

Defined in request-client.js/src/http-data-access.ts:74

Closes the module. Does nothing, exists only to implement IDataAccess

Returns: Promise<void>

nothing


fetchAndRetry#

ProtectedfetchAndRetry(url: string, params: any, retryConfig: { maxRetries?: number ; retryDelay?: number }): Promise<any>

Inherited from HttpDataAccess.fetchAndRetry

Defined in request-client.js/src/http-data-access.ts:196

Sends an HTTP GET request to the node and retries until it succeeds. Throws when the retry count reaches a maximum.

Parameters:#

NameTypeDefault valueDescription
urlstring-HTTP GET request url
paramsany-HTTP GET request parameters
retryConfig{ maxRetries?: number ; retryDelay?: number }{}Maximum retry count and delay between retries

Returns: Promise<any>


getCachedTransactionsAndCleanCache#

getCachedTransactionsAndCleanCache(channelId: string, storageLocationFromNode: string[], timestampBoundaries?: ITimestampBoundaries): IReturnGetTransactions

Defined in request-client.js/src/http-metamask-data-access.ts:234

Gets the cached transactions and remove the ones that have been retrieved from the node (public for easier testing)

Parameters:#

NameTypeDescription
channelIdstringThe channel id to search for
storageLocationFromNodestring[]location retrieved from the node
timestampBoundaries?ITimestampBoundariesfilter timestamp boundaries

Returns: IReturnGetTransactions


getChannelsByMultipleTopics#

getChannelsByMultipleTopics(topics: string[], updatedBetween?: ITimestampBoundaries): Promise<IReturnGetChannelsByTopic>

Inherited from HttpDataAccess.getChannelsByMultipleTopics

Defined in request-client.js/src/http-data-access.ts:172

Gets all the transactions of channel indexed by multiple topics from the node through HTTP.

Parameters:#

NameTypeDescription
topicsstring[]topics to search for
updatedBetween?ITimestampBoundariesfilter timestamp boundaries

Returns: Promise<IReturnGetChannelsByTopic>


getChannelsByTopic#

getChannelsByTopic(topic: string, updatedBetween?: ITimestampBoundaries): Promise<IReturnGetChannelsByTopic>

Inherited from HttpDataAccess.getChannelsByTopic

Defined in request-client.js/src/http-data-access.ts:159

Gets all the transactions of channel indexed by topic from the node through HTTP.

Parameters:#

NameTypeDescription
topicstringtopic to search for
updatedBetween?ITimestampBoundariesfilter timestamp boundaries

Returns: Promise<IReturnGetChannelsByTopic>


getTransactionsByChannelId#

getTransactionsByChannelId(channelId: string, timestampBoundaries?: ITimestampBoundaries): Promise<IReturnGetTransactions>

Overrides HttpDataAccess.getTransactionsByChannelId

Defined in request-client.js/src/http-metamask-data-access.ts:186

Gets the transactions for a channel from the node through HTTP.

Parameters:#

NameTypeDescription
channelIdstringThe channel id to search for
timestampBoundaries?ITimestampBoundariesfilter timestamp boundaries

Returns: Promise<IReturnGetTransactions>


initialize#

initialize(): Promise<void>

Overrides HttpDataAccess.initialize

Defined in request-client.js/src/http-metamask-data-access.ts:64

Initialize the module. Does nothing, exists only to implement IDataAccess

Returns: Promise<void>

nothing


persistTransaction#

persistTransaction(transactionData: ITransaction, channelId: string, topics?: string[]): Promise<DataAccessTypes.IReturnPersistTransaction>

Overrides HttpDataAccess.persistTransaction

Defined in request-client.js/src/http-metamask-data-access.ts:75

Persists a new transaction using the node only for IPFS but persisting on ethereum through local provider

Parameters:#

NameTypeDescription
transactionDataITransactionThe transaction data
channelIdstring-
topics?string[]The topics used to index the transaction

Returns: Promise<DataAccessTypes.IReturnPersistTransaction>