diff --git a/.gitignore b/.gitignore
index 2011dfb..cc8af7c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,7 @@
/target
.envrc
.bin
-.env
\ No newline at end of file
+.env
+devhub.near*
+events-committee.near*
+infrastructure-committee.near*
diff --git a/bring-cache-up-to-date.py b/bring-cache-up-to-date.py
index 908d23a..9ad293d 100644
--- a/bring-cache-up-to-date.py
+++ b/bring-cache-up-to-date.py
@@ -1,9 +1,9 @@
import time
import requests
-local = False
-reset_from_zero = True # False to continue from where it left off
-fly_app_name = "events-cache-api-rs"
+local = True
+reset_from_zero = False # False to continue from where it left off
+fly_app_name = "devhub-cache-api-rs"
# ~120 calls for devhub
# ~20 calls for infra
# ~40 calls for events
@@ -12,11 +12,11 @@
base_url = f"http://localhost:8080/" if local else f"https://{fly_app_name}.fly.dev/"
def call_api(count):
- url = f"{base_url}proposal/256/snapshots" # Replace with your API URL
+ url = f"{base_url}proposals" # Replace with your API URL
try:
response = requests.get(url)
if response.status_code == 200:
- print(f"{count} API call successful: - response length {len(response.json())}")
+ print(f"{count} API call successful: - response length {response.json().get('total_records')}")
else:
print("API call failed with status code:", response.status_code)
except requests.exceptions.RequestException as e:
diff --git a/scripts/download_nearblocks.js b/scripts/download_nearblocks.js
index 9f68fb1..c0eea61 100644
--- a/scripts/download_nearblocks.js
+++ b/scripts/download_nearblocks.js
@@ -25,10 +25,13 @@ const path = require("path");
const ACCOUNT = "devhub.near";
const BASE_URL = "https://api.nearblocks.io/v1/account";
-const PER_PAGE = 25;
-const API_KEY = "API_KEY";
+const PER_PAGE = 50;
+const API_KEY = process.env.NEARBLOCKS_API_KEY;
+if (!API_KEY) {
+ throw new Error("NEARBLOCKS_API_KEY environment variable is required");
+}
const START_AFTER_BLOCK = 0;
-const RECEIPT = false;
+const RECEIPT = false; // Can't use receipt because it's not supported by the API after_block only checks after the block
async function saveTransactions(blockHeight, transactions) {
// Create a Blob containing the JSON data
@@ -44,7 +47,7 @@ async function saveTransactions(blockHeight, transactions) {
}
async function fetchTransactions(afterBlock) {
- const url = `${BASE_URL}/${ACCOUNT}/txns?to=${ACCOUNT}&after_block=${afterBlock}&per_page=${PER_PAGE}&order=asc&page=1`;
+ const url = `${BASE_URL}/${ACCOUNT}/txns?&after_block=${afterBlock}&per_page=${PER_PAGE}&order=asc&page=1`;
try {
console.log(url);
diff --git a/src/db/mod.rs b/src/db/mod.rs
index ce807b0..1dcff86 100644
--- a/src/db/mod.rs
+++ b/src/db/mod.rs
@@ -908,6 +908,43 @@ impl DB {
Ok((rfps, total_count))
}
+
+ pub async fn get_proposal_with_latest_snapshot_view(
+ &self,
+ proposal_id: i32,
+ ) -> Result