Options
All
  • Public
  • Public/Protected
  • All
Menu

@dfuse/client

Index

Enumerations

Classes

Interfaces

Type aliases

Variables

Functions

Type aliases

Abi

Abi: object

The actual ABI JSON representation as returned by EOSIO platform. Extracted from EOSIO/eosjs library.

see

https://github.com/EOSIO/eosjs/blob/develop/src/eosjs-rpc-interfaces.ts#L4

Type declaration

AccountRamDelta

AccountRamDelta: object

Type declaration

Action

Action: object

Type declaration

ActionReceipt

ActionReceipt: object

Type declaration

ActionTrace

ActionTrace: object

Type declaration

ActionTraceData

ActionTraceData: object

Type declaration

ActionTraceDbOp

ActionTraceDbOp: object

The dbops array out of an ActionTraceData message is completely different than other DbOp found in dfuse API (like on TableDeltaData or TransactionLifecycle).

One for opayer or npayer will always be present depending on the operation, same thing for the old and new fields:

  • When op == "INS", npayer and new are present
  • When op == "UPD", opayer, old, npayer and new are present
  • When op == "REM", opayer and old are present

The old and new fields are the hexadecimal string encoded representing the row in binary format.

Check the Decode Hex Data using eosjs example for a way to transform the hexadecimal string into a JSON structure representing the row.

see

https://github.com/dfuse-io/example-eosjs-decode-hex

Type declaration

ApiTokenInfo

ApiTokenInfo: object

Type declaration

AuthTokenResponse

AuthTokenResponse: ApiTokenInfo

Authorization

Authorization: object

Type declaration

BlockHeader

BlockHeader: object

Type declaration

BlockIdByTimeResponse

BlockIdByTimeResponse: object

Type declaration

ComparisonOperator

ComparisonOperator: "gt" | "gte" | "lt" | "lte" | "eq"

ConnectOptions

ConnectOptions: object

Type declaration

CreationNode

CreationNode: [number, number, number]

Represents a node in the creation tree. first number represents the creation node index second number represents the parent node index (-1 for root) third number represents the action index

DBOp

DBOp: DbOp<T>
deprecated

Renamed to DbOp

DTrxOp

DTrxOp: object

Type declaration

DbOp

DbOp: object

Type declaration

DbRow

DbRow: object

One of error, hex or json field will be present depending on the actual request made.

Type declaration

DfuseClientEndpoints

DfuseClientEndpoints: object

Type declaration

ErrorData

ErrorData: object

Type declaration

ExtDTrxOp

ExtDTrxOp: object & DTrxOp

GetActionTracesMessageData

GetActionTracesMessageData: object

Type declaration

GetTableRowsMessageData

GetTableRowsMessageData: object

Type declaration

GetTransactionLifecycleMessageData

GetTransactionLifecycleMessageData: object

Type declaration

HeadInfoData

HeadInfoData: object

Type declaration

HttpHeaders

HttpHeaders: Record<string, string>

HttpQueryParameters

HttpQueryParameters: Record<string, any>

InboundMessage

InboundMessage: object

Type declaration

Int64

Int64: number | string

A int64_t natively in nodeos but can become a string when > 32 bits number due to how nodeos serialize number to JSON.

This is like because JavaScript largest number possible is 53 bits large which make it impossible to hold a full int64_t type. To overcome that, nodeos will output a string when number is too large to preserve precision.

LinkedPermission

LinkedPermission: object

Type declaration

ListeningData

ListeningData: object

Type declaration

MultiStateResponse

MultiStateResponse: object

Type declaration

OnStreamMessage

OnStreamMessage: function

Type declaration

OnStreamRestart

OnStreamRestart: function

Type declaration

    • (): void
    • Returns void

OutboundMessage

OutboundMessage: object

Type declaration

ProgressData

ProgressData: object

Type declaration

RAMOp

RAMOp: RamOp
deprecated

Renamed to RamOp

RamOp

RamOp: object

Type declaration

RequestIdGenerator

RequestIdGenerator: function

Type declaration

    • (): string
    • Returns string

RequestInit

RequestInit: object

Type declaration

ScheduleJob

ScheduleJob: function

Type declaration

    • (): void
    • Returns void

SearchSortType

SearchSortType: "asc" | "desc"

SearchTransactionRow

SearchTransactionRow: object

Type declaration

SearchTransactionsResponse

SearchTransactionsResponse: object

Type declaration

SocketMessageListener

SocketMessageListener: function

Type declaration

StateAbiResponse

StateAbiResponse: object

Type declaration

StateAbiToJsonResponse

StateAbiToJsonResponse: object

Type declaration

StateKeyAccountsResponse

StateKeyAccountsResponse: object

Type declaration

StateKeyType

StateKeyType: "name" | "hex" | "hex_be" | "uint64"

StatePermissionLinksResponse

StatePermissionLinksResponse: object

Type declaration

StateResponse

StateResponse: object

Type declaration

StateTableScopesResponse

StateTableScopesResponse: object

Type declaration

StreamMarker

StreamMarker: object

Represents a marker of stream which indicates where the stream is currently at in its processing of messages.

The marker can be later re-used to restart a Stream at the right location.

Type declaration

StreamOptions

StreamOptions: object

Type declaration

TableDeltaData

TableDeltaData: object

Type declaration

TableOp

TableOp: object

Type declaration

TableRows

TableRows: object

Type declaration

TableSnapshotData

TableSnapshotData: object

Type declaration

Transaction

Transaction: object

Type declaration

TransactionLifecycle

TransactionLifecycle: object

Type declaration

TransactionLifecycleData

TransactionLifecycleData: object

Type declaration

TransactionReceipt

TransactionReceipt: object

Type declaration

TransactionStatus

TransactionStatus: "pending" | "delayed" | "canceled" | "expired" | "executed" | "soft_fail" | "hard_fail"

TransactionTrace

TransactionTrace: object

Type declaration

Uint64

Uint64: number | string

A uint64_t natively in nodeos but can become a string when > 32 bits number due to how nodeos serialize number to JSON.

This is like because JavaScript largest number possible is 53 bits large which make it impossible to hold a full uint64_t type. To overcome that, nodeos will output a string when number is too large to preserve precision.

UnlistenMessageData

UnlistenMessageData: object

Type declaration

WebSocketFactory

WebSocketFactory: function

Type declaration

    • (url: string): Promise<WebSocket>
    • Parameters

      • url: string

      Returns Promise<WebSocket>

Variables

Const DEFAULT_DELAY_BUFFER_PERCENT

DEFAULT_DELAY_BUFFER_PERCENT: 0.95 = 0.95

Const DEFAULT_KEEP_ALIVE_INTERVAL_IN_MS

DEFAULT_KEEP_ALIVE_INTERVAL_IN_MS: 30000 = 30000

Const DEFAULT_RECONNECT_DELAY_IN_MS

DEFAULT_RECONNECT_DELAY_IN_MS: 2500 = 2500

Const V0_FETCH_BLOCK_ID_BY_TIME

V0_FETCH_BLOCK_ID_BY_TIME: "/v0/block_id/by_time" = "/v0/block_id/by_time"

Const V0_FETCH_TRANSACTION

V0_FETCH_TRANSACTION: "/v0/transactions/:id" = "/v0/transactions/:id"

Const V0_SEARCH_TRANSACTIONS

V0_SEARCH_TRANSACTIONS: "/v0/search/transactions" = "/v0/search/transactions"

Const V0_STATE_ABI

V0_STATE_ABI: "/v0/state/abi" = "/v0/state/abi"

Const V0_STATE_ABI_BIN_TO_JSON

V0_STATE_ABI_BIN_TO_JSON: "/v0/state/abi/bin_to_json" = "/v0/state/abi/bin_to_json"

Const V0_STATE_KEY_ACCOUNTS

V0_STATE_KEY_ACCOUNTS: "/v0/state/key_accounts" = "/v0/state/key_accounts"

Const V0_STATE_PERMISSION_LINKS

V0_STATE_PERMISSION_LINKS: "/v0/state/permission_links" = "/v0/state/permission_links"

Const V0_STATE_TABLE

V0_STATE_TABLE: "/v0/state/table" = "/v0/state/table"

Const V0_STATE_TABLES_ACCOUNTS

V0_STATE_TABLES_ACCOUNTS: "/v0/state/tables/accounts" = "/v0/state/tables/accounts"

Const V0_STATE_TABLES_SCOPES

V0_STATE_TABLES_SCOPES: "/v0/state/tables/scopes" = "/v0/state/tables/scopes"

Const V0_STATE_TABLE_SCOPES

V0_STATE_TABLE_SCOPES: "/v0/state/table_scopes" = "/v0/state/table_scopes"

Const V1_AUTH_ISSUE

V1_AUTH_ISSUE: "/v1/auth/issue" = "/v1/auth/issue"

Functions

createApiTokenManager

  • Create the standard ApiTokenManager interface that will manage all the lifecycle of a token.

    kind

    Factories

    Parameters

    • fetchTokenInfo: function

      The async function that should be used to retrieve a fresh token.

    • onTokenRefresh: function

      The function to call when a token has been refreshed.

        • (apiToken: string): void
        • Parameters

          • apiToken: string

          Returns void

    • delayBuffer: number

      The percentage of time to use to schedule the next token refresh (i.e. with a value of 0.9 and a token valid for 1000ms from now, the next refresh would be scheduled to happen at now + (0.9 * 1000))

    • apiTokenStore: ApiTokenStore

      The API token store interface to retrieve token from and to save it back to.

    • refreshScheduler: RefreshScheduler

      The scheduler interface that should be used to schedule upcoming refresh token and check if a scheduled one already exist.

    Returns ApiTokenManager

createDfuseClient

  • The main entry point of the library, use it to create the standard DfuseClient instance.

    Only the apiKey and network parameters are mandatory, all others have sane default values based on your execution environment (be it a Browser or Node.js).

    This will create the default

    kind

    Factories

    Parameters

    Returns DfuseClient

createHttpClient

  • Create the default HttpClient concrete implementation.

    Parameters

    • authUrl: string

      The full dfuse Authentication url to use to perform the authRequest calls.

    • apiUrl: string

      The full dfuse REST API url to use to perform the apiRequest calls.

    • Default value options: HttpClientOptions = {}

      The set of options used to construct the default HttpClient instance. See HttpClientOptions for documentation of the options and default values for each of them.

    Returns HttpClient

createRefreshScheduler

createSocket

  • Create an actual Socket instance that will be used as the interface to wrap all communicaton of the WebSocket protocol.

    Parameters

    • url: string

      The url used to reach the dfuse Stream API, should not contain the token query parameter.

    • Default value options: SocketOptions = {}

      The options used to configure the Socket instance, see SocketOptions for default options.

    Returns Socket

createStreamClient

dynamicMessageDispatcher

  • This small utility is useful to implement a dynamic dispatcher based on the type of message. That is usefull to avoid having to code yourself a switch (message.type) { ... } switch case.

    Instead, define a series of specific of handlers on a class or an object, then when calling the stream method of your choices, pass the dynamic dispatcher created by calling this method as the message handler.

    The created dispatcher upon each message, will check the received type to handler map and will dispatch it there.

    const dispatch = dynamicMessageDispatcher({
      listening: this.onListening,
      progress: this.onProgress,
      action_trace: this.onAction,
    })
    
    client.streamActionTraces({ ... }, dispatcher)

    Parameters

    Returns OnStreamMessage

flattenActionTraces

  • This method flattens the nested action traces of a TransactionLifecycle into a single flat list. The flat list indexes matches dfuse API action index which is used within dfuse to identify particular action trace in various situation (db ops, RAM ops, etc).

    The action index of a given action is obtained simply by doing a deep-first traversal of the action traces structure incrementing a counter at each step and binding the counter to the current traversed action becoming the action's index.

    As an example of this method, assume the following transaction:

    Transaction 123 {
      ExecutionTrace {
        ActionTraces: [
          ActionTrace(eosio.token/eosio.token:transfer) {
            InlineTraces: [
              ActionTrace(from/eosio.token:transfer) {
                InlineTraces: [
                  ActionTrace(contractX/contractX:log)
                ]
              }
              ActionTrace(to/eosio.token:transfer) {
                InlineTraces: [
                  ActionTrace(contractY/contractY:update)
                ]
              }
            ]
          }
        ]
      }
    }

    This will results in the following flattened actions list being returned:

    [
      ActionTrace(eosio.token/eosio.token:transfer),
      ActionTrace(from/eosio.token:transfer),
      ActionTrace(contractX/contractX:log),
      ActionTrace(to/eosio.token:transfer),
      ActionTrace(contractY/contractY:update),
    ]

    Parameters

    Returns ActionTrace<any>[]

    A flat list of action traces extracted from the transaction lifecycle for which each index of the list represents the action's index concept of dfuse API.

getActionTracesMessage

getHeadInfoMessage

getTableRowsMessage

getTransactionLifecycleMessage

isApiTokenExpired

matchingActionTraces

  • This method extracts the matchinf actions out of SearchTransactionRow object.

    Using the search endpoint, you receives a SearchTransactionRow that is simply a composite object containing an actual TransactionLifecycle element as well as a list of action indexes which are the actual ones that matched your query.

    A single transaction can contains a big amount of actions but usually, only a subset of the actions in a transaction matches your search query.

    By using this method, you can easily extracts the matching actions out of the SearchTransactionRow object.

    Parameters

    Returns ActionTrace<any>[]

    A flat list of action traces extracted from the search result row that matched the query term(s).

networkToEndpoint

  • networkToEndpoint(network: string): string

unlistenMessage

waitFor

  • waitFor(ms: number): Promise<Object>

Generated using TypeDoc