19
19
#include <netinet/in.h>
20
20
#include <stdarg.h>
21
21
22
+ #include "../../app/firedancer/version.h"
23
+
22
24
#define CRLF "\r\n"
23
25
#define MATCH_STRING (_text_ ,_text_sz_ ,_str_ ) (_text_sz_ == sizeof(_str_)-1 && memcmp(_text_, _str_, sizeof(_str_)-1) == 0)
24
26
#define EMIT_SIMPLE (_str_ ) fd_web_reply_append(ws, _str_, sizeof(_str_)-1)
@@ -265,7 +267,7 @@ method_getAccountInfo(struct json_values* values, fd_rpc_ctx_t * ctx) {
265
267
fd_funk_rec_key_t recid = fd_funk_acc_key (& acct );
266
268
const void * val = read_account (ctx , & recid , & val_sz );
267
269
if (val == NULL ) {
268
- fd_web_reply_sprintf (ws , "{\"jsonrpc\":\"2.0\",\"result\":{\"context\":{\"apiVersion\":\"" RPC_VERSION "\",\"slot\":%lu},\"value\":null},\"id\":%s}" CRLF ,
270
+ fd_web_reply_sprintf (ws , "{\"jsonrpc\":\"2.0\",\"result\":{\"context\":{\"apiVersion\":\"" FIREDANCER_VERSION "\",\"slot\":%lu},\"value\":null},\"id\":%s}" CRLF ,
269
271
fd_rpc_history_latest_slot ( ctx -> global -> history ), ctx -> call_id );
270
272
return 0 ;
271
273
}
@@ -291,7 +293,7 @@ method_getAccountInfo(struct json_values* values, fd_rpc_ctx_t * ctx) {
291
293
long off = (off_ptr ? * (long * )off_ptr : FD_LONG_UNSET );
292
294
long len = (len_ptr ? * (long * )len_ptr : FD_LONG_UNSET );
293
295
294
- fd_web_reply_sprintf (ws , "{\"jsonrpc\":\"2.0\",\"result\":{\"context\":{\"apiVersion\":\"" RPC_VERSION "\",\"slot\":%lu},\"value\":" ,
296
+ fd_web_reply_sprintf (ws , "{\"jsonrpc\":\"2.0\",\"result\":{\"context\":{\"apiVersion\":\"" FIREDANCER_VERSION "\",\"slot\":%lu},\"value\":" ,
295
297
fd_rpc_history_latest_slot ( ctx -> global -> history ) );
296
298
const char * err = fd_account_to_json ( ws , acct , enc , val , val_sz , off , len , ctx -> global -> spad );
297
299
if ( err ) {
@@ -333,12 +335,12 @@ method_getBalance(struct json_values* values, fd_rpc_ctx_t * ctx) {
333
335
fd_funk_rec_key_t recid = fd_funk_acc_key (& acct );
334
336
const void * val = read_account (ctx , & recid , & val_sz );
335
337
if (val == NULL ) {
336
- fd_web_reply_sprintf (ws , "{\"jsonrpc\":\"2.0\",\"result\":{\"context\":{\"apiVersion\":\"" RPC_VERSION "\",\"slot\":%lu},\"value\":0},\"id\":%s}" CRLF ,
338
+ fd_web_reply_sprintf (ws , "{\"jsonrpc\":\"2.0\",\"result\":{\"context\":{\"apiVersion\":\"" FIREDANCER_VERSION "\",\"slot\":%lu},\"value\":0},\"id\":%s}" CRLF ,
337
339
fd_rpc_history_latest_slot ( ctx -> global -> history ), ctx -> call_id );
338
340
return 0 ;
339
341
}
340
342
fd_account_meta_t * metadata = (fd_account_meta_t * )val ;
341
- fd_web_reply_sprintf (ws , "{\"jsonrpc\":\"2.0\",\"result\":{\"context\":{\"apiVersion\":\"" RPC_VERSION "\",\"slot\":%lu},\"value\":%lu},\"id\":%s}" CRLF ,
343
+ fd_web_reply_sprintf (ws , "{\"jsonrpc\":\"2.0\",\"result\":{\"context\":{\"apiVersion\":\"" FIREDANCER_VERSION "\",\"slot\":%lu},\"value\":%lu},\"id\":%s}" CRLF ,
342
344
fd_rpc_history_latest_slot ( ctx -> global -> history ), metadata -> info .lamports , ctx -> call_id );
343
345
} FD_SPAD_FRAME_END ;
344
346
return 0 ;
@@ -545,7 +547,7 @@ method_getBlockProduction(struct json_values* values, fd_rpc_ctx_t * ctx) {
545
547
}
546
548
}
547
549
548
- fd_web_reply_sprintf (ws , "{\"jsonrpc\":\"2.0\",\"result\":{\"context\":{\"apiVersion\":\"" RPC_VERSION "\",\"slot\":%lu},\"value\":{\"byIdentity\":{" ,
550
+ fd_web_reply_sprintf (ws , "{\"jsonrpc\":\"2.0\",\"result\":{\"context\":{\"apiVersion\":\"" FIREDANCER_VERSION "\",\"slot\":%lu},\"value\":{\"byIdentity\":{" ,
549
551
fd_rpc_history_latest_slot ( glob -> history ) );
550
552
int first = 1 ;
551
553
for ( product_rb_node_t * nd = product_rb_minimum (pool , root ); nd ; nd = product_rb_successor (pool , nd ) ) {
@@ -784,7 +786,7 @@ method_getFeeForMessage(struct json_values* values, fd_rpc_ctx_t * ctx) {
784
786
// TODO: implement this
785
787
(void )data ;
786
788
(void )data_sz ;
787
- fd_web_reply_sprintf (ws , "{\"jsonrpc\":\"2.0\",\"result\":{\"context\":{\"apiVersion\":\"" RPC_VERSION "\",\"slot\":%lu},\"value\":5000},\"id\":%s}" CRLF ,
789
+ fd_web_reply_sprintf (ws , "{\"jsonrpc\":\"2.0\",\"result\":{\"context\":{\"apiVersion\":\"" FIREDANCER_VERSION "\",\"slot\":%lu},\"value\":5000},\"id\":%s}" CRLF ,
788
790
fd_rpc_history_latest_slot ( ctx -> global -> history ), ctx -> call_id );
789
791
return 0 ;
790
792
}
@@ -917,7 +919,7 @@ method_getLatestBlockhash(struct json_values* values, fd_rpc_ctx_t * ctx) {
917
919
fd_webserver_t * ws = & ctx -> global -> ws ;
918
920
ulong slot = get_slot_from_commitment_level ( values , ctx );
919
921
fd_replay_notif_msg_t * info = fd_rpc_history_get_block_info (ctx -> global -> history , slot );
920
- fd_web_reply_sprintf (ws , "{\"jsonrpc\":\"2.0\",\"result\":{\"context\":{\"apiVersion\":\"" RPC_VERSION "\",\"slot\":%lu},\"value\":{\"blockhash\":\"" ,
922
+ fd_web_reply_sprintf (ws , "{\"jsonrpc\":\"2.0\",\"result\":{\"context\":{\"apiVersion\":\"" FIREDANCER_VERSION "\",\"slot\":%lu},\"value\":{\"blockhash\":\"" ,
921
923
info -> slot_exec .slot );
922
924
fd_web_reply_encode_base58 (ws , & info -> slot_exec .block_hash , sizeof (fd_hash_t ));
923
925
fd_web_reply_sprintf (ws , "\",\"lastValidBlockHeight\":%lu}},\"id\":%s}" CRLF ,
@@ -1089,7 +1091,7 @@ method_getMultipleAccounts(struct json_values* values, fd_rpc_ctx_t * ctx) {
1089
1091
return 0 ;
1090
1092
}
1091
1093
1092
- fd_web_reply_sprintf (ws , "{\"jsonrpc\":\"2.0\",\"result\":{\"context\":{\"apiVersion\":\"" RPC_VERSION "\",\"slot\":%lu},\"value\":[" ,
1094
+ fd_web_reply_sprintf (ws , "{\"jsonrpc\":\"2.0\",\"result\":{\"context\":{\"apiVersion\":\"" FIREDANCER_VERSION "\",\"slot\":%lu},\"value\":[" ,
1093
1095
fd_rpc_history_latest_slot ( ctx -> global -> history ));
1094
1096
1095
1097
// Iterate through account ids
@@ -1260,7 +1262,7 @@ method_getSignaturesForAddress(struct json_values* values, fd_rpc_ctx_t * ctx) {
1260
1262
static int
1261
1263
method_getSignatureStatuses (struct json_values * values , fd_rpc_ctx_t * ctx ) {
1262
1264
fd_webserver_t * ws = & ctx -> global -> ws ;
1263
- fd_web_reply_sprintf (ws , "{\"jsonrpc\":\"2.0\",\"result\":{\"context\":{\"apiVersion\":\"" RPC_VERSION "\",\"slot\":%lu},\"value\":[" ,
1265
+ fd_web_reply_sprintf (ws , "{\"jsonrpc\":\"2.0\",\"result\":{\"context\":{\"apiVersion\":\"" FIREDANCER_VERSION "\",\"slot\":%lu},\"value\":[" ,
1264
1266
fd_rpc_history_latest_slot ( ctx -> global -> history ));
1265
1267
1266
1268
// Iterate through account ids
@@ -1419,7 +1421,7 @@ method_getSupply(struct json_values* values, fd_rpc_ctx_t * ctx) {
1419
1421
return 0 ;
1420
1422
}
1421
1423
fd_webserver_t * ws = & ctx -> global -> ws ;
1422
- fd_web_reply_sprintf ( ws , "{\"jsonrpc\":\"2.0\",\"result\":{\"context\":{\"apiVersion\":\"" RPC_VERSION "\",\"slot\":%lu},\"value\":{\"circulating\":%lu,\"nonCirculating\":%lu,\"nonCirculatingAccounts\":[],\"total\":%lu}},\"id\":%s}" ,
1424
+ fd_web_reply_sprintf ( ws , "{\"jsonrpc\":\"2.0\",\"result\":{\"context\":{\"apiVersion\":\"" FIREDANCER_VERSION "\",\"slot\":%lu},\"value\":{\"circulating\":%lu,\"nonCirculating\":%lu,\"nonCirculatingAccounts\":[],\"total\":%lu}},\"id\":%s}" ,
1423
1425
slot , slot_bank -> capitalization , 0UL , slot_bank -> capitalization , ctx -> call_id );
1424
1426
} FD_SPAD_FRAME_END ;
1425
1427
return 0 ;
@@ -1558,7 +1560,7 @@ method_getTransaction(struct json_values* values, fd_rpc_ctx_t * ctx) {
1558
1560
1559
1561
fd_replay_notif_msg_t * info = fd_rpc_history_get_block_info ( ctx -> global -> history , slot );
1560
1562
1561
- fd_web_reply_sprintf (ws , "{\"jsonrpc\":\"2.0\",\"result\":{\"context\":{\"apiVersion\":\"" RPC_VERSION "\",\"slot\":%lu},\"blockTime\":%ld,\"slot\":%lu," ,
1563
+ fd_web_reply_sprintf (ws , "{\"jsonrpc\":\"2.0\",\"result\":{\"context\":{\"apiVersion\":\"" FIREDANCER_VERSION "\",\"slot\":%lu},\"blockTime\":%ld,\"slot\":%lu," ,
1562
1564
fd_rpc_history_latest_slot ( ctx -> global -> history ), (long )info -> slot_exec .ts /(long )1e9 , slot );
1563
1565
1564
1566
const char * err = fd_txn_to_json ( ws , (fd_txn_t * )txn_out , txn_data_raw , pay_sz , enc , 0 , FD_BLOCK_DETAIL_FULL , ctx -> global -> spad );
@@ -1600,7 +1602,7 @@ method_getVersion(struct json_values* values, fd_rpc_ctx_t * ctx) {
1600
1602
(void ) values ;
1601
1603
fd_webserver_t * ws = & ctx -> global -> ws ;
1602
1604
/* TODO Where does feature-set come from? */
1603
- fd_web_reply_sprintf (ws , "{\"jsonrpc\":\"2.0\",\"result\":{\"feature-set\":666,\"solana-core\":\"" RPC_VERSION "\"},\"id\":%s}" CRLF ,
1605
+ fd_web_reply_sprintf (ws , "{\"jsonrpc\":\"2.0\",\"result\":{\"feature-set\":666,\"solana-core\":\"" FIREDANCER_VERSION "\"},\"id\":%s}" CRLF ,
1604
1606
ctx -> call_id );
1605
1607
return 0 ;
1606
1608
}
@@ -2229,7 +2231,7 @@ ws_method_accountSubscribe_update(fd_rpc_ctx_t * ctx, fd_replay_notif_msg_t * ms
2229
2231
return 0 ;
2230
2232
}
2231
2233
2232
- fd_web_reply_sprintf (ws , "{\"jsonrpc\":\"2.0\",\"method\":\"accountNotification\",\"params\":{\"result\":{\"context\":{\"apiVersion\":\"" RPC_VERSION "\",\"slot\":%lu},\"value\":" ,
2234
+ fd_web_reply_sprintf (ws , "{\"jsonrpc\":\"2.0\",\"method\":\"accountNotification\",\"params\":{\"result\":{\"context\":{\"apiVersion\":\"" FIREDANCER_VERSION "\",\"slot\":%lu},\"value\":" ,
2233
2235
msg -> slot_exec .slot );
2234
2236
const char * err = fd_account_to_json ( ws , sub -> acct_subscribe .acct , sub -> acct_subscribe .enc , val , val_sz , sub -> acct_subscribe .off , sub -> acct_subscribe .len , ctx -> global -> spad );
2235
2237
if ( err ) {
0 commit comments