-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
105 additions
and
76 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
61 changes: 0 additions & 61 deletions
61
blockchain/src/main/java/com/gemwallet/android/blockchain/clients/solana/SolanaRpcClient.kt
This file was deleted.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
...kchain/src/main/java/com/gemwallet/android/blockchain/clients/solana/SolanaTokenClient.kt
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
11 changes: 11 additions & 0 deletions
11
...n/java/com/gemwallet/android/blockchain/clients/solana/services/SolanaBroadcastService.kt
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,11 @@ | ||
package com.gemwallet.android.blockchain.clients.solana.services | ||
|
||
import com.gemwallet.android.blockchain.rpc.model.JSONRpcRequest | ||
import com.gemwallet.android.blockchain.rpc.model.JSONRpcResponse | ||
import retrofit2.http.Body | ||
import retrofit2.http.POST | ||
|
||
interface SolanaBroadcastService { | ||
@POST("/") | ||
suspend fun broadcast(@Body request: JSONRpcRequest<List<Any>>): Result<JSONRpcResponse<String>> | ||
} |
33 changes: 33 additions & 0 deletions
33
.../java/com/gemwallet/android/blockchain/clients/solana/services/SolanaNodeStatusService.kt
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,33 @@ | ||
package com.gemwallet.android.blockchain.clients.solana.services | ||
|
||
import com.gemwallet.android.blockchain.clients.solana.SolanaMethod | ||
import com.gemwallet.android.blockchain.rpc.model.JSONRpcRequest | ||
import com.gemwallet.android.blockchain.rpc.model.JSONRpcResponse | ||
import retrofit2.Response | ||
import retrofit2.http.Body | ||
import retrofit2.http.POST | ||
import retrofit2.http.Url | ||
|
||
interface SolanaNodeStatusService { | ||
|
||
@POST | ||
suspend fun health(@Url url: String,@Body request: JSONRpcRequest<List<String>>): Response<JSONRpcResponse<String>> | ||
|
||
@POST | ||
suspend fun slot(@Url url: String, @Body request: JSONRpcRequest<List<String>>): Result<JSONRpcResponse<Int>> | ||
|
||
@POST | ||
suspend fun genesisHash(@Url url: String, @Body request: JSONRpcRequest<List<String>>): Result<JSONRpcResponse<String>> | ||
} | ||
|
||
suspend fun SolanaNodeStatusService.health(url: String): Response<JSONRpcResponse<String>> { | ||
return health(url, JSONRpcRequest.create(SolanaMethod.GetHealth, emptyList())) | ||
} | ||
|
||
suspend fun SolanaNodeStatusService.slot(url: String): Result<JSONRpcResponse<Int>> { | ||
return slot(url, JSONRpcRequest.create(SolanaMethod.GetSlot, emptyList())) | ||
} | ||
|
||
suspend fun SolanaNodeStatusService.genesisHash(url: String): Result<JSONRpcResponse<String>> { | ||
return genesisHash(url, JSONRpcRequest.create(SolanaMethod.GetGenesisHash, emptyList())) | ||
} |
11 changes: 11 additions & 0 deletions
11
...src/main/java/com/gemwallet/android/blockchain/clients/solana/services/SolanaRpcClient.kt
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,11 @@ | ||
package com.gemwallet.android.blockchain.clients.solana.services | ||
|
||
interface SolanaRpcClient : | ||
SolanaAccountsService, | ||
SolanaBalancesService, | ||
SolanaStakeService, | ||
SolanaFeeService, | ||
SolanaNetworkInfoService, | ||
SolanaBroadcastService, | ||
SolanaTransactionsService, | ||
SolanaNodeStatusService |
27 changes: 27 additions & 0 deletions
27
...ava/com/gemwallet/android/blockchain/clients/solana/services/SolanaTransactionsService.kt
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,27 @@ | ||
package com.gemwallet.android.blockchain.clients.solana.services | ||
|
||
import com.gemwallet.android.blockchain.clients.solana.SolanaMethod | ||
import com.gemwallet.android.blockchain.rpc.model.JSONRpcRequest | ||
import com.gemwallet.android.blockchain.rpc.model.JSONRpcResponse | ||
import com.wallet.core.blockchain.solana.models.SolanaTransaction | ||
import retrofit2.http.Body | ||
import retrofit2.http.POST | ||
|
||
interface SolanaTransactionsService { | ||
@POST("/") | ||
suspend fun transaction(@Body request: JSONRpcRequest<List<Any>>): Result<JSONRpcResponse<SolanaTransaction>> | ||
} | ||
|
||
suspend fun SolanaTransactionsService.transaction(hash: String): Result<JSONRpcResponse<SolanaTransaction>> { | ||
val request = JSONRpcRequest.create( | ||
SolanaMethod.GetTransaction, | ||
listOf( | ||
hash, | ||
mapOf( | ||
"encoding" to "jsonParsed", | ||
"maxSupportedTransactionVersion" to 0, | ||
), | ||
) | ||
) | ||
return transaction(request) | ||
} |
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