File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed
Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change 11import {
22 ConfirmedSignaturesForAddress2Options ,
33 Connection ,
4+ ConnectionConfig ,
45 ParsedConfirmedTransaction ,
56 PublicKey ,
67} from "@solana/web3.js" ;
78
89export function newConnection ( ) : Connection {
9- return new Connection ( process . env . SOLANA_RPC || "" ) ;
10+ const config : ConnectionConfig = { } ;
11+ if ( process . env . SOLANA_RPC_KEY_SECRET ) {
12+ config . httpHeaders = { Authorization : process . env . SOLANA_RPC_KEY_SECRET } ;
13+ }
14+ return new Connection ( process . env . SOLANA_RPC || "" , config ) ;
1015}
1116
1217interface Opt extends ConfirmedSignaturesForAddress2Options {
Original file line number Diff line number Diff line change @@ -15,15 +15,14 @@ import { ParsedConfirmedTransaction } from "@solana/web3.js";
1515import initTwitterClient from "lib/twitter" ;
1616import notifyTwitter from "lib/twitter/notifyTwitter" ;
1717
18- const port = process . env . PORT || 4000 ;
19-
2018( async ( ) => {
2119 try {
2220 const result = dotenv . config ( ) ;
2321 if ( result . error ) {
2422 throw result . error ;
2523 }
2624 const config = loadConfig ( ) ;
25+ const port = process . env . PORT || 4000 ;
2726
2827 const web3Conn = newConnection ( ) ;
2928 const discordClient = await initDiscordClient ( ) ;
You can’t perform that action at this time.
0 commit comments