diff --git a/Cargo.lock b/Cargo.lock index ca892c2..8836f86 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4591,7 +4591,7 @@ dependencies = [ [[package]] name = "photon-indexer" -version = "0.48.0" +version = "0.50.0" dependencies = [ "anchor-lang", "anyhow", diff --git a/Cargo.toml b/Cargo.toml index d535e47..c5422c9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,7 +7,7 @@ name = "photon-indexer" publish = true readme = "README.md" repository = "https://github.com/helius-labs/photon" -version = "0.48.0" +version = "0.50.0" [[bin]] name = "photon" diff --git a/src/api/api.rs b/src/api/api.rs index aa5ee45..b11556b 100644 --- a/src/api/api.rs +++ b/src/api/api.rs @@ -16,8 +16,8 @@ use super::method::get_compressed_mint_token_holders::{ get_compressed_mint_token_holders, GetCompressedMintTokenHoldersRequest, OwnerBalancesResponse, }; use super::method::get_compressed_token_balances_by_owner::{ - get_compressed_token_balances_by_owner, GetCompressedTokenBalancesByOwnerRequest, - TokenBalancesResponse, + get_compressed_token_balances_by_owner, get_compressed_token_balances_by_owner_v2, + GetCompressedTokenBalancesByOwnerRequest, TokenBalancesResponse, TokenBalancesResponseV2, }; use super::method::get_compression_signatures_for_account::get_compression_signatures_for_account; use super::method::get_compression_signatures_for_address::{ @@ -191,6 +191,13 @@ impl PhotonApi { get_compressed_token_balances_by_owner(&self.db_conn, request).await } + pub async fn get_compressed_token_balances_by_owner_v2( + &self, + request: GetCompressedTokenBalancesByOwnerRequest, + ) -> Result { + get_compressed_token_balances_by_owner_v2(&self.db_conn, request).await + } + pub async fn get_compressed_token_account_balance( &self, request: CompressedAccountRequest, @@ -318,6 +325,11 @@ impl PhotonApi { request: Some(GetCompressedTokenBalancesByOwnerRequest::schema().1), response: TokenBalancesResponse::schema().1, }, + OpenApiSpec { + name: "getCompressedTokenBalancesByOwnerV2".to_string(), + request: Some(GetCompressedTokenBalancesByOwnerRequest::schema().1), + response: TokenBalancesResponseV2::schema().1, + }, OpenApiSpec { name: "getCompressedAccountsByOwner".to_string(), request: Some(GetCompressedAccountsByOwnerRequest::schema().1), diff --git a/src/api/method/get_compressed_accounts_by_owner.rs b/src/api/method/get_compressed_accounts_by_owner.rs index 06167c1..3af0496 100644 --- a/src/api/method/get_compressed_accounts_by_owner.rs +++ b/src/api/method/get_compressed_accounts_by_owner.rs @@ -17,7 +17,7 @@ use super::utils::parse_account_model; // Max filters allowed constant value of 5 const MAX_FILTERS: usize = 5; -const MAX_CHILD_ACCOUNTS_WITH_FILTERS: usize = 100_000; +const MAX_CHILD_ACCOUNTS_WITH_FILTERS: usize = 1_000_000; #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, ToSchema, Default)] #[serde(deny_unknown_fields, rename_all = "camelCase")] diff --git a/src/api/method/get_compressed_token_balances_by_owner.rs b/src/api/method/get_compressed_token_balances_by_owner.rs index 9976785..732a32c 100644 --- a/src/api/method/get_compressed_token_balances_by_owner.rs +++ b/src/api/method/get_compressed_token_balances_by_owner.rs @@ -1,4 +1,3 @@ - use sea_orm::{ColumnTrait, DatabaseConnection, EntityTrait, QueryFilter, QueryOrder, QuerySelect}; use serde::{Deserialize, Serialize}; use utoipa::ToSchema; @@ -8,11 +7,8 @@ use crate::common::typedefs::serializable_pubkey::SerializablePubkey; use crate::common::typedefs::unsigned_integer::UnsignedInteger; use crate::dao::generated::token_owner_balances; -use super::utils::{ - parse_decimal, Context, Limit, - PAGE_LIMIT, -}; use super::super::error::PhotonApiError; +use super::utils::{parse_decimal, Context, Limit, PAGE_LIMIT}; #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, ToSchema)] pub struct TokenBalance { @@ -70,7 +66,7 @@ pub async fn get_compressed_token_balances_by_owner( bytes.len() ))); }; - filter = filter.and(token_owner_balances::Column::Mint.gte::>(mint.into())); + filter = filter.and(token_owner_balances::Column::Mint.gt::>(mint.into())); } let limit = limit.map(|l| l.value()).unwrap_or(PAGE_LIMIT); @@ -108,3 +104,35 @@ pub async fn get_compressed_token_balances_by_owner( context, }) } + +// We do not use generics to simplify documentation generation. +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, ToSchema)] +#[serde(deny_unknown_fields, rename_all = "camelCase")] +pub struct TokenBalancesResponseV2 { + pub context: Context, + pub value: TokenBalanceListV2, +} + +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, ToSchema)] +pub struct TokenBalanceListV2 { + pub items: Vec, + pub cursor: Option, +} + +pub async fn get_compressed_token_balances_by_owner_v2( + conn: &DatabaseConnection, + request: GetCompressedTokenBalancesByOwnerRequest, +) -> Result { + let response = get_compressed_token_balances_by_owner(conn, request).await?; + let context = response.context; + let token_balance_list = response.value; + let token_balances = token_balance_list.token_balances; + let cursor = token_balance_list.cursor; + Ok(TokenBalancesResponseV2 { + value: TokenBalanceListV2 { + items: token_balances, + cursor, + }, + context, + }) +} diff --git a/src/api/rpc_server.rs b/src/api/rpc_server.rs index 0d63ac8..5ba1d67 100644 --- a/src/api/rpc_server.rs +++ b/src/api/rpc_server.rs @@ -310,5 +310,16 @@ fn build_rpc_module(api_and_indexer: PhotonApi) -> Result, }, )?; + module.register_async_method( + "getCompressedTokenBalancesByOwnerV2", + |rpc_params, rpc_context| async move { + let api = rpc_context.as_ref(); + let payload = rpc_params.parse()?; + api.get_compressed_token_balances_by_owner_v2(payload) + .await + .map_err(Into::into) + }, + )?; + Ok(module) } diff --git a/src/openapi/mod.rs b/src/openapi/mod.rs index c6d183c..40dad45 100644 --- a/src/openapi/mod.rs +++ b/src/openapi/mod.rs @@ -11,6 +11,7 @@ use crate::api::method::get_compressed_mint_token_holders::OwnerBalancesResponse use crate::api::method::get_compressed_token_account_balance::TokenAccountBalance; use crate::api::method::get_compressed_token_balances_by_owner::TokenBalance; use crate::api::method::get_compressed_token_balances_by_owner::TokenBalanceList; +use crate::api::method::get_compressed_token_balances_by_owner::TokenBalanceListV2; use crate::api::method::get_multiple_compressed_accounts::AccountList; use crate::api::method::get_multiple_new_address_proofs::AddressListWithTrees; @@ -108,6 +109,7 @@ const JSON_CONTENT_TYPE: &str = "application/json"; OwnerBalance, OwnerBalanceList, OwnerBalancesResponse, + TokenBalanceListV2, )))] struct ApiDoc; diff --git a/src/openapi/specs/getCompressedAccount.yaml b/src/openapi/specs/getCompressedAccount.yaml index 7331ea3..9a73050 100644 --- a/src/openapi/specs/getCompressedAccount.yaml +++ b/src/openapi/specs/getCompressedAccount.yaml @@ -4,7 +4,7 @@ info: description: Solana indexer for general compression license: name: Apache-2.0 - version: 0.47.0 + version: 0.49.0 servers: - url: https://mainnet.helius-rpc.com?api-key= paths: diff --git a/src/openapi/specs/getCompressedAccountBalance.yaml b/src/openapi/specs/getCompressedAccountBalance.yaml index 7145562..a93ce98 100644 --- a/src/openapi/specs/getCompressedAccountBalance.yaml +++ b/src/openapi/specs/getCompressedAccountBalance.yaml @@ -4,7 +4,7 @@ info: description: Solana indexer for general compression license: name: Apache-2.0 - version: 0.47.0 + version: 0.49.0 servers: - url: https://mainnet.helius-rpc.com?api-key= paths: diff --git a/src/openapi/specs/getCompressedAccountProof.yaml b/src/openapi/specs/getCompressedAccountProof.yaml index 9cfbbe6..73e1f67 100644 --- a/src/openapi/specs/getCompressedAccountProof.yaml +++ b/src/openapi/specs/getCompressedAccountProof.yaml @@ -4,7 +4,7 @@ info: description: Solana indexer for general compression license: name: Apache-2.0 - version: 0.47.0 + version: 0.49.0 servers: - url: https://mainnet.helius-rpc.com?api-key= paths: @@ -126,5 +126,5 @@ components: SerializablePubkey: type: string description: A Solana public key represented as a base58 string. - default: 11111116djSnXB2wXVGT4xDLsfTnkp1p4cCxHAfRq - example: 11111116djSnXB2wXVGT4xDLsfTnkp1p4cCxHAfRq + default: 11111117353mdUKehx9GW6JNHznGt5oSZs9fWkVkB + example: 11111117353mdUKehx9GW6JNHznGt5oSZs9fWkVkB diff --git a/src/openapi/specs/getCompressedAccountsByOwner.yaml b/src/openapi/specs/getCompressedAccountsByOwner.yaml index 765fa4f..e18c67c 100644 --- a/src/openapi/specs/getCompressedAccountsByOwner.yaml +++ b/src/openapi/specs/getCompressedAccountsByOwner.yaml @@ -4,7 +4,7 @@ info: description: Solana indexer for general compression license: name: Apache-2.0 - version: 0.47.0 + version: 0.49.0 servers: - url: https://mainnet.helius-rpc.com?api-key= paths: @@ -212,8 +212,8 @@ components: SerializablePubkey: type: string description: A Solana public key represented as a base58 string. - default: 11111114DhpssPJgSi1YU7hCMfYt1BJ334YgsffXm - example: 11111114DhpssPJgSi1YU7hCMfYt1BJ334YgsffXm + default: 11111114d3RrygbPdAtMuFnDmzsN8T5fYKVQ7FVr7 + example: 11111114d3RrygbPdAtMuFnDmzsN8T5fYKVQ7FVr7 UnsignedInteger: type: integer default: 100 diff --git a/src/openapi/specs/getCompressedBalanceByOwner.yaml b/src/openapi/specs/getCompressedBalanceByOwner.yaml index 13db8a1..3219896 100644 --- a/src/openapi/specs/getCompressedBalanceByOwner.yaml +++ b/src/openapi/specs/getCompressedBalanceByOwner.yaml @@ -4,7 +4,7 @@ info: description: Solana indexer for general compression license: name: Apache-2.0 - version: 0.47.0 + version: 0.49.0 servers: - url: https://mainnet.helius-rpc.com?api-key= paths: diff --git a/src/openapi/specs/getCompressedMintTokenHolders.yaml b/src/openapi/specs/getCompressedMintTokenHolders.yaml index bdf2c21..c276a2a 100644 --- a/src/openapi/specs/getCompressedMintTokenHolders.yaml +++ b/src/openapi/specs/getCompressedMintTokenHolders.yaml @@ -4,7 +4,7 @@ info: description: Solana indexer for general compression license: name: Apache-2.0 - version: 0.47.0 + version: 0.49.0 servers: - url: https://mainnet.helius-rpc.com?api-key= paths: @@ -132,8 +132,8 @@ components: SerializablePubkey: type: string description: A Solana public key represented as a base58 string. - default: 11111114d3RrygbPdAtMuFnDmzsN8T5fYKVQ7FVr7 - example: 11111114d3RrygbPdAtMuFnDmzsN8T5fYKVQ7FVr7 + default: 111111152P2r5yt6odmBLPsFCLBrFisJ3aS7LqLAT + example: 111111152P2r5yt6odmBLPsFCLBrFisJ3aS7LqLAT UnsignedInteger: type: integer default: 100 diff --git a/src/openapi/specs/getCompressedTokenAccountBalance.yaml b/src/openapi/specs/getCompressedTokenAccountBalance.yaml index e08a5c0..30ea264 100644 --- a/src/openapi/specs/getCompressedTokenAccountBalance.yaml +++ b/src/openapi/specs/getCompressedTokenAccountBalance.yaml @@ -4,7 +4,7 @@ info: description: Solana indexer for general compression license: name: Apache-2.0 - version: 0.47.0 + version: 0.49.0 servers: - url: https://mainnet.helius-rpc.com?api-key= paths: diff --git a/src/openapi/specs/getCompressedTokenAccountsByDelegate.yaml b/src/openapi/specs/getCompressedTokenAccountsByDelegate.yaml index adf7050..4971599 100644 --- a/src/openapi/specs/getCompressedTokenAccountsByDelegate.yaml +++ b/src/openapi/specs/getCompressedTokenAccountsByDelegate.yaml @@ -4,7 +4,7 @@ info: description: Solana indexer for general compression license: name: Apache-2.0 - version: 0.47.0 + version: 0.49.0 servers: - url: https://mainnet.helius-rpc.com?api-key= paths: @@ -173,8 +173,8 @@ components: SerializablePubkey: type: string description: A Solana public key represented as a base58 string. - default: 11111115q4EpJaTXAZWpCg3J2zppWGSZ46KXozzo9 - example: 11111115q4EpJaTXAZWpCg3J2zppWGSZ46KXozzo9 + default: 11111116EPqoQskEM2Pddp8KTL9JdYEBZMGF3aq7V + example: 11111116EPqoQskEM2Pddp8KTL9JdYEBZMGF3aq7V TokenAcccount: type: object required: diff --git a/src/openapi/specs/getCompressedTokenAccountsByOwner.yaml b/src/openapi/specs/getCompressedTokenAccountsByOwner.yaml index 0266c25..004cf20 100644 --- a/src/openapi/specs/getCompressedTokenAccountsByOwner.yaml +++ b/src/openapi/specs/getCompressedTokenAccountsByOwner.yaml @@ -4,7 +4,7 @@ info: description: Solana indexer for general compression license: name: Apache-2.0 - version: 0.47.0 + version: 0.49.0 servers: - url: https://mainnet.helius-rpc.com?api-key= paths: @@ -173,8 +173,8 @@ components: SerializablePubkey: type: string description: A Solana public key represented as a base58 string. - default: 11111115RidqCHAoz6dzmXxGcfWLNzevYqNpaRAUo - example: 11111115RidqCHAoz6dzmXxGcfWLNzevYqNpaRAUo + default: 11111115q4EpJaTXAZWpCg3J2zppWGSZ46KXozzo9 + example: 11111115q4EpJaTXAZWpCg3J2zppWGSZ46KXozzo9 TokenAcccount: type: object required: diff --git a/src/openapi/specs/getCompressedTokenBalancesByOwner.yaml b/src/openapi/specs/getCompressedTokenBalancesByOwner.yaml index 7ebd13e..7d01cad 100644 --- a/src/openapi/specs/getCompressedTokenBalancesByOwner.yaml +++ b/src/openapi/specs/getCompressedTokenBalancesByOwner.yaml @@ -4,7 +4,7 @@ info: description: Solana indexer for general compression license: name: Apache-2.0 - version: 0.47.0 + version: 0.49.0 servers: - url: https://mainnet.helius-rpc.com?api-key= paths: diff --git a/src/openapi/specs/getCompressedTokenBalancesByOwnerV2.yaml b/src/openapi/specs/getCompressedTokenBalancesByOwnerV2.yaml new file mode 100644 index 0000000..ad4e039 --- /dev/null +++ b/src/openapi/specs/getCompressedTokenBalancesByOwnerV2.yaml @@ -0,0 +1,144 @@ +openapi: 3.0.3 +info: + title: photon-indexer + description: Solana indexer for general compression + license: + name: Apache-2.0 + version: 0.49.0 +servers: +- url: https://mainnet.helius-rpc.com?api-key= +paths: + /: + summary: getCompressedTokenBalancesByOwnerV2 + post: + requestBody: + content: + application/json: + schema: + type: object + required: + - jsonrpc + - id + - method + - params + properties: + id: + type: string + description: An ID to identify the request. + enum: + - test-account + jsonrpc: + type: string + description: The version of the JSON-RPC protocol. + enum: + - '2.0' + method: + type: string + description: The name of the method to invoke. + enum: + - getCompressedTokenBalancesByOwnerV2 + params: + type: object + required: + - owner + properties: + cursor: + allOf: + - $ref: '#/components/schemas/Base58String' + nullable: true + limit: + allOf: + - $ref: '#/components/schemas/Limit' + nullable: true + mint: + allOf: + - $ref: '#/components/schemas/SerializablePubkey' + nullable: true + owner: + $ref: '#/components/schemas/SerializablePubkey' + additionalProperties: false + required: true + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + required: + - context + - value + properties: + context: + $ref: '#/components/schemas/Context' + value: + $ref: '#/components/schemas/TokenBalanceListV2' + additionalProperties: false + '429': + description: Exceeded rate limit. + content: + application/json: + schema: + type: object + properties: + error: + type: string + '500': + description: The server encountered an unexpected condition that prevented it from fulfilling the request. + content: + application/json: + schema: + type: object + properties: + error: + type: string +components: + schemas: + Base58String: + type: string + description: A base 58 encoded string. + default: 3J98t1WpEZ73CNm + example: 3J98t1WpEZ73CNm + Context: + type: object + required: + - slot + properties: + slot: + type: integer + default: 100 + example: 100 + Limit: + type: integer + format: int64 + minimum: 0 + SerializablePubkey: + type: string + description: A Solana public key represented as a base58 string. + default: 11111114DhpssPJgSi1YU7hCMfYt1BJ334YgsffXm + example: 11111114DhpssPJgSi1YU7hCMfYt1BJ334YgsffXm + TokenBalance: + type: object + required: + - mint + - balance + properties: + balance: + $ref: '#/components/schemas/UnsignedInteger' + mint: + $ref: '#/components/schemas/SerializablePubkey' + TokenBalanceListV2: + type: object + required: + - items + properties: + cursor: + $ref: '#/components/schemas/Base58String' + items: + type: array + items: + $ref: '#/components/schemas/TokenBalance' + UnsignedInteger: + type: integer + default: 100 + example: 100 diff --git a/src/openapi/specs/getCompressionSignaturesForAccount.yaml b/src/openapi/specs/getCompressionSignaturesForAccount.yaml index fb52362..b6d5f07 100644 --- a/src/openapi/specs/getCompressionSignaturesForAccount.yaml +++ b/src/openapi/specs/getCompressionSignaturesForAccount.yaml @@ -4,7 +4,7 @@ info: description: Solana indexer for general compression license: name: Apache-2.0 - version: 0.47.0 + version: 0.49.0 servers: - url: https://mainnet.helius-rpc.com?api-key= paths: diff --git a/src/openapi/specs/getCompressionSignaturesForAddress.yaml b/src/openapi/specs/getCompressionSignaturesForAddress.yaml index 1c21a38..eeb0256 100644 --- a/src/openapi/specs/getCompressionSignaturesForAddress.yaml +++ b/src/openapi/specs/getCompressionSignaturesForAddress.yaml @@ -4,7 +4,7 @@ info: description: Solana indexer for general compression license: name: Apache-2.0 - version: 0.47.0 + version: 0.49.0 servers: - url: https://mainnet.helius-rpc.com?api-key= paths: @@ -117,8 +117,8 @@ components: SerializablePubkey: type: string description: A Solana public key represented as a base58 string. - default: 111111193m4hAxmCcGXMfnjVPfNhWSjb69sDgffKu - example: 111111193m4hAxmCcGXMfnjVPfNhWSjb69sDgffKu + default: 11111119T6fgHG3unjQB6vpWozhBdiXDbQovvFVeF + example: 11111119T6fgHG3unjQB6vpWozhBdiXDbQovvFVeF SerializableSignature: type: string description: A Solana transaction signature. diff --git a/src/openapi/specs/getCompressionSignaturesForOwner.yaml b/src/openapi/specs/getCompressionSignaturesForOwner.yaml index f8b8b59..21ff2fb 100644 --- a/src/openapi/specs/getCompressionSignaturesForOwner.yaml +++ b/src/openapi/specs/getCompressionSignaturesForOwner.yaml @@ -4,7 +4,7 @@ info: description: Solana indexer for general compression license: name: Apache-2.0 - version: 0.47.0 + version: 0.49.0 servers: - url: https://mainnet.helius-rpc.com?api-key= paths: @@ -117,8 +117,8 @@ components: SerializablePubkey: type: string description: A Solana public key represented as a base58 string. - default: 11111119T6fgHG3unjQB6vpWozhBdiXDbQovvFVeF - example: 11111119T6fgHG3unjQB6vpWozhBdiXDbQovvFVeF + default: 11111119rSGfPZLcyCGzY4uYEL1fkzJr6fke9qKxb + example: 11111119rSGfPZLcyCGzY4uYEL1fkzJr6fke9qKxb SerializableSignature: type: string description: A Solana transaction signature. diff --git a/src/openapi/specs/getCompressionSignaturesForTokenOwner.yaml b/src/openapi/specs/getCompressionSignaturesForTokenOwner.yaml index a02c6a1..a37cc65 100644 --- a/src/openapi/specs/getCompressionSignaturesForTokenOwner.yaml +++ b/src/openapi/specs/getCompressionSignaturesForTokenOwner.yaml @@ -4,7 +4,7 @@ info: description: Solana indexer for general compression license: name: Apache-2.0 - version: 0.47.0 + version: 0.49.0 servers: - url: https://mainnet.helius-rpc.com?api-key= paths: @@ -117,8 +117,8 @@ components: SerializablePubkey: type: string description: A Solana public key represented as a base58 string. - default: 11111119rSGfPZLcyCGzY4uYEL1fkzJr6fke9qKxb - example: 11111119rSGfPZLcyCGzY4uYEL1fkzJr6fke9qKxb + default: 1111111AFmseVrdL9f9oyCzZefL9tG6UbvhMPRAGw + example: 1111111AFmseVrdL9f9oyCzZefL9tG6UbvhMPRAGw SerializableSignature: type: string description: A Solana transaction signature. diff --git a/src/openapi/specs/getIndexerHealth.yaml b/src/openapi/specs/getIndexerHealth.yaml index 1eb30b7..6b86bac 100644 --- a/src/openapi/specs/getIndexerHealth.yaml +++ b/src/openapi/specs/getIndexerHealth.yaml @@ -4,7 +4,7 @@ info: description: Solana indexer for general compression license: name: Apache-2.0 - version: 0.47.0 + version: 0.49.0 servers: - url: https://mainnet.helius-rpc.com?api-key= paths: diff --git a/src/openapi/specs/getIndexerSlot.yaml b/src/openapi/specs/getIndexerSlot.yaml index 9aa5305..ff0ac38 100644 --- a/src/openapi/specs/getIndexerSlot.yaml +++ b/src/openapi/specs/getIndexerSlot.yaml @@ -4,7 +4,7 @@ info: description: Solana indexer for general compression license: name: Apache-2.0 - version: 0.47.0 + version: 0.49.0 servers: - url: https://mainnet.helius-rpc.com?api-key= paths: diff --git a/src/openapi/specs/getLatestCompressionSignatures.yaml b/src/openapi/specs/getLatestCompressionSignatures.yaml index 5c940d1..ebbc8cc 100644 --- a/src/openapi/specs/getLatestCompressionSignatures.yaml +++ b/src/openapi/specs/getLatestCompressionSignatures.yaml @@ -4,7 +4,7 @@ info: description: Solana indexer for general compression license: name: Apache-2.0 - version: 0.47.0 + version: 0.49.0 servers: - url: https://mainnet.helius-rpc.com?api-key= paths: diff --git a/src/openapi/specs/getLatestNonVotingSignatures.yaml b/src/openapi/specs/getLatestNonVotingSignatures.yaml index 134475f..1ebea51 100644 --- a/src/openapi/specs/getLatestNonVotingSignatures.yaml +++ b/src/openapi/specs/getLatestNonVotingSignatures.yaml @@ -4,7 +4,7 @@ info: description: Solana indexer for general compression license: name: Apache-2.0 - version: 0.47.0 + version: 0.49.0 servers: - url: https://mainnet.helius-rpc.com?api-key= paths: diff --git a/src/openapi/specs/getMultipleCompressedAccountProofs.yaml b/src/openapi/specs/getMultipleCompressedAccountProofs.yaml index d1c34f8..0eb3586 100644 --- a/src/openapi/specs/getMultipleCompressedAccountProofs.yaml +++ b/src/openapi/specs/getMultipleCompressedAccountProofs.yaml @@ -4,7 +4,7 @@ info: description: Solana indexer for general compression license: name: Apache-2.0 - version: 0.47.0 + version: 0.49.0 servers: - url: https://mainnet.helius-rpc.com?api-key= paths: @@ -125,5 +125,5 @@ components: SerializablePubkey: type: string description: A Solana public key represented as a base58 string. - default: 11111117353mdUKehx9GW6JNHznGt5oSZs9fWkVkB - example: 11111117353mdUKehx9GW6JNHznGt5oSZs9fWkVkB + default: 11111117SQekjmcMtR25wEPPiL6m1Mb5586NkLL4X + example: 11111117SQekjmcMtR25wEPPiL6m1Mb5586NkLL4X diff --git a/src/openapi/specs/getMultipleCompressedAccounts.yaml b/src/openapi/specs/getMultipleCompressedAccounts.yaml index 388770c..347ac0e 100644 --- a/src/openapi/specs/getMultipleCompressedAccounts.yaml +++ b/src/openapi/specs/getMultipleCompressedAccounts.yaml @@ -4,7 +4,7 @@ info: description: Solana indexer for general compression license: name: Apache-2.0 - version: 0.47.0 + version: 0.49.0 servers: - url: https://mainnet.helius-rpc.com?api-key= paths: @@ -176,8 +176,8 @@ components: SerializablePubkey: type: string description: A Solana public key represented as a base58 string. - default: 111111152P2r5yt6odmBLPsFCLBrFisJ3aS7LqLAT - example: 111111152P2r5yt6odmBLPsFCLBrFisJ3aS7LqLAT + default: 11111115RidqCHAoz6dzmXxGcfWLNzevYqNpaRAUo + example: 11111115RidqCHAoz6dzmXxGcfWLNzevYqNpaRAUo UnsignedInteger: type: integer default: 100 diff --git a/src/openapi/specs/getMultipleNewAddressProofs.yaml b/src/openapi/specs/getMultipleNewAddressProofs.yaml index 5d8a7ca..5b227b8 100644 --- a/src/openapi/specs/getMultipleNewAddressProofs.yaml +++ b/src/openapi/specs/getMultipleNewAddressProofs.yaml @@ -4,7 +4,7 @@ info: description: Solana indexer for general compression license: name: Apache-2.0 - version: 0.47.0 + version: 0.49.0 servers: - url: https://mainnet.helius-rpc.com?api-key= paths: @@ -135,5 +135,5 @@ components: SerializablePubkey: type: string description: A Solana public key represented as a base58 string. - default: 11111117SQekjmcMtR25wEPPiL6m1Mb5586NkLL4X - example: 11111117SQekjmcMtR25wEPPiL6m1Mb5586NkLL4X + default: 11111117qkFjr4u54stuNNUR8fRF8dNhaP35yvANs + example: 11111117qkFjr4u54stuNNUR8fRF8dNhaP35yvANs diff --git a/src/openapi/specs/getMultipleNewAddressProofsV2.yaml b/src/openapi/specs/getMultipleNewAddressProofsV2.yaml index 31900a3..d215ae5 100644 --- a/src/openapi/specs/getMultipleNewAddressProofsV2.yaml +++ b/src/openapi/specs/getMultipleNewAddressProofsV2.yaml @@ -4,7 +4,7 @@ info: description: Solana indexer for general compression license: name: Apache-2.0 - version: 0.47.0 + version: 0.49.0 servers: - url: https://mainnet.helius-rpc.com?api-key= paths: @@ -146,5 +146,5 @@ components: SerializablePubkey: type: string description: A Solana public key represented as a base58 string. - default: 11111117qkFjr4u54stuNNUR8fRF8dNhaP35yvANs - example: 11111117qkFjr4u54stuNNUR8fRF8dNhaP35yvANs + default: 11111118F5rixNBnFLmioWZSYzjjFuAL5dyoDVzhD + example: 11111118F5rixNBnFLmioWZSYzjjFuAL5dyoDVzhD diff --git a/src/openapi/specs/getTransactionWithCompressionInfo.yaml b/src/openapi/specs/getTransactionWithCompressionInfo.yaml index 9842990..b09423f 100644 --- a/src/openapi/specs/getTransactionWithCompressionInfo.yaml +++ b/src/openapi/specs/getTransactionWithCompressionInfo.yaml @@ -4,7 +4,7 @@ info: description: Solana indexer for general compression license: name: Apache-2.0 - version: 0.47.0 + version: 0.49.0 servers: - url: https://mainnet.helius-rpc.com?api-key= paths: @@ -164,8 +164,8 @@ components: SerializablePubkey: type: string description: A Solana public key represented as a base58 string. - default: 11111116EPqoQskEM2Pddp8KTL9JdYEBZMGF3aq7V - example: 11111116EPqoQskEM2Pddp8KTL9JdYEBZMGF3aq7V + default: 11111116djSnXB2wXVGT4xDLsfTnkp1p4cCxHAfRq + example: 11111116djSnXB2wXVGT4xDLsfTnkp1p4cCxHAfRq SerializableSignature: type: string description: A Solana transaction signature. diff --git a/src/openapi/specs/getValidityProof.yaml b/src/openapi/specs/getValidityProof.yaml index fd4758a..5145d20 100644 --- a/src/openapi/specs/getValidityProof.yaml +++ b/src/openapi/specs/getValidityProof.yaml @@ -4,7 +4,7 @@ info: description: Solana indexer for general compression license: name: Apache-2.0 - version: 0.47.0 + version: 0.49.0 servers: - url: https://mainnet.helius-rpc.com?api-key= paths: @@ -169,5 +169,5 @@ components: SerializablePubkey: type: string description: A Solana public key represented as a base58 string. - default: 11111118F5rixNBnFLmioWZSYzjjFuAL5dyoDVzhD - example: 11111118F5rixNBnFLmioWZSYzjjFuAL5dyoDVzhD + default: 11111118eRTi4fUVRoeYEeeTyL4DPAwxatvWT5q1Z + example: 11111118eRTi4fUVRoeYEeeTyL4DPAwxatvWT5q1Z diff --git a/tests/integration_tests/mock_tests.rs b/tests/integration_tests/mock_tests.rs index 1008b8d..32c67b0 100644 --- a/tests/integration_tests/mock_tests.rs +++ b/tests/integration_tests/mock_tests.rs @@ -554,11 +554,19 @@ async fn test_persist_token_data( }; let res = setup .api - .get_compressed_token_balances_by_owner(request) + .get_compressed_token_balances_by_owner(request.clone()) .await .unwrap() .value; assert_eq!(res.token_balances[0].balance.0, *balance); + + let res_v2 = setup + .api + .get_compressed_token_balances_by_owner_v2(request) + .await + .unwrap() + .value; + assert_eq!(res_v2.items, res.token_balances); } verify_response_matches_input_token_data(res.clone(), owner_tlv); @@ -649,6 +657,45 @@ async fn test_persist_token_data( assert_eq!(item.balance.0, *owner_to_balance.get(&item.owner).unwrap()); } } + + let mut owner_to_balances = HashMap::new(); + for (mint, balances) in mint_to_owner_to_balance.into_iter() { + for (owner, balance) in balances.into_iter() { + owner_to_balances + .entry(owner) + .or_insert(HashMap::new()) + .insert(mint, balance); + } + } + for owner in owner_to_balances.keys() { + let mut cursor = None; + let mut mint_to_balance = HashMap::new(); + + loop { + let request = GetCompressedTokenBalancesByOwnerRequest { + owner: owner.clone(), + cursor, + limit: Some(photon_indexer::api::method::utils::Limit::new(1).unwrap()), + ..Default::default() + }; + let res = setup + .api + .get_compressed_token_balances_by_owner(request) + .await + .unwrap() + .value; + let token_balances = res.token_balances; + for token_balance in token_balances.iter() { + let balance = mint_to_balance.entry(token_balance.mint).or_insert(0); + *balance += token_balance.balance.0; + } + cursor = res.cursor; + if cursor.is_none() { + break; + } + } + assert_eq!(mint_to_balance, *owner_to_balances.get(owner).unwrap()); + } } #[tokio::test]