Skip to content

Commit 6ad8b6f

Browse files
committed
feat: gateway provider sdk skeleton
1 parent bab93de commit 6ad8b6f

File tree

2 files changed

+65
-0
lines changed

2 files changed

+65
-0
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
use crate::common::types::Network;
2+
3+
pub struct AggregationModeGatewayProvider {
4+
gateway_url: String,
5+
}
6+
7+
pub enum AggregationModeError {
8+
UnsupportedNetwork,
9+
}
10+
11+
impl AggregationModeGatewayProvider {
12+
pub fn new(network: Network) -> Result<Self, AggregationModeError> {
13+
let provider = match network {
14+
Network::Devnet => Self {
15+
gateway_url: "http://127.0.0.1:8089".into(),
16+
},
17+
_ => return Err(AggregationModeError::UnsupportedNetwork),
18+
};
19+
20+
Ok(provider)
21+
}
22+
23+
pub fn new_with_signer() {}
24+
25+
pub fn signer() {}
26+
}
27+
28+
impl AggregationModeGatewayProvider {
29+
pub async fn get_connection_url(&self) {}
30+
31+
pub async fn get_nonce_for(&self, address: String) {}
32+
33+
pub async fn get_receipts_for(&self, address: String, nonce: Option<u64>) {}
34+
35+
pub async fn submit_sp1_proof(&self, serialized_proof: Vec<u8>, serialized_vk: Vec<u8>) {}
36+
37+
// TODO: verify proof from receipt merkle path
38+
}
39+
40+
pub struct SubmitSP1ProofMessage {
41+
nonce: u64,
42+
proof: Vec<u8>,
43+
program_vk: Vec<u8>,
44+
signature: Vec<u8>,
45+
}
46+
47+
pub struct SubmitProofResponse {
48+
pub task_id: String,
49+
}
50+
51+
impl SubmitSP1ProofMessage {
52+
pub fn new(nonce: u64, serialized_proof: Vec<u8>, serialized_vk: Vec<u8>) -> Self {
53+
Self {
54+
nonce,
55+
proof: serialized_proof,
56+
program_vk: serialized_vk,
57+
signature: vec![],
58+
}
59+
}
60+
61+
pub fn sign(self) -> Self {
62+
self
63+
}
64+
}

crates/sdk/src/aggregation_layer/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// Modules
2+
pub mod gateway;
23
mod helpers;
34
mod types;
45

0 commit comments

Comments
 (0)