/ examples / postgres / starknet_to_postgres.js
starknet_to_postgres.js
 1  // Before running this script, you must setup your database to include a `transfers` table.
 2  // See README.md for instructions.
 3  import { decodeTransfersInBlock, filter } from "../common/starknet.js";
 4  
 5  // Configure indexer for streaming Starknet Goerli data starting at the specified block.
 6  export const config = {
 7    streamUrl: "https://goerli.starknet.a5a.ch",
 8    startingBlock: 800_000,
 9    network: "starknet",
10    filter,
11    sinkType: "postgres",
12    sinkOptions: {
13      noTls: true,
14      tableName: "transfers",
15    },
16  };
17  
18  // Transform each block using the function defined in starknet.js.
19  export default decodeTransfersInBlock;