Skip to content

Module hb_gateway_client.erl

Implementation of Arweave's GraphQL API to gain access to specific items of data stored on the network.

Description

This module must be used to get full HyperBEAM structured@1.0 form messages from data items stored on the network, as Arweave gateways do not presently expose all necessary fields to retrieve this information outside of the GraphQL API. When gateways integrate serving in httpsig@1.0 form, this module will be deprecated.

Function Index

ans104_no_data_item_test/0*
ao_dataitem_test/0*Test optimistic index.
data/2Get the data associated with a transaction by its ID, using the node's Arweave gateway peers.
decode_id_or_null/1*
decode_or_null/1*
item_spec/0*Gives the fields of a transaction that are needed to construct an ANS-104 message.
l1_transaction_test/0*Test l1 message from graphql.
l2_dataitem_test/0*Test l2 message from graphql.
normalize_null/1*
query/2*Run a GraphQL request encoded as a binary.
read/2Get a data item (including data and tags) by its ID, using the node's GraphQL peers.
result_to_message/2Takes a GraphQL item node, matches it with the appropriate data from a gateway, then returns {ok, ParsedMsg}.
result_to_message/3*
scheduler_location/2Find the location of the scheduler based on its ID, through GraphQL.
scheduler_location_test/0*Test that we can get the scheduler location.
subindex_to_tags/1*Takes a list of messages with name and value fields, and formats them as a GraphQL tags argument.

Function Details

ans104_no_data_item_test/0 *

ans104_no_data_item_test() -> any()

ao_dataitem_test/0 *

ao_dataitem_test() -> any()

Test optimistic index

data/2

data(ID, Opts) -> any()

Get the data associated with a transaction by its ID, using the node's Arweave gateway peers. The item is expected to be available in its unmodified (by caches or other proxies) form at the following location: https:///raw/ where <id> is the base64-url-encoded transaction ID.

decode_id_or_null/1 *

decode_id_or_null(Bin) -> any()

decode_or_null/1 *

decode_or_null(Bin) -> any()

item_spec/0 *

item_spec() -> any()

Gives the fields of a transaction that are needed to construct an ANS-104 message.

l1_transaction_test/0 *

l1_transaction_test() -> any()

Test l1 message from graphql

l2_dataitem_test/0 *

l2_dataitem_test() -> any()

Test l2 message from graphql

normalize_null/1 *

normalize_null(Bin) -> any()

query/2 *

query(Query, Opts) -> any()

Run a GraphQL request encoded as a binary. The node message may contain a list of URLs to use, optionally as a tuple with an additional map of options to use for the request.

read/2

read(ID, Opts) -> any()

Get a data item (including data and tags) by its ID, using the node's GraphQL peers. It uses the following GraphQL schema: type Transaction { id: ID! anchor: String! signature: String! recipient: String! owner: Owner { address: String! key: String! }! fee: Amount! quantity: Amount! data: MetaData! tags: [Tag { name: String! value: String! }!]! } type Amount { winston: String! ar: String! }

result_to_message/2

result_to_message(Item, Opts) -> any()

Takes a GraphQL item node, matches it with the appropriate data from a gateway, then returns {ok, ParsedMsg}.

result_to_message/3 *

result_to_message(ExpectedID, Item, Opts) -> any()

scheduler_location/2

scheduler_location(Address, Opts) -> any()

Find the location of the scheduler based on its ID, through GraphQL.

scheduler_location_test/0 *

scheduler_location_test() -> any()

Test that we can get the scheduler location.

subindex_to_tags/1 *

subindex_to_tags(Subindex) -> any()

Takes a list of messages with name and value fields, and formats them as a GraphQL tags argument.