Skip to content

Commit

Permalink
feat: add hash field to CompressedAccount
Browse files Browse the repository at this point in the history
  • Loading branch information
sergeytimoshin committed Jan 28, 2025
1 parent 287e3b1 commit ea9a359
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions program-tests/utils/src/conversions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ pub fn program_to_sdk_compressed_account(
owner: program_account.owner,
lamports: program_account.lamports,
address: program_account.address,
hash: None,
data: program_account
.data
.map(program_to_sdk_compressed_account_data),
Expand Down
1 change: 1 addition & 0 deletions sdk-libs/client/src/indexer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ impl TryFrom<LocalPhotonAccount> for CompressedAccountWithMerkleContext {
address: account
.address
.map(|a| <[u8; 32]>::from_base58(&a).unwrap()),
hash: Some(<[u8; 32]>::from_base58(&account.hash)?),
lamports: account.lamports,
owner: Pubkey::from_str(&account.owner)?,
data: None,
Expand Down
8 changes: 7 additions & 1 deletion sdk-libs/client/tests/rpc_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,13 @@ async fn test_all_endpoints() {
let balance = indexer
.get_compressed_token_account_balance(
None,
Some(token_account.compressed_account.hash().unwrap()),
Some(
token_account
.compressed_account
.compressed_account
.hash
.unwrap(),
),
)
.await
.unwrap();
Expand Down
1 change: 1 addition & 0 deletions sdk-libs/sdk/src/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ where
owner: *self.account_info.owner,
lamports: self.account_info.lamports.unwrap_or(0),
address: self.account_info.address,
hash: None,
data,
},
merkle_tree_index,
Expand Down
2 changes: 2 additions & 0 deletions sdk-libs/sdk/src/account_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ impl<'a> LightAccountInfo<'a> {
owner: *self.owner,
lamports: input.lamports.unwrap_or(0),
address: input.address,
hash: None,
data,
},
merkle_context: input.merkle_context,
Expand Down Expand Up @@ -346,6 +347,7 @@ impl<'a> LightAccountInfo<'a> {
owner: *self.owner,
lamports: self.lamports.unwrap_or(0),
address: self.address,
hash: None,
data,
},
merkle_tree_index,
Expand Down
1 change: 1 addition & 0 deletions sdk-libs/sdk/src/compressed_account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ pub struct CompressedAccount {
pub owner: Pubkey,
pub lamports: u64,
pub address: Option<[u8; 32]>,
pub hash: Option<[u8; 32]>,
pub data: Option<CompressedAccountData>,
}

Expand Down

0 comments on commit ea9a359

Please sign in to comment.