Here's the minimal diff to add custom header support:
+ use std::collections::HashMap;
+ use tonic::{
+ metadata::{MetadataMap, MetadataValue},
+ Request,
+ };
#[derive(Clone)]
const { getSSLHubRpcClient } = require('@farcaster/hub-nodejs'); | |
const getCastsByFid = async (hubRpcEndpoint, fid) => { | |
let client = getSSLHubRpcClient(hubRpcEndpoint); | |
client.$.waitForReady(Date.now() + 2000, async (e) => { | |
if (e) { | |
console.error(`Failed to connect to ${hubRpcEndpoint}`); | |
} else { | |
console.log(`Connected to ${hubRpcEndpoint}`); |
/**** | |
Note - This snippet will not be maintained / updated as of Nov 29, 2023. | |
Please check out the to generate signers with Neynar https://github.com/neynarxyz/nodejs-sdk | |
Or you can also use the utility function signKeyRequest inside this package https://github.com/farcasterxyz/hub-monorepo/blob/main/packages/core/src/signers/viemLocalEip712Signer.ts | |
****/ |
DECLARE | |
rows_inserted INTEGER; | |
BEGIN | |
WITH RECURSIVE root_mapping AS ( | |
-- Base case: Casts without a parent and with a timestamp in the last hour | |
SELECT hash, timestamp, hash AS root_parent_hash | |
FROM casts | |
WHERE parent_hash IS NULL |
Here's the minimal diff to add custom header support:
+ use std::collections::HashMap;
+ use tonic::{
+ metadata::{MetadataMap, MetadataValue},
+ Request,
+ };
#[derive(Clone)]
WITH balances AS ( | |
SELECT | |
"to" as owner, | |
SUM( | |
CASE | |
WHEN "from" = '0x0000000000000000000000000000000000000000' THEN value | |
WHEN "to" = '0x0000000000000000000000000000000000000000' THEN -value | |
ELSE value | |
END | |
) as balance |