-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add getTokenAccount rpc method and implement logic (metaplex-foundati…
…on#213) * feat: add getTokenAccount rpc method and implement logic * add tests for token_accounts indexing * chore: cleanup * chore : add checks for getTokenAccounts and cover more scenarios for tests * show_zero_balance_filter option added (#201) --------- Co-authored-by: Ahzam Akhtar <[email protected]>
- Loading branch information
1 parent
a9e5340
commit fd9266a
Showing
25 changed files
with
556 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
use sea_orm::{DatabaseConnection, DbErr}; | ||
|
||
use crate::{ | ||
dao::PageOptions, | ||
rpc::{options::Options, response::TokenAccountList}, | ||
}; | ||
|
||
use super::common::{build_token_list_response, create_pagination}; | ||
|
||
pub async fn get_token_accounts( | ||
db: &DatabaseConnection, | ||
owner_address: Option<Vec<u8>>, | ||
mint_address: Option<Vec<u8>>, | ||
page_options: &PageOptions, | ||
options: &Options, | ||
) -> Result<TokenAccountList, DbErr> { | ||
let pagination = create_pagination(page_options)?; | ||
|
||
let token_accounts = crate::dao::scopes::asset::get_token_accounts( | ||
db, | ||
owner_address, | ||
mint_address, | ||
&pagination, | ||
page_options.limit, | ||
options, | ||
) | ||
.await?; | ||
|
||
Ok(build_token_list_response( | ||
token_accounts, | ||
page_options.limit, | ||
&pagination, | ||
options, | ||
)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.