You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We want to mock HttpRequest for our tests. So lets add an optional constructor argument - "creator" function. If it's defined then createXHR method returns its result.
The text was updated successfully, but these errors were encountered:
Yes, the HTTP client in Taquito is injectable. Taquito is a TypeScript library for building ÐApps on the Tezos blockchain, and it allows you to customize and inject your own HTTP client. This feature is useful for developers who want to use a specific HTTP client or implement custom logic for handling network requests.
To inject your own HTTP client, you need to implement the RpcClient interface provided by Taquito. This interface defines the methods that your custom HTTP client should have. Once you have implemented the RpcClient interface, you can pass your custom HTTP client instance to the RpcProvider or TezosToolkit constructor.
Here's an example of how to inject a custom HTTP client:
import{TezosToolkit,RpcClient,RpcProvider}from'@taquito/taquito';classMyCustomHttpClientimplementsRpcClient{// Implement required methods from RpcClient interface// ...}constcustomHttpClient=newMyCustomHttpClient();constrpcProvider=newRpcProvider(customHttpClient);consttezos=newTezosToolkit(rpcProvider);
By injecting your custom HTTP client, you can control how Taquito interacts with the Tezos RPC and customize the behavior as per your requirements.
We want to mock
HttpRequest
for our tests. So lets add an optional constructor argument - "creator" function. If it's defined thencreateXHR
method returns its result.The text was updated successfully, but these errors were encountered: