- Source:
Methods
(async, static) hash(chainId, hash, networkopt, hostopt) → {Promise}
Query block header by its block hash
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
chainId |
number | string | a chain id that is valid for the network | ||
hash |
string | block hash | ||
network |
string |
<optional> |
"mainnet01" | chainweb network |
host |
string |
<optional> |
"https://api.chainweb.com" | chainweb api host |
- Source:
Returns:
Block header with the requested hash
- Type
- Promise
(async, static) height(chainId, hash, networkopt, hostopt) → {Promise}
Query block header by its height
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
chainId |
number | string | a chain id that is valid for the network | ||
hash |
string | block height | ||
network |
string |
<optional> |
"mainnet01" | chainweb network |
host |
string |
<optional> |
"https://api.chainweb.com" | chainweb api host |
- Source:
Returns:
Block header at the requested height
- Type
- Promise
(async, static) range(chainId, start, end, networkopt, hostopt) → {Promise}
Headers from a range of block heights
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
chainId |
number | string | a chain id that is valid for the network | ||
start |
number | start block height | ||
end |
number | end block height | ||
network |
string |
<optional> |
"mainnet01" | chainweb network |
host |
string |
<optional> |
"https://api.chainweb.com" | chainweb api host |
- Source:
Returns:
Array of block headers in ascending order.
- Type
- Promise
(async, static) recent(chainId, depth, n, networkopt, hostopt) → {Promise}
Recent Headers
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
chainId |
number | string | a chain id that is valid for the network | ||
depth |
number | 0 | confirmation depth. Only headers at this depth are returned | |
n |
number | 1 | maximual number of headers that are returned. The actual number of returned headers may be lower. | |
network |
string |
<optional> |
"mainnet01" | chainweb network |
host |
string |
<optional> |
"https://api.chainweb.com" | chainweb api host |
- Source:
Returns:
Array of headers in ascending order.
- Type
- Promise
(static) stream(depth, chainIds, callback, networkopt, hostopt)
Apply callback to new header.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
depth |
number | confirmation depth at which blocks are yielded | ||
chainIds |
Array.<number> | array of chainIds from which blocks are included | ||
callback |
blockCallback | function that is called for each header | ||
network |
string |
<optional> |
"mainnet01" | chainweb network |
host |
string |
<optional> |
"https://api.chainweb.com" | chainweb api host |
- Source:
Returns:
the event source object the backs the stream