@farcaster/hub-web 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,46 @@
1
+ # @farcaster/hub-web
2
+
3
+ A lightweight, fast Typescript interface for Farcaster Hubs. Designed to work with [Hubble](https://github.com/farcasterxyz/hubble/) and any other Hub that implements the [Farcaster protocol](https://github.com/farcasterxyz/protocol).
4
+
5
+ ## Features
6
+
7
+ - Call any Hub endpoint from browser environment (or node environemnt using grpc-web).
8
+ - Serializes and deserializes Farcaster protobufs into Javascript objects.
9
+ - Has helpers to create and sign Farcaster messages.
10
+ - Written entirely in TypeScript, with strict types for safety.
11
+
12
+ ## Installation
13
+
14
+ Install @farcaster/hub-web with the package manager of your choice
15
+
16
+ ```bash
17
+ npm install @farcaster/hub-web
18
+ yarn add @farcaster/hub-web
19
+ pnpm install @farcaster/hub-web
20
+ ```
21
+
22
+ ### Fetching Data from Hubs
23
+
24
+ ```typescript
25
+ import { getInsecureHubRpcClient } from '@farcaster/hub-web';
26
+
27
+ (async () => {
28
+ // if you are testing from a node environment
29
+ // const client = getInsecureHubRpcClient('testnet1.farcaster.xyz:2284', false);
30
+
31
+ // if you are testing from a braowser environment
32
+ const client = getInsecureHubRpcClient('testnet1.farcaster.xyz:2284');
33
+
34
+ const castsResult = await client.getCastsByFid({ fid: 7884 });
35
+
36
+ castsResult.map((casts) => casts.messages.map((cast) => console.log(cast.data?.castAddBody?.text)));
37
+ })();
38
+ ```
39
+
40
+ ## Contributing
41
+
42
+ Please see our [contributing guidelines](https://github.com/farcasterxyz/hubble/blob/main/CONTRIBUTING.md) before making a pull request.
43
+
44
+ ## License
45
+
46
+ MIT License