Skip to content

Commit

Permalink
more cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Funkatronics committed Jun 14, 2024
1 parent 2778499 commit 4a256fa
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import kotlinx.serialization.serializer
import kotlin.math.pow

class SolanaRpcClient(
val rpcDriver: Rpc20Driver,
private val rpcDriver: Rpc20Driver,
private val defaultTransactionOptions: TransactionOptions = TransactionOptions()
) {

Expand All @@ -26,12 +26,6 @@ class SolanaRpcClient(
defaultTransactionOptions: TransactionOptions = TransactionOptions()
) : this(Rpc20Driver(url, networkDriver), defaultTransactionOptions)

suspend inline fun <T> makeRequest(request: RpcRequest, serializer: KSerializer<T>) =
rpcDriver.makeRequest(request, serializer)

suspend inline fun <reified T> makeRequest(request: RpcRequest) =
rpcDriver.makeRequest<T>(request, serializer())

suspend fun requestAirdrop(address: SolanaPublicKey, amountSol: Float, requestId: String? = null) =
makeRequest(
AirdropRequest(address, (amountSol * 10f.pow(9)).toLong(), requestId),
Expand Down Expand Up @@ -136,4 +130,10 @@ class SolanaRpcClient(

return@withTimeout Result.success(isActive)
}

private suspend inline fun <T> makeRequest(request: RpcRequest, serializer: KSerializer<T>) =
rpcDriver.makeRequest(request, serializer)

private suspend inline fun <reified T> makeRequest(request: RpcRequest) =
rpcDriver.makeRequest<T>(request, serializer())
}

0 comments on commit 4a256fa

Please sign in to comment.