-
Notifications
You must be signed in to change notification settings - Fork 56
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
39 changed files
with
513 additions
and
249 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
Submodule emerald-grpc
updated
from 3a98f8 to 76d953
2 changes: 1 addition & 1 deletion
2
foundation/src/main/kotlin/io/emeraldpay/dshackle/BlockchainType.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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
package io.emeraldpay.dshackle | ||
|
||
enum class BlockchainType { | ||
UNKNOWN, BITCOIN, ETHEREUM, STARKNET, POLKADOT; | ||
UNKNOWN, BITCOIN, ETHEREUM, STARKNET, POLKADOT, SOLANA; | ||
} |
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
110 changes: 110 additions & 0 deletions
110
src/main/kotlin/io/emeraldpay/dshackle/upstream/DefaultSolanaMethods.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,110 @@ | ||
package io.emeraldpay.dshackle.upstream | ||
|
||
import io.emeraldpay.dshackle.quorum.AlwaysQuorum | ||
import io.emeraldpay.dshackle.quorum.BroadcastQuorum | ||
import io.emeraldpay.dshackle.quorum.CallQuorum | ||
import io.emeraldpay.dshackle.upstream.calls.CallMethods | ||
import io.emeraldpay.etherjar.rpc.RpcException | ||
|
||
class DefaultSolanaMethods : CallMethods { | ||
companion object { | ||
val subs = setOf( | ||
"accountSubscribe" to "accountUnsubscribe", | ||
"blockSubscribe" to "blockUnsubscribe", | ||
"logsSubscribe" to "logsUnsubscribe", | ||
"programSubscribe" to "programUnsubscribe", | ||
"signatureSubscribe" to "signatureUnsubscribe", | ||
"slotSubscribe" to "slotUnsubscribe", | ||
) | ||
} | ||
|
||
private val all = setOf( | ||
"getAccountInfo", | ||
"getBalance", | ||
"getBlock", | ||
"getBlockHeight", | ||
"getBlockProduction", | ||
"getBlockCommitment", | ||
"getBlocks", | ||
"getBlocksWithLimit", | ||
"getBlockTime", | ||
"getClusterNodes", | ||
"getEpochInfo", | ||
"getEpochSchedule", | ||
"getFeeForMessage", | ||
"getFirstAvailableBlock", | ||
"getGenesisHash", | ||
"getHealth", | ||
"getHighestSnapshotSlot", | ||
"getInflationGovernor", | ||
"getInflationRate", | ||
"getInflationReward", | ||
"getLargestAccounts", | ||
"getLatestBlockhash", | ||
"getLeaderSchedule", | ||
"getMaxRetransmitSlot", | ||
"getMaxShredInsertSlot", | ||
"getMinimumBalanceForRentExemption", | ||
"getMultipleAccounts", | ||
"getProgramAccounts", | ||
"getRecentPerformanceSamples", | ||
"getRecentPrioritizationFees", | ||
"getSignaturesForAddress", | ||
"getSignatureStatuses", | ||
"getSlot", | ||
"getSlotLeader", | ||
"getSlotLeaders", | ||
"getStakeActivation", | ||
"getStakeMinimumDelegation", | ||
"getSupply", | ||
"getTokenAccountBalance", | ||
"getTokenAccountsByDelegate", | ||
"getTokenAccountsByOwner", | ||
"getTokenLargestAccounts", | ||
"getTokenSupply", | ||
"getTransaction", | ||
"getTransactionCount", | ||
"getVersion", | ||
"getVoteAccounts", | ||
"isBlockhashValid", | ||
"minimumLedgerSlot", | ||
"requestAirdrop", | ||
"simulateTransaction", | ||
) | ||
|
||
private val add = setOf( | ||
"sendTransaction", | ||
) | ||
|
||
private val allowedMethods: Set<String> = all + add | ||
|
||
override fun createQuorumFor(method: String): CallQuorum { | ||
return when { | ||
add.contains(method) -> BroadcastQuorum() | ||
all.contains(method) -> AlwaysQuorum() | ||
else -> AlwaysQuorum() | ||
} | ||
} | ||
|
||
override fun isCallable(method: String): Boolean { | ||
return allowedMethods.contains(method) | ||
} | ||
|
||
override fun isHardcoded(method: String): Boolean { | ||
return false | ||
} | ||
|
||
override fun executeHardcoded(method: String): ByteArray { | ||
throw RpcException(-32601, "Method not found") | ||
} | ||
|
||
override fun getGroupMethods(groupName: String): Set<String> = | ||
when (groupName) { | ||
"default" -> getSupportedMethods() | ||
else -> emptyList() | ||
}.toSet() | ||
|
||
override fun getSupportedMethods(): Set<String> { | ||
return allowedMethods.toSortedSet() | ||
} | ||
} |
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
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
56 changes: 0 additions & 56 deletions
56
...io/emeraldpay/dshackle/upstream/ethereum/subscribe/EthereumDshackleIngressSubscription.kt
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.