async function testCast(){
let s = localStorage.getItem('neynar_uuid')
const response = await fetch(
'https://api.neynar.com/v2/farcaster/cast/',
{
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
'x-api-key': 'D8E054-xxx',
},
method: "POST",
body: JSON.stringify({
signer_uuid: s,
text: '天气不错,快来!',
embeds: [{
url: "https://img.ilark.io/img/202511/1768184589529-c5lai.jpg"
}]
})
}
)
// channel_id: "blockbeats", 发布在特定的频道
const result = await response.json()
console.log(563, result)
}
testCast()
返回结果:
/*
{
success: true,
cast: {
hash: '0x125caf5cba3d5a3be151deee422ec9ee0ce83115',
author: {
object: 'user',
fid: 748646,
username: 'lemooljiangs',
display_name: 'lemool.eth',
pfp_url: 'https://imagedelivery.net/BXluQx4ige9GuW0xxx',
custody_address: '0xc6c074bxxxxxxx',
profile: [Object],
follower_count: 27,
following_count: 138,
verifications: [Array],
verified_addresses: [Object],
auth_addresses: [Array],
verified_accounts: [],
url: 'https://miao.ilark.io/lemooljiang',
experimental: [Object],
score: 0.46
},
text: '天气不错,快来!'
}
}
*/
RE: Farcaster开发指南