Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,7 @@ name: CI

on:
push:
branches:
- main
- production
- staging
- ecs-cd
pull_request:
branches:
- main
- production
- staging
- ecs-cd

env:
CARGO_TERM_COLOR: always
Expand Down Expand Up @@ -65,6 +55,7 @@ jobs:
SMTP_USERNAME: ${{ secrets.SMTP_USERNAME }}
SMTP_PASSWORD: ${{ secrets.SMTP_PASSWORD }}
JWT_KEY: ${{ secrets.JWT_KEY }}
D_D_CLOUD_API_KEY: ${{ secrets.D_D_CLOUD_API_KEY }}
run: cargo test --workspace ${{ matrix.flags }}

clippy:
Expand Down
5 changes: 3 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ tracing-subscriber = "0.3.18"
alloy = {version = "1.0", features = ["node-bindings", "network", "rpc-types"]}
thiserror = "1.0.63"
mimalloc = "0.1.45"
url = "2.5.8"
hyper = "1.6.0"
hyper-util = { version = "0.1", features = ["full"] }
reqwest = { version = "0.12.24", features = ["json", "rustls-tls", "cookies", "stream"] }
Expand Down
2 changes: 1 addition & 1 deletion infra/opentofu/ecs/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ module "ecs" {
cpu = 1024
memory = 2048
essential = false
image = "ghcr.io/pokt-network/path:sha-ca7acdd-rc"
image = "ghcr.io/pokt-network/path:sha-f812b42-rc"
memory_reservation = 50
port_mappings = [
{
Expand Down
2 changes: 2 additions & 0 deletions migrations/0003_developer_dao_rpc.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE Customers ADD COLUMN suppression_list BOOL NOT NULL DEFAULT FALSE;
ALTER TABLE Customers ADD COLUMN marketing_email_consent BOOL NOT NULL DEFAULT FALSE;
39 changes: 38 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ use crate::middleware::{
};
use crate::routes::payment::{cancel, downgrade, upgrade};
use crate::routes::relayer::websockets::ws_handler;
use crate::routes::token_queries::{
aggregate_balances, aggregate_single_token_bals, aggregate_token_bals_for_user,
get_batch_nft_info,
};
use crate::routes::types::{EmailLogin, JWTKey};
use crate::routes::{
activate::activate_account,
Expand Down Expand Up @@ -53,21 +57,52 @@ async fn main() {
.with_target(false)
.init();

let origin = if cfg!(feature = "dev") {
"http://localhost:5173"
} else {
"https://cloud.developerdao.com"
};

let cors_api = CorsLayer::new()
.allow_credentials(true)
.allow_origin("https://cloud.developerdao.com".parse::<HeaderValue>().unwrap())
.allow_origin(origin.parse::<HeaderValue>().unwrap())
.allow_methods([Method::GET, Method::POST, Method::DELETE])
.allow_headers([header::CONTENT_TYPE, header::AUTHORIZATION, header::COOKIE]);

#[cfg(feature = "dev")]
let relayer = Router::new()
.route("/rpc/{chain}/{api_key}", post(route_call))
.route("/ws/{chain}/{api_key}", axum::routing::any(ws_handler));

#[cfg(not(feature = "dev"))]
let relayer = Router::new()
.route("/rpc/{chain}/{api_key}", post(route_call))
.route("/ws/{chain}/{api_key}", axum::routing::any(ws_handler))
.route_layer(from_fn(validate_subscription_and_update_user_calls));

let token_queries = Router::new()
.route(
"/v1/tokens/balances/{chain}/{api_key}",
get(aggregate_balances),
)
.route(
"/v1/tokens/single_token_balances/{chain}/{api_key}",
get(aggregate_single_token_bals),
)
.route(
"/v1/tokens/many_token_balances/{chain}/{api_key}",
get(aggregate_token_bals_for_user),
)
.route(
"/v1/nfts/ownership/{chain}/{api_key}",
get(get_batch_nft_info),
);

let api_keys = Router::new()
.route("/api/keys", get(get_all_api_keys).post(generate_api_keys))
.route("/api/keys/{key}", delete(delete_key))
.route_layer(from_fn(verify_jwt));

let payments = Router::new()
.route("/api/pay/eth", post(process_ethereum_payment))
.route("/api/upgrade", post(upgrade))
Expand All @@ -76,6 +111,7 @@ async fn main() {
.route("/api/balances", get(get_calls_and_balance))
.route("/api/payments", get(get_payments))
.route_layer(from_fn(verify_jwt));

let siwe = Router::new()
.route("/api/refresh", post(refresh))
.route("/api/siwe/add_wallet", post(siwe_add_wallet))
Expand All @@ -98,6 +134,7 @@ async fn main() {
.merge(siwe)
.merge(payments)
.layer(cors_api)
.merge(token_queries)
.merge(relayer);

info!("Initialized D_D RPC on 0.0.0.0:3000");
Expand Down
1 change: 0 additions & 1 deletion src/routes/api_keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ pub struct KeygenLimit {
count: Option<i64>,
}

#[axum::debug_handler]
pub async fn generate_api_keys(
Extension(jwt): Extension<JWTClaims<Claims<'static>>>,
) -> Result<impl IntoResponse, ApiKeyError> {
Expand Down
1 change: 1 addition & 0 deletions src/routes/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
pub mod activate;
pub mod token_queries;
pub mod api_keys;
pub mod login;
pub mod payment;
Expand Down
2 changes: 1 addition & 1 deletion src/routes/payment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ pub async fn process_ethereum_payment(
let hash = hex::decode(&payload.hash)?;
let mut fixed = [0u8; 32];
fixed.copy_from_slice(&hash);

#[allow(clippy::needless_borrow)]
let eth = reqwest::Url::parse(&_endpoint).unwrap();
let provider = ProviderBuilder::new().connect_http(eth);
Expand Down
3 changes: 2 additions & 1 deletion src/routes/relayer/types.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use http::{HeaderValue, header::CONTENT_TYPE};
use axum::body::{Body, Bytes};
use reqwest::Client;
use serde::{Deserialize, Serialize};
use std::{
fmt::{self, Display, Formatter},
future::Future,
Expand Down Expand Up @@ -28,7 +29,7 @@ impl From<PoktChains> for HeaderValue {
}
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
pub enum PoktChains {
#[cfg(any(test, feature = "dev"))]
Anvil,
Expand Down
Loading
Loading