Skip to content

Commit

Permalink
refactor authorization to string type
Browse files Browse the repository at this point in the history
  • Loading branch information
DenisCarriere committed Nov 12, 2024
1 parent 2596b80 commit f1edd02
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 18 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "substreams-antelope-tokens"
version = "1.0.0"
version = "1.0.1"
authors = [
"Denis <[email protected]>",
"Yaro <[email protected]>",
Expand Down
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ gui:

.PHONY: parquet
parquet:
substreams-sink-files run eos.substreams.pinax.network:443 substreams.yaml map_events s3://pinax/eos/48034848cd64dcd70f95e06de9ed5d1478d0133e?region=us-east-1 2: --encoder parquet
substreams-sink-files run eos.substreams.pinax.network:443 substreams.yaml map_events './out' 400000000: --encoder parquet

.PHONY: s3
s3:
substreams-sink-files run eos.substreams.pinax.network:443 substreams.yaml map_events 's3://pinax/eos/48034848cd64dcd70f95e06de9ed5d1478d0133e?region=us-east-1' 2: --encoder parquet

.PHONY: schema
schema:
Expand Down
8 changes: 4 additions & 4 deletions proto/v1/eosio.token.proto
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ message Transfer {
string trx_id = 5;
uint32 index = 6; // Action execution_index
uint32 action_ordinal = 7;
repeated string authorization = 8; // Vec<PermissionLevel> (ex: ["account@active"])
string authorization = 8; // Vec<PermissionLevel> (ex: ["account@active"])

// contract & scope
string contract = 10; // Name (ex: "eosio.token")
Expand Down Expand Up @@ -54,7 +54,7 @@ message Issue {
string trx_id = 5;
uint32 index = 6; // Action execution_index
uint32 action_ordinal = 7;
repeated string authorization = 8; // Vec<PermissionLevel> (ex: ["account@active"])
string authorization = 8; // Vec<PermissionLevel> (ex: ["account@active"])

// contract & scope
string contract = 10; // Name (ex: "eosio.token")
Expand Down Expand Up @@ -83,7 +83,7 @@ message Retire {
string trx_id = 5;
uint32 index = 6; // Action execution_index
uint32 action_ordinal = 7;
repeated string authorization = 8; // Vec<PermissionLevel> (ex: ["account@active"])
string authorization = 8; // Vec<PermissionLevel> (ex: ["account@active"])

// contract & scope
string contract = 10; // Name (ex: "eosio.token")
Expand Down Expand Up @@ -111,7 +111,7 @@ message Create {
string trx_id = 5;
uint32 index = 6; // Action execution_index
uint32 action_ordinal = 7;
repeated string authorization = 8; // Vec<PermissionLevel> (ex: ["account@active"])
string authorization = 8; // Vec<PermissionLevel> (ex: ["account@active"])

// contract & scope
string contract = 10; // Name (ex: "eosio.token")
Expand Down
16 changes: 8 additions & 8 deletions src/pb/antelope.eosio.token.v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ pub struct Transfer {
#[prost(uint32, tag="7")]
pub action_ordinal: u32,
/// Vec<PermissionLevel> (ex: \["account@active"\])
#[prost(string, repeated, tag="8")]
pub authorization: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(string, tag="8")]
pub authorization: ::prost::alloc::string::String,
/// contract & scope
///
/// Name (ex: "eosio.token")
Expand Down Expand Up @@ -88,8 +88,8 @@ pub struct Issue {
#[prost(uint32, tag="7")]
pub action_ordinal: u32,
/// Vec<PermissionLevel> (ex: \["account@active"\])
#[prost(string, repeated, tag="8")]
pub authorization: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(string, tag="8")]
pub authorization: ::prost::alloc::string::String,
/// contract & scope
///
/// Name (ex: "eosio.token")
Expand Down Expand Up @@ -137,8 +137,8 @@ pub struct Retire {
#[prost(uint32, tag="7")]
pub action_ordinal: u32,
/// Vec<PermissionLevel> (ex: \["account@active"\])
#[prost(string, repeated, tag="8")]
pub authorization: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(string, tag="8")]
pub authorization: ::prost::alloc::string::String,
/// contract & scope
///
/// Name (ex: "eosio.token")
Expand Down Expand Up @@ -184,8 +184,8 @@ pub struct Create {
#[prost(uint32, tag="7")]
pub action_ordinal: u32,
/// Vec<PermissionLevel> (ex: \["account@active"\])
#[prost(string, repeated, tag="8")]
pub authorization: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(string, tag="8")]
pub authorization: ::prost::alloc::string::String,
/// contract & scope
///
/// Name (ex: "eosio.token")
Expand Down
6 changes: 4 additions & 2 deletions src/utils.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use antelope::{Asset, Name};
use std::iter::Iterator;
use substreams::pb::substreams::Clock;
use substreams_antelope::pb::PermissionLevel;

Expand All @@ -23,11 +24,12 @@ pub fn to_date(clock: &Clock) -> String {
.to_string()
}

pub fn authorization_to_string(authorization: &Vec<PermissionLevel>) -> Vec<String> {
pub fn authorization_to_string(authorization: &Vec<PermissionLevel>) -> String {
authorization
.iter()
.map(|a| format!("{}@{}", a.actor, a.permission))
.collect()
.collect::<Vec<String>>()
.join(",")
}

pub fn parse_json_asset(data_json: &str, key: &str) -> Option<Asset> {
Expand Down
2 changes: 1 addition & 1 deletion substreams.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
specVersion: v0.1.0
package:
name: antelope_tokens
version: v1.0.0
version: v1.0.1
url: https://github.com/pinax-network/substreams-antelope-tokens

imports:
Expand Down

0 comments on commit f1edd02

Please sign in to comment.