Skip to content

Commit

Permalink
updated abi.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
fschoell committed Mar 27, 2024
1 parent f8952a5 commit cb61670
Showing 1 changed file with 54 additions and 6 deletions.
60 changes: 54 additions & 6 deletions src/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,25 @@ pub mod types {
pub struct Account {
pub balance: Asset,
}
impl std::str::FromStr for Account {
type Err = substreams_antelope::Error;
fn from_str(value: &str) -> Result<Self, Self::Err> {
substreams_antelope::decoder::decode::<Self>(value)
}
}
#[derive(Debug, Clone, PartialEq, serde::Deserialize)]
#[serde(deny_unknown_fields)]
pub struct CurrencyStats {
pub supply: Asset,
pub max_supply: Asset,
pub issuer: Name,
}
impl std::str::FromStr for CurrencyStats {
type Err = substreams_antelope::Error;
fn from_str(value: &str) -> Result<Self, Self::Err> {
substreams_antelope::decoder::decode::<Self>(value)
}
}
}
pub mod actions {
use substreams_antelope::types::*;
Expand All @@ -26,12 +38,18 @@ pub mod actions {
pub owner: Name,
pub symbol: Symbol,
}
impl std::str::FromStr for Close {
type Err = substreams_antelope::Error;
fn from_str(value: &str) -> Result<Self, Self::Err> {
substreams_antelope::decoder::decode::<Self>(value)
}
}
impl substreams_antelope::Action for Close {
const NAME: &'static str = "close";
fn decode(
trace: &substreams_antelope::pb::ActionTrace,
) -> Result<Self, substreams_antelope::Error> {
Ok(decode::<Self>(&trace.action.as_ref().unwrap().json_data)?)
decode::<Self>(&trace.action.as_ref().unwrap().json_data)
}
}
#[derive(Debug, Clone, PartialEq, serde::Deserialize)]
Expand All @@ -40,12 +58,18 @@ pub mod actions {
pub issuer: Name,
pub maximum_supply: Asset,
}
impl std::str::FromStr for Create {
type Err = substreams_antelope::Error;
fn from_str(value: &str) -> Result<Self, Self::Err> {
substreams_antelope::decoder::decode::<Self>(value)
}
}
impl substreams_antelope::Action for Create {
const NAME: &'static str = "create";
fn decode(
trace: &substreams_antelope::pb::ActionTrace,
) -> Result<Self, substreams_antelope::Error> {
Ok(decode::<Self>(&trace.action.as_ref().unwrap().json_data)?)
decode::<Self>(&trace.action.as_ref().unwrap().json_data)
}
}
#[derive(Debug, Clone, PartialEq, serde::Deserialize)]
Expand All @@ -55,12 +79,18 @@ pub mod actions {
pub quantity: Asset,
pub memo: String,
}
impl std::str::FromStr for Issue {
type Err = substreams_antelope::Error;
fn from_str(value: &str) -> Result<Self, Self::Err> {
substreams_antelope::decoder::decode::<Self>(value)
}
}
impl substreams_antelope::Action for Issue {
const NAME: &'static str = "issue";
fn decode(
trace: &substreams_antelope::pb::ActionTrace,
) -> Result<Self, substreams_antelope::Error> {
Ok(decode::<Self>(&trace.action.as_ref().unwrap().json_data)?)
decode::<Self>(&trace.action.as_ref().unwrap().json_data)
}
}
#[derive(Debug, Clone, PartialEq, serde::Deserialize)]
Expand All @@ -70,12 +100,18 @@ pub mod actions {
pub symbol: Symbol,
pub ram_payer: Name,
}
impl std::str::FromStr for Open {
type Err = substreams_antelope::Error;
fn from_str(value: &str) -> Result<Self, Self::Err> {
substreams_antelope::decoder::decode::<Self>(value)
}
}
impl substreams_antelope::Action for Open {
const NAME: &'static str = "open";
fn decode(
trace: &substreams_antelope::pb::ActionTrace,
) -> Result<Self, substreams_antelope::Error> {
Ok(decode::<Self>(&trace.action.as_ref().unwrap().json_data)?)
decode::<Self>(&trace.action.as_ref().unwrap().json_data)
}
}
#[derive(Debug, Clone, PartialEq, serde::Deserialize)]
Expand All @@ -84,12 +120,18 @@ pub mod actions {
pub quantity: Asset,
pub memo: String,
}
impl std::str::FromStr for Retire {
type Err = substreams_antelope::Error;
fn from_str(value: &str) -> Result<Self, Self::Err> {
substreams_antelope::decoder::decode::<Self>(value)
}
}
impl substreams_antelope::Action for Retire {
const NAME: &'static str = "retire";
fn decode(
trace: &substreams_antelope::pb::ActionTrace,
) -> Result<Self, substreams_antelope::Error> {
Ok(decode::<Self>(&trace.action.as_ref().unwrap().json_data)?)
decode::<Self>(&trace.action.as_ref().unwrap().json_data)
}
}
#[derive(Debug, Clone, PartialEq, serde::Deserialize)]
Expand All @@ -100,12 +142,18 @@ pub mod actions {
pub quantity: Asset,
pub memo: String,
}
impl std::str::FromStr for Transfer {
type Err = substreams_antelope::Error;
fn from_str(value: &str) -> Result<Self, Self::Err> {
substreams_antelope::decoder::decode::<Self>(value)
}
}
impl substreams_antelope::Action for Transfer {
const NAME: &'static str = "transfer";
fn decode(
trace: &substreams_antelope::pb::ActionTrace,
) -> Result<Self, substreams_antelope::Error> {
Ok(decode::<Self>(&trace.action.as_ref().unwrap().json_data)?)
decode::<Self>(&trace.action.as_ref().unwrap().json_data)
}
}
}

0 comments on commit cb61670

Please sign in to comment.