@farcaster/hub-web 0.9.5 → 0.9.6
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.grpcweb.md +2 -2
- package/README.md +22 -1
- package/package.json +2 -2
package/README.grpcweb.md
CHANGED
@@ -53,7 +53,7 @@ import { getHubRpcClient } from '@farcaster/hub-web';
|
|
53
53
|
(async () => {
|
54
54
|
const client = getHubRpcClient('https://testnet1.farcaster.xyz:2285');
|
55
55
|
|
56
|
-
// If you're using gRPC-Web from a
|
56
|
+
// If you're using gRPC-Web from a Node.js environment, add a second false parameter
|
57
57
|
// const nodeClient = getHubRpcClient('https://testnet1.farcaster.xyz:2285', false);
|
58
58
|
})();
|
59
59
|
```
|
@@ -69,7 +69,7 @@ import { getHubRpcClient } from '@farcaster/hub-web';
|
|
69
69
|
| Name | Type | Description |
|
70
70
|
| :---------- | :-------- | :------------------------------------------------------------------------- |
|
71
71
|
| `url` | `string` | Address and RPC port string (e.g. `https://testnet1.farcaster.xyz:2285`) |
|
72
|
-
| `isBrowser` | `boolean` | Optional parameter indicating whether to use the gRPC-Web
|
72
|
+
| `isBrowser` | `boolean` | Optional parameter indicating whether to use the gRPC-Web Node.js transport |
|
73
73
|
|
74
74
|
### Streaming hub events
|
75
75
|
|
package/README.md
CHANGED
@@ -33,13 +33,34 @@ try {
|
|
33
33
|
const response = await axios.get(`${server}/v1/castsByFid?fid=${fid}`);
|
34
34
|
|
35
35
|
console.log(`API Returned HTTP status ${response.status}`);
|
36
|
-
console.log(`
|
36
|
+
console.log(`The first cast's text is ${response.messages[0].data.castAddBody.text}`);
|
37
37
|
} catch (e) {
|
38
38
|
// Handle errors
|
39
39
|
console.log(response);
|
40
40
|
}
|
41
41
|
```
|
42
42
|
|
43
|
+
### Get the username by FID
|
44
|
+
|
45
|
+
```typescript
|
46
|
+
const getFnameFromFid = async (
|
47
|
+
fid: number,
|
48
|
+
client: HubRpcClient
|
49
|
+
): HubAsyncResult<string> => {
|
50
|
+
const result = await client.getUserData({
|
51
|
+
fid: fid,
|
52
|
+
userDataType: UserDataType.FNAME,
|
53
|
+
});
|
54
|
+
return result.map((message) => {
|
55
|
+
if (isUserDataAddMessage(message)) {
|
56
|
+
return message.data.userDataBody.value;
|
57
|
+
} else {
|
58
|
+
return '';
|
59
|
+
}
|
60
|
+
});
|
61
|
+
};
|
62
|
+
```
|
63
|
+
|
43
64
|
### Running the examples
|
44
65
|
|
45
66
|
There are several examples in the `examples/` folder. To run the examples, please look at the individual README files in the examples directory. Most examples can be run by
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@farcaster/hub-web",
|
3
|
-
"version": "0.9.
|
3
|
+
"version": "0.9.6",
|
4
4
|
"main": "./dist/index.js",
|
5
5
|
"module": "./dist/index.mjs",
|
6
6
|
"types": "./dist/index.d.ts",
|
@@ -32,7 +32,7 @@
|
|
32
32
|
"ts-proto": "^1.146.0"
|
33
33
|
},
|
34
34
|
"dependencies": {
|
35
|
-
"@farcaster/core": "^0.
|
35
|
+
"@farcaster/core": "^0.16.0",
|
36
36
|
"@improbable-eng/grpc-web": "^0.15.0",
|
37
37
|
"rxjs": "^7.8.0"
|
38
38
|
}
|