Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@ test-ledger/
minio
test.db
docker-compose.yml

.cursor
**/photon.log
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
Expand Up @@ -7,7 +7,7 @@ name = "photon-indexer"
publish = true
readme = "README.md"
repository = "https://github.com/helius-labs/photon"
version = "0.51.0"
version = "0.51.1"

[[bin]]
name = "photon"
Expand Down
20 changes: 14 additions & 6 deletions src/common/typedefs/account/v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,20 @@ pub struct Account {
impl Account {
pub fn parse_token_data(&self) -> Result<Option<TokenData>, IngesterError> {
match self.data.as_ref() {
Some(data) if self.owner.0 == COMPRESSED_TOKEN_PROGRAM => {
let data_slice = data.data.0.as_slice();
let token_data = TokenData::try_from_slice(data_slice).map_err(|e| {
IngesterError::ParserError(format!("Failed to parse token data: {:?}", e))
})?;
Ok(Some(token_data))
Some(data) => {
let is_v1_token = data.discriminator.0.to_le_bytes() == [2, 0, 0, 0, 0, 0, 0, 0];
let is_v2_token = data.discriminator.0.to_le_bytes() == [0, 0, 0, 0, 0, 0, 0, 3];
let is_sha_flat_token = data.discriminator.0.to_le_bytes() == [0, 0, 0, 0, 0, 0, 0, 4];

if self.owner.0 == COMPRESSED_TOKEN_PROGRAM && (is_v1_token || is_v2_token || is_sha_flat_token) {
let data_slice = data.data.0.as_slice();
let token_data = TokenData::try_from_slice(data_slice).map_err(|e| {
IngesterError::ParserError(format!("Failed to parse token data: {:?}", e))
})?;
Ok(Some(token_data))
} else {
Ok(None)
}
}
_ => Ok(None),
}
Expand Down
20 changes: 14 additions & 6 deletions src/common/typedefs/account/v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,20 @@ pub struct AccountV2 {
impl AccountV2 {
pub fn parse_token_data(&self) -> Result<Option<TokenData>, IngesterError> {
match self.data.as_ref() {
Some(data) if self.owner.0 == COMPRESSED_TOKEN_PROGRAM => {
let data_slice = data.data.0.as_slice();
let token_data = TokenData::try_from_slice(data_slice).map_err(|e| {
IngesterError::ParserError(format!("Failed to parse token data: {:?}", e))
})?;
Ok(Some(token_data))
Some(data) => {
let is_v1_token = data.discriminator.0.to_le_bytes() == [2, 0, 0, 0, 0, 0, 0, 0];
let is_v2_token = data.discriminator.0.to_le_bytes() == [0, 0, 0, 0, 0, 0, 0, 3];
let is_sha_flat_token = data.discriminator.0.to_le_bytes() == [0, 0, 0, 0, 0, 0, 0, 4];

if self.owner.0 == COMPRESSED_TOKEN_PROGRAM && (is_v1_token || is_v2_token || is_sha_flat_token) {
let data_slice = data.data.0.as_slice();
let token_data = TokenData::try_from_slice(data_slice).map_err(|e| {
IngesterError::ParserError(format!("Failed to parse token data: {:?}", e))
})?;
Ok(Some(token_data))
} else {
Ok(None)
}
}
_ => Ok(None),
}
Expand Down
Loading