Make Your 1st Data Call
Here we make an API call to retrieve the most recent activity of vitalik.eth
, by using limit=1
.
We use direciton=out
to retrieve activities that are initiated by this address. In this case, it filters out spam activities.
curl https://testnet.rss3.io/data/accounts/vitalik.eth/activities?limit=1&direction=out
The result, at the time of writing, looks like:
{
"data": [
{
"owner": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
"id": "0x000000000000000000000000ff70bc918b473c46868c119876f011dbb81f2e86",
"network": "farcaster",
"from": "0xADD746Be46fF36f10C81d6e3Ba282537f4c68077",
"to": "0xAF82c0220bd5e11182aC1EE3A504f4045BBebc6d",
"tag": "social",
"type": "comment",
"platform": "Farcaster",
"status": "successful",
"direction": "out",
"actions": [
{
"tag": "social",
"type": "comment",
"platform": "Farcaster",
"from": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
"to": "0x70a8283A2209b3F4E8C93639D94724b905e1b612",
"metadata": {
"handle": "vitalik.eth",
"body": "Not everyone is a visionary builder. Often you really do just want 5 data points on whether A feels more right or B, or if there is some C you have not considered.",
"profile_id": "5650",
"publication_id": "0xFf70BC918B473c46868c119876F011DbB81F2e86",
"target": {
"handle": "sui",
"body": "Opinion doesn’t matter if they don’t know what they’re building and what’s their vision.",
"profile_id": "2252",
"publication_id": "0x7c05A2e5eF56EcdB87A8f25Ca6342F54f9398F4F"
}
}
},
{
"tag": "social",
"type": "comment",
"platform": "Farcaster",
"from": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
"to": "0x0eA205bF08cc628E15B795794bD9593424BAE9F6",
"metadata": {
"handle": "vitalik.eth",
"body": "Not everyone is a visionary builder. Often you really do just want 5 data points on whether A feels more right or B, or if there is some C you have not considered.",
"profile_id": "5650",
"publication_id": "0xFf70BC918B473c46868c119876F011DbB81F2e86",
"target": {
"handle": "sui",
"body": "Opinion doesn’t matter if they don’t know what they’re building and what’s their vision.",
"profile_id": "2252",
"publication_id": "0x7c05A2e5eF56EcdB87A8f25Ca6342F54f9398F4F"
}
}
},
{
"tag": "social",
"type": "comment",
"platform": "Farcaster",
"from": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
"to": "0x09765E9D82B019eB0Bfe91Cbe2e472aAB9a142a8",
"metadata": {
"handle": "vitalik.eth",
"body": "Not everyone is a visionary builder. Often you really do just want 5 data points on whether A feels more right or B, or if there is some C you have not considered.",
"profile_id": "5650",
"publication_id": "0xFf70BC918B473c46868c119876F011DbB81F2e86",
"target": {
"handle": "sui",
"body": "Opinion doesn’t matter if they don’t know what they’re building and what’s their vision.",
"profile_id": "2252",
"publication_id": "0x7c05A2e5eF56EcdB87A8f25Ca6342F54f9398F4F"
}
}
}
],
"timestamp": 1695512826
}
],
"meta": {
"cursor": "0x000000000000000000000000ff70bc918b473c46868c119876f011dbb81f2e86:farcaster"
}
}
Since a Farcaster account can be configured to have multiple addresses, it is possible for the comment to appear multiple times (for instance, user
sui
has three addresses). You can usehandle
inmetadata
to determine the usernames and use those accordingly.
🥳 There you go, you just made your 1st RSS3 Network call.
Alternatively, if you using JavaScript, consider using the 🥇 RSS3 SDK to make your dev life easier.
The code does the safe thing above with fully type-safe and IDE autocomplete support.
npm i @rss3/js-sdk
pnpm i @rss3/js-sdk
yarn add @rss3/js-sdk
import { dataClient } from '@rss3/js-sdk'
const res = await dataClient().activities('vitalik.eth', {
limit: 1,
direction: 'out'
})
console.log(res)
Updated about 2 months ago