MCPcopy Index your code
hub / github.com/chain/Core / Feed

Class Feed

sdk/java/src/main/java/com/chain/api/Transaction.java:1074–1216  ·  view source on GitHub ↗

When used in conjunction with /list-transactions, Feeds can be used to receive notifications about transactions.

Source from the content-addressed store, hash-verified

1072 * receive notifications about transactions.
1073 */
1074 public static class Feed {
1075 /**
1076 * Feed ID, automatically generated when a feed is created.
1077 */
1078 public String id;
1079
1080 /**
1081 * An optional, user-supplied alias that can be used to uniquely identify
1082 * this feed.
1083 */
1084 public String alias;
1085
1086 /**
1087 * The query filter used in /list-transactions.
1088 */
1089 public String filter;
1090
1091 /**
1092 * Indicates the last transaction consumed by this feed.
1093 */
1094 public String after;
1095
1096 private ListIterator<Transaction> txIter;
1097 private Transaction lastTx;
1098
1099 /**
1100 * Creates a feed.
1101 *
1102 * @param client client object that makes requests to core
1103 * @param alias an alias which uniquely identifies this feed
1104 * @param filter a query filter which identifies which transactions this feed consumes
1105 * @return a feed object
1106 * @throws ChainException
1107 */
1108 public static Feed create(Client client, String alias, String filter) throws ChainException {
1109 Map<String, Object> req = new HashMap<>();
1110 req.put("alias", alias);
1111 req.put("filter", filter);
1112 req.put("client_token", UUID.randomUUID().toString());
1113 return client.request("create-transaction-feed", req, Feed.class);
1114 }
1115
1116 /**
1117 * Retrieves a feed by ID.
1118 *
1119 * @param client client object that makes requests to core
1120 * @param id the feed id
1121 * @return a feed object
1122 * @throws ChainException
1123 */
1124 public static Feed getByID(Client client, String id) throws ChainException {
1125 Map<String, Object> req = new HashMap<>();
1126 req.put("id", id);
1127 return client.request("get-transaction-feed", req, Feed.class);
1128 }
1129
1130 /**
1131 * Retrieves a feed by alias.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected