diff --git a/build.gradle.kts b/build.gradle.kts index ade0647..c0b0f7c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -44,6 +44,7 @@ dependencies { runtimeOnly("org.apache.logging.log4j:log4j-core:2.26.0") runtimeOnly("org.apache.logging.log4j:log4j-slf4j2-impl:2.26.0") + implementation("com.r35157.nenjim:hubd-api:0.1-dev") implementation("com.fasterxml.jackson.core:jackson-databind:2.18.6") implementation("com.fazecast:jSerialComm:2.11.4") implementation("com.google.code.gson:gson:2.14.0") diff --git a/src/main/tjava/com/r35157/libs/solana/SolanaBlockChain.tjava b/src/main/tjava/com/r35157/libs/solana/SolanaBlockChain.tjava deleted file mode 100644 index 4e22891..0000000 --- a/src/main/tjava/com/r35157/libs/solana/SolanaBlockChain.tjava +++ /dev/null @@ -1,146 +0,0 @@ -package com.r35157.libs.solana; - -import com.r35157.libs.solana.valuetypes.SolanaProgramDerivedAddress; -import com.r35157.libs.solana.valuetypes.economic.SolanaSPLTokenProgram; -import com.r35157.libs.valuetypes.basic.MoneyAmount; - -import java.io.IOException; -import java.util.List; -import java.util.Map; -import java.util.Set; - -/** - * Provides read-oriented access to the Solana blockchain. - * - *

This interface exposes the Solana operations needed by higher-level - * integrations. It can fetch native SOL balances, SPL token holdings, NFT-like - * token holding candidates, account information and program derived addresses.

- * - *

The interface is intentionally generic and does not contain Raydium-specific - * logic. Higher-level integrations are expected to interpret Solana accounts, - * token holdings and derived addresses according to their own domain rules.

- */ -public interface SolanaBlockChain { - /** - * Fetches the native SOL balance for a Solana address. - * - * @param address the Solana address to inspect - * @return the native SOL balance for the address - * @throws IOException if the balance could not be fetched or parsed - * @throws InterruptedException if the calling thread is interrupted while fetching the balance - */ - ΩSolanaAmountΩ getBalanceInSolana(ΩSolanaAddressΩ address) throws IOException, InterruptedException; - - /** - * Fetches the native SOL balance for a Solana address in lamports. - * - *

Lamports are the smallest unit of native SOL.

- * - * @param address the Solana address to inspect - * @return the native SOL balance for the address in lamports - * @throws IOException if the balance could not be fetched or parsed - * @throws InterruptedException if the calling thread is interrupted while fetching the balance - */ - ΩlamportsΩ getBalanceInLamport(ΩSolanaAddressΩ address) throws IOException, InterruptedException; - - /** - * Fetches SPL token holdings owned by a Solana address for a specific token program. - * - *

The supplied token program decides which token accounts are inspected. For example, - * callers may query the original SPL Token Program or the Token-2022 Program depending - * on which token accounts they need to discover.

- * - * @param ownerAddress the Solana owner address whose token holdings should be inspected - * @param splProgramId the SPL token program to query - * @return a map of SPL mint addresses to token holding information - * @throws IOException if the token holdings could not be fetched or parsed - * @throws InterruptedException if the calling thread is interrupted while fetching token holdings - */ - Map<ΩSPLMintAddressΩ, SPLTokenHolding> getSPLTokenHoldings( - ΩSolanaAddressΩ ownerAddress, - SolanaSPLTokenProgram splProgramId - ) throws IOException, InterruptedException; - - /** - * Fetches NFT-like token mint address candidates owned by a Solana address for a specific token program. - * - *

This method identifies token holdings that look like NFTs within the supplied token - * program. A returned address is only a candidate. Higher-level integrations are responsible - * for deciding whether the returned address has domain-specific meaning.

- * - * // TODO This method currently identifies candidates from the owner's token holdings only. - * // A token with zero decimals and an owner balance of one is not guaranteed to be a real NFT, - * // because the mint's total supply may still be greater than one. A future implementation - * // should verify the mint supply, for example by using Solana getTokenSupply, before treating - * // the result as a confirmed NFT. - * - * @param ownerAddress the Solana owner address whose NFT-like holdings should be inspected - * @param splProgram the SPL token program to query - * @return the NFT-like Solana mint address candidates owned by the address - * @throws IOException if the NFT candidate addresses could not be fetched or parsed - * @throws InterruptedException if the calling thread is interrupted while fetching NFT candidate addresses - */ - Set<ΩSolanaNFTAddressΩ> getSolanaNFTCandidateAddresses( - ΩSolanaAddressΩ ownerAddress, - SolanaSPLTokenProgram splProgram - ) throws IOException, InterruptedException; - - /** - * Finds a Solana program derived address for a program id and a set of seeds. - * - *

The seeds describe the logical inputs used to derive the address. The implementation - * is responsible for converting each seed into the byte representation required by Solana.

- * - * @param programId the Solana program id used to derive the address - * @param seeds the seeds used when deriving the program address - * @return the derived Solana address together with its bump value - */ - SolanaProgramDerivedAddress findProgramAddress( - ΩSolanaProgramIdΩ programId, - List seeds - ); - - /** - * Fetches account information for a Solana account address. - * - *

If the account does not exist, this method returns {@code null}. If the account exists, - * the returned value contains the account address, the owning Solana program id and the - * account data encoded as Base64.

- * - * @param accountAddress the Solana account address to inspect - * @return account information, or {@code null} if the account does not exist - * @throws IOException if the account information could not be fetched or parsed - * @throws InterruptedException if the calling thread is interrupted while fetching account information - */ - SolanaAccountInfo getAccountInfo(ΩSolanaAddressΩ accountAddress) - throws IOException, InterruptedException; - - /** - * Encodes a raw 32-byte Solana address into its textual Solana address representation. - * - *

This method is intended for callers that have obtained raw Solana address bytes from - * account data and need the normal string representation used elsewhere in the API.

- * - * @param addressBytes the raw 32-byte Solana address - * @return the encoded Solana address - * @throws IllegalArgumentException if the supplied byte array is not a valid Solana address length - */ - ΩSolanaAddressΩ encodeSolanaAddress(byte[] addressBytes); - - /** - * Fetches the total supply of an SPL token mint for a specific token program. - * - *

The supplied token program identifies which SPL token program owns the mint, - * for example the original SPL Token Program or the Token-2022 Program.

- * - * @param mintAddress the SPL mint address whose supply should be fetched - * @param splProgram the SPL token program to query - * @return the SPL token supply for the mint - * @throws IOException if the token supply could not be fetched or parsed - * @throws InterruptedException if the calling thread is interrupted while fetching token supply - */ - SPLTokenSupply getSPLTokenSupply( - ΩSPLMintAddressΩ mintAddress, - SolanaSPLTokenProgram splProgram - ) throws IOException, InterruptedException; -} \ No newline at end of file