SPL token balance in transaction metadata (#13673)

* feat: store pre / post token balances

* move helper functions into separate include

* move token balance functionality to transaction-status crate

* fix blockstore processor test

* fix bigtable legacy test

* add caching to decimals
This commit is contained in:
Josh
2020-12-10 19:25:07 -08:00
committed by GitHub
parent 83fda2d972
commit 13db3eca9f
13 changed files with 349 additions and 3 deletions

View File

@ -61,6 +61,10 @@ pub struct TransactionStatusMeta {
pub inner_instructions: ::std::vec::Vec<InnerInstructions>,
#[prost(string, repeated, tag = "6")]
pub log_messages: ::std::vec::Vec<std::string::String>,
#[prost(message, repeated, tag = "7")]
pub pre_token_balances: ::std::vec::Vec<TokenBalance>,
#[prost(message, repeated, tag = "8")]
pub post_token_balances: ::std::vec::Vec<TokenBalance>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TransactionError {
@ -84,6 +88,24 @@ pub struct CompiledInstruction {
pub data: std::vec::Vec<u8>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TokenBalance {
#[prost(uint32, tag = "1")]
pub account_index: u32,
#[prost(string, tag = "2")]
pub mint: std::string::String,
#[prost(message, optional, tag = "3")]
pub ui_token_amount: ::std::option::Option<UiTokenAmount>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UiTokenAmount {
#[prost(double, tag = "1")]
pub ui_amount: f64,
#[prost(uint32, tag = "2")]
pub decimals: u32,
#[prost(string, tag = "3")]
pub amount: std::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Reward {
#[prost(string, tag = "1")]
pub pubkey: std::string::String,