Security News
New Proposed CISA Mandate Would Require Critical Infrastructure to Report Ransom Payments Within 24 Hours
CISA has proposed a set of new rules that would require critical infrastructure to report cyber incidents and ransom payments.
@iota/http-client
Advanced tools
Send commands to IRI over HTTP.
Weekly downloads
Readme
Sends commands to IRI
over HTTP
.
Allows to create a network provider compatible with functions in @iota/core
.
Install using npm:
npm install @iota/http-client
or using yarn:
yarn add @iota/http-client
Summary: Creates an HTTP client to access the IRI API.
Param | Type | Default | Description |
---|---|---|---|
[settings] | Object | {} | |
[settings.provider] | String | http://localhost:14265 | URI of an IRI node to connect to |
[settings.apiVersion] | String | number | 1 | IOTA API version to be sent in the X-IOTA-API-Version header. |
[settings.requestBatchSize] | number | 1000 | Number of search values per request |
This method creates an HTTP client that you can use to send requests to the IRI API endpoints.
To send requests to the IRI node, use the send()
method.
Returns: HTTP client object
Example
let settings = {
provider: 'http://mynode.eu:14265'
}
let httpClient = HttpClient.createHttpClient(settings);
Fulil: Object
- Response
Reject: Error
- Request error
Param | Type | Default |
---|---|---|
command | Command | |
[uri] | String | http://localhost:14265 |
[apiVersion] | String | Number | 1 |
Sends an http request to a specified host.
Summary: Sends an API request to the connected IRI node.
Fulfil: Object
response - The response from the IRI node
Reject: Object
error - The connected IOTA node's API returned an error. See the list of error messages
Param | Type | Description |
---|---|---|
command | Object | The request body for the API endpoint |
This method uses the HTTP client to send requests to the IRI API endpoints.
To create an HTTP client, use the createHttpClient()
method.
Example
let httpClient = HttpClient.createHttpClient(settings);
httpClient.send({command:'getNodeInfo'})
.then(response => {
console.log(response);
})
.catch(error => {
console.log(error);
})
Summary: Updates the settings of an existing HTTP client.
Param | Type | Default | Description |
---|---|---|---|
[settings] | Object | {} | |
[settings.provider] | String | http://localhost:14265 | URI of an IRI node to connect to |
[settings.apiVersion] | String | number | 1 | IOTA API version to be sent in the X-IOTA-API-Version header. |
[settings.requestBatchSize] | number | 1000 | Number of search values per request. |
This method updates the settings of an existing HTTP client.
To create an HTTP client, use the createHttpClient()
method.
Example
let settings = {
provider: 'https://nodes.devnet.thetangle.org:443'
}
let httpClient = http.createHttpClient(settings);
httpClient.send({command:'getNodeInfo'}).then(res => {
console.log(res)
}).catch(err => {
console.log(err)
});
httpClient.setSettings({provider:'http://newnode.org:14265'});
httpClient.send({command:'getNodeInfo'}).then(res => {
console.log(res)
}).catch(err => {
console.log(err)
})
FAQs
Send commands to IRI over HTTP.
The npm package @iota/http-client receives a total of 505 weekly downloads. As such, @iota/http-client popularity was classified as not popular.
We found that @iota/http-client demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISA has proposed a set of new rules that would require critical infrastructure to report cyber incidents and ransom payments.
Security News
Redis is no longer OSS, breaking its explicit commitment to remain under the BSD 3-Clause License forever. This has angered contributors who are now working to fork the software.
Product
Socket AI now enables 'AI detected potential malware' alerts by default, ensuring users benefit from AI-powered state-of-the-art malware detection without needing to opt-in.