Returns the final resolved endpoints urls currenctly in used by the client to reach dfuse services.
This is useful when using Apollo Client passing it the computed url without effort.
const wsLink = new WebSocketLink({
uri: dfuseClient.endpoints.graphqlStreamUrl,
...,
});
Call this method each time you need an API token. Th returned API token is always valid. The expiration and the refresh of the token is handled automatically when using this method.
An helper method that can be used to perform a generic HTTP call using the library inner configured HttpClient.
This can be used to reach other REST API found on the nodeos
process for example, those that are not directly included
in the library but are still accessible via our endpoint
like a /v1/chain/get_info
or /v1/chain/push_transaction
.
(required) The HTTP path on the endpoint
(required) The HTTP method to perform the request agaisnt
(defaults {}
) The HTTP query parameters to append to the url, they will
be url-encoded and included in the final remote url. Has no effect when empty or undefined.
(defaults undefined
) The HTTP body to include in the request, assumed to be a
JSON object that will be serialized to a string. Not included in the HTTP request when undefined
.
(defaults {}
) The extra HTTP headers to include in the request. Those will be merged
with default ones ({ Authorization: ... }
) and they override them if same key are specified.
A Promise
that will resolve to the response body if it passes. Will reject with a
DfuseApiError if it fits the dfuse Error Format or a generic DfuseError
is it's something
not fitting our expected format (nodeos
erorr format for example).
POST /v1/auth/issue
(on https://auth.dfuse.io
by default, see DfuseClientOptions.authUrl)
Issues dfuse API token for the following API key.
(defaults undefined
, uses the one defined on the client) The
apiKey
to generate an API token for.
If left undefined, the client will provide the one it is configured with, if
present.
GET /v0/block_id/by_time
Fetches the block ID, block time and block number for the given timestamp.
The reference timestamp to query for. If it's a string, assumed to be
in ISO8601 extended format, i.e. 2019-03-04T10:36:14.5Z
. If it's a date, it's
going to be turned into an ISO8601 extended format relative to UTC
.
Comparison operator for the block time. Should be one of:
gt
(Greater Than time
)gte
(Greater Than or Equal to time
)lt
(Lower Than time
)lte
(Lower Than or Equal totime
)eq
(Strictly equal to time
)A promise resolving to a BlockIdByTimeResponse object if the request was correct, or rejects with a DfuseApiError when it failed (or a more DfuseError when an unexpected error occurs).
GET /v0/transactions/:id
Retrieves a TransactionLifecycle object representing the transaction that
has for id <id>
.
The transaction id to search for.
A promise resolving to a TransactionLifecycle object if the request was correct, or rejects with a DfuseApiError when it failed (or a more DfuseError when an unexpected error occurs).
Perform a query
or mutation
via the HTTP transport layer. The
semantic of this method is to resolve the promise with the GraphQL
response when the operation succeed on the server, whenever the
actual GraphQL response contains an errors
field or not.
If an error at the HTTP error, the promise will be rejected.
(required) The GraphQL operation document to perform. It must be
either a query
or mutation
operation. A subscription
operation is not supported by this method. You must use
the method that accept options.onMessage
to make it work.
(optional) Specific options that can be provided
Perform a query
, mutation
or subscription
via the WebSocket transport
layer. The semantic of this method is to resolve the promise with the Stream
object if the connection was established correctly (or if it was already
established) and the initial subscription message was sent correctly (this does
not check if it was received correctly).
Each message for the subscription will be sent to the onMessage
handler defined
on the options
field.
The Stream object can be used to control the stream. It can be marked via Stream.mark (so on reconnect, this stream restarts at the last marked location), joined via Stream.join (so you wait until the stream actually finishes) or closed via Stream.close.
If we are unable to establish the connection or the initial send message cannot be sent, then the promise will reject with the appropriate error.
(required) The GraphQL operation document to perform.
(required) Specific options that can be provided
Release any resources hold by this DfuseClient instance. Must be tolerant to being called multiple times.
Once called, the instance is assumed unsuable and should never be invoked anymore.
GET /v0/search/transactions
Search an EOSIO blockchain for transactions based on free-form criterias, using the simple dfuse Search query language.
Search query string. See Search language (https://docs.dfuse.io/#ref-search-query-specs) specs for details.
(optional) Optional parameters
GET /v0/state/abi
Fetches the ABI for a given contract account, at any block height.
Contract account targeted by the action.
(optional) Optional parameters
GET /v0/state/abi/bin_to_json
Fetches the ABI for a given contract account, at any block height.
Contract account targeted by the action.
The name-encoded table name you want to retrieve. For example, user balances for tokens live in the accounts table. Refer to the contract's ABI for a list of available tables. This is contract dependent.
An array of hexadecimal rows to decode. Each row must be a valid hexadecimal string representation of the row to decode against the ABI.
(optional) Optional parameters
GET /v0/state/key_accounts
Fetches the accounts controlled by the given public key, at any block height.
The public key to fetch controlled accounts for.
(optional) Optional parameters
GET /v0/state/permission_links
Fetches snapshots of any account's linked authorizations on the blockchain, at any block height.
Contract account targeted by the action.
(optional) Optional parameters
GET /v0/state/table
Fetches the state of any table, at any block height.
Contract account targeted by the action.
The name-encoded scope of the table you are requesting. For example, user balances for tokens live in their account name's scope. This is contract dependent, so inspect the ABI for the contract you are interested in.
The name-encoded table name you want to retrieve. For example, user balances for tokens live in the accounts table. Refer to the contract's ABI for a list of available tables. This is contract dependent.
(optional) Optional parameters
GET /v0/state/table/row
Fetches a single row from the state of any table, at any block height.
Contract account targeted by the action.
The name-encoded scope of the table you are requesting. For example, user balances for tokens live in their account name's scope. This is contract dependent, so inspect the ABI for the contract you are interested in.
The name-encoded table name you want to retrieve. For example, user balances for tokens live in the accounts table. Refer to the contract's ABI for a list of available tables. This is contract dependent.
The string representation of the primary key that you want to retrieve. The
primaryKey
is always a string, but can be encoded differently, for example name
encoded
like an account. The keyType
is used to know how to transform the value in the string to the
correct type.
(optional) Optional parameters
GET /v0/state/table_scopes
Fetches a list of scopes, for a given table on a contract account, at any block height.
Contract account holding the requested table.
The name-encoded table name you want to retrieve scopes from. Refer to the contract's ABI for a list of available tables. This is contract dependent.
(optional) Optional parameters
GET /v0/state/tables/accounts
Fetches a table for a given contract account for a group of scopes, at any block height.
An AccountName list a maximum of 1500 elements can be present in the list.
A Name list, a maximum of 1500 elements can be present in the list.
The name-encoded table name you want to retrieve. For example, user balances for tokens live in the accounts table. Refer to the contract's ABI for a list of available tables. This is contract dependent.
(optional) Optional parameters
GET /v0/state/tables/scopes
Fetches a table for a given contract account for a group of scopes, at any block height.
Contract account targeted by the action.
The name-encoded table name you want to retrieve. For example, user balances for tokens live in the accounts table. Refer to the contract's ABI for a list of available tables. This is contract dependent.
(optional) Optional parameters
Retrieve a stream of actions, filtered by receiver(s), account(s) and action name(s).
(required) Specific stream options used to filter
(required) The callback that will be invoked for each message received for this specific stream.
(defaults undefined
) The stream common options that can be used,
see StreamOptions for more details and default values.
Retrieve a stream of informations about the chain as it moves forward
(required) The callback that will be invoked for each message received for this specific stream.
(defaults undefined
) The stream common options that can be used,
see StreamOptions for more details and default values.
Retrieve a stream of changes to the tables, the side effects of transactions/actions being executed.
(required)
(required) The callback that will be invoked for each message received for this specific stream.
(defaults undefined
) The stream common options that can be used,
see StreamOptions for more details and default values.
Retrieve a transaction_lifecycle
(when fetch
is true) and follow its life-cycle
(when listen
is true).
(required)
(required) The callback that will be invoked for each message received for this specific stream.
(defaults undefined
) The stream common options that can be used,
see StreamOptions for more details and default values.
Generated using TypeDoc
The
DfuseClient
interface is the back-bone of the library. Based on the Facade pattern, this client is your single go to point for interacting with dfuse Stream API as well as the dfuse REST API.The client contains only top-level methods enabling you to retrieve all the information you need for your next-gen blockchain project.
The dfuse Client takes care for you of:
Interfaces