diff --git a/solana-explorer/Cargo.lock b/solana-explorer/Cargo.lock index bbd19c7..92fe0a7 100644 --- a/solana-explorer/Cargo.lock +++ b/solana-explorer/Cargo.lock @@ -494,7 +494,7 @@ dependencies = [ [[package]] name = "substreams-solana-explorer" -version = "0.1.0" +version = "0.3.0" dependencies = [ "anyhow", "bs58", diff --git a/solana-explorer/Cargo.toml b/solana-explorer/Cargo.toml index e6bcd3f..e8b1a07 100644 --- a/solana-explorer/Cargo.toml +++ b/solana-explorer/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "substreams-solana-explorer" -version = "0.1.0" +version = "0.3.0" description = "Substreams showcasing the building blocks of Solana" edition = "2021" repository = "https://github.com/streamingfast/substreams-explorers" @@ -30,4 +30,4 @@ getrandom = { version = "0.2", features = ["custom"] } [profile.release] lto = true opt-level = 's' -strip = "debuginfo" \ No newline at end of file +strip = "debuginfo" diff --git a/solana-explorer/proto/transactions.proto b/solana-explorer/proto/transactions.proto index ff3ce04..26594d7 100644 --- a/solana-explorer/proto/transactions.proto +++ b/solana-explorer/proto/transactions.proto @@ -5,14 +5,21 @@ package sol.transactions.v1; message Instructions { repeated Instruction instructions = 1; + uint64 slot = 2; } message Instruction { string program_id = 1; - repeated string accounts = 2; + repeated AccountMeta accounts = 2; string data = 3; } +message AccountMeta { + string pubkey = 1; + bool is_writable = 2; + bool is_signer = 3; +} + message Transactions { repeated Transaction transactions = 1; } diff --git a/solana-explorer/src/map_filter_instructions.rs b/solana-explorer/src/map_filter_instructions.rs index 04e181a..fd56d28 100644 --- a/solana-explorer/src/map_filter_instructions.rs +++ b/solana-explorer/src/map_filter_instructions.rs @@ -23,6 +23,7 @@ fn map_filter_instructions(params: String, blk: Block) -> Result Result= header.num_required_signatures + && u32::from(*acct) + < ((msg.account_keys.len() as u32) + - header.num_readonly_unsigned_accounts)), + is_signer: u32::from(*acct) < header.num_required_signatures, + }) .collect(), data: bs58::encode(&inst.data).into_string(), }) @@ -74,7 +84,16 @@ fn map_filter_instructions(params: String, blk: Block) -> Result= header.num_required_signatures + && u32::from(*acct) + < ((msg.account_keys.len() as u32) + - header.num_readonly_unsigned_accounts)), + is_signer: u32::from(*acct) < header.num_required_signatures, + }) .collect(), data: bs58::encode(&ix.data).into_string(), }), @@ -85,7 +104,10 @@ fn map_filter_instructions(params: String, blk: Block) -> Result>(); - Ok(Instructions { instructions }) + Ok(Instructions { + instructions, + slot: blk.slot, + }) } fn parse_filters_from_params(params: String) -> Result { diff --git a/solana-explorer/src/map_filter_transactions.rs b/solana-explorer/src/map_filter_transactions.rs index 0c91c37..4929c0b 100644 --- a/solana-explorer/src/map_filter_transactions.rs +++ b/solana-explorer/src/map_filter_transactions.rs @@ -19,6 +19,7 @@ fn map_filter_transactions(params: String, blk: Block) -> Result = msg @@ -29,7 +30,15 @@ fn map_filter_transactions(params: String, blk: Block) -> Result= header.num_required_signatures + && u32::from(*acct) + < ((msg.account_keys.len() as u32) - header.num_readonly_unsigned_accounts)), + is_signer: u32::from(*acct) < header.num_required_signatures, + }) .collect(), data: bs58::encode(&inst.data).into_string(), }) diff --git a/solana-explorer/src/pb/sol.transactions.v1.rs b/solana-explorer/src/pb/sol.transactions.v1.rs index f4c1817..1c614b2 100644 --- a/solana-explorer/src/pb/sol.transactions.v1.rs +++ b/solana-explorer/src/pb/sol.transactions.v1.rs @@ -4,19 +4,31 @@ pub struct Instructions { #[prost(message, repeated, tag="1")] pub instructions: ::prost::alloc::vec::Vec, + #[prost(uint64, tag="2")] + pub slot: u64, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Instruction { #[prost(string, tag="1")] pub program_id: ::prost::alloc::string::String, - #[prost(string, repeated, tag="2")] - pub accounts: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + #[prost(message, repeated, tag="2")] + pub accounts: ::prost::alloc::vec::Vec, #[prost(string, tag="3")] pub data: ::prost::alloc::string::String, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] +pub struct AccountMeta { + #[prost(string, tag="1")] + pub pubkey: ::prost::alloc::string::String, + #[prost(bool, tag="2")] + pub is_writable: bool, + #[prost(bool, tag="3")] + pub is_signer: bool, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] pub struct Transactions { #[prost(message, repeated, tag="1")] pub transactions: ::prost::alloc::vec::Vec, diff --git a/solana-explorer/substreams.yaml b/solana-explorer/substreams.yaml index 71d47ce..cba9117 100644 --- a/solana-explorer/substreams.yaml +++ b/solana-explorer/substreams.yaml @@ -1,7 +1,7 @@ specVersion: v0.1.0 package: name: "solana_explorer" - version: v0.2.0 + version: v0.3.0 url: https://github.com/streamingfast/substreams-explorers/ image: ./solana.png doc: |