Skip to content

Commit

Permalink
ALL-3155 Add Tezos support
Browse files Browse the repository at this point in the history
  • Loading branch information
Hathoriel committed Nov 2, 2023
1 parent 4f7231b commit 1cc1624
Show file tree
Hide file tree
Showing 9 changed files with 3,166 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/dto/Network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ export const XRP_LOAD_BALANCER_NETWORKS = [Network.XRP, Network.XRP_TESTNET]
export const NATIVE_EVM_LOAD_BALANCER_NETWORKS = [Network.KLAYTN, Network.KLAYTN_BAOBAB]
export const SOLANA_NETWORKS = [Network.SOLANA, Network.SOLANA_DEVNET]
export const BNB_LOAD_BALANCER_NETWORKS = [Network.BNB]
export const TEZOS_NETWORKS = [Network.TEZOS, Network.TEZOS_TESTNET]

export const LOAD_BALANCER_NETWORKS = [
...UTXO_LOAD_BALANCER_NETWORKS,
Expand All @@ -247,6 +248,7 @@ export const LOAD_BALANCER_NETWORKS = [
...NATIVE_EVM_LOAD_BALANCER_NETWORKS,
...SOLANA_NETWORKS,
...BNB_LOAD_BALANCER_NETWORKS,
...TEZOS_NETWORKS,
]

export const EVM_ARCHIVE_NON_ARCHIVE_LOAD_BALANCER_NETWORKS = [
Expand Down Expand Up @@ -313,6 +315,8 @@ export const isNativeEvmLoadBalancerNetwork = (network: Network) =>

export const isBnbLoadBalancerNetwork = (network: Network) => BNB_LOAD_BALANCER_NETWORKS.includes(network)

export const isTezosNetwork = (network: Network) => TEZOS_NETWORKS.includes(network)

export const isSameGetBlockNetwork = (network: Network) =>
isUtxoBasedNetwork(network) ||
isEvmBasedNetwork(network) ||
Expand Down
150 changes: 150 additions & 0 deletions src/dto/rpc/TezosRpcSuite.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
/* eslint-disable @typescript-eslint/no-explicit-any */

import { RPCSimulateOperationParam } from './tezos.types'

export interface GetBlockHashes extends GetChainId {
length?: number
head?: string
minDate?: string
}

export interface GetContract extends GetContractBase {
normalizeTypes?: string
}

export interface GetChainId {
chainId: string
}

export interface GetBlock extends GetChainId {
block: string
}

export interface GetContractBase extends GetBlock {
contractId: string
}

export interface GetContractsBigMapGet extends GetContractBase {
key: any
type: any
}

export interface GetContractsEntrypoints extends GetContract {
entrypoint: string
}

export interface GetBlockHash extends GetBlock {
hash: string
}

export interface SimulateOperation extends RPCSimulateOperationParam, GetBlock {
}

export interface GetInvalidBlocks extends GetChainId {
blockHash: string
}

export interface GetProtocol {
protocolHash: string
}

export interface InjectBase {
async?: string
chain?: string
}

export interface InjectOperation extends InjectBase {
operationBytes: string
}

export interface InjectBlock extends InjectBase {
force?: string
data: string
operations: { branch: string, data: string }[][]
}

export interface InjectProtocol {
expectedEnvVersion: number
components: {
name: string
interface: string
implementation: string
}[]
async?: string
}

export interface TezosRpcInterface {
getBlocksHead(params: GetChainId): Promise<any>

getBlockHashes(params: GetBlockHashes): Promise<any>

getContracts(params: GetContract): Promise<any>

getContractsTickets(params: GetContractBase): Promise<any>

getContractsBalance(params: GetContractBase): Promise<any>

getContractsBalanceAndFrozenBonds(params: GetContractBase): Promise<any>

getContractsBigMapGet(params: GetContractsBigMapGet): Promise<any>

getContractsCounter(params: GetContractBase): Promise<any>

getContractDelegate(params: GetContractBase): Promise<any>

getContractsEntrypoints(params: GetContract): Promise<any>

getContractsEntrypoint(params: GetContractsEntrypoints): Promise<any>

getContractsManagerKey(params: GetContractBase): Promise<any>

getBlock(params: GetBlock): Promise<any>

getBlockHash(params: GetBlockHash): Promise<any>

getOperationHashes(params: GetBlock): Promise<any>

getOperations(params: GetBlock): Promise<any>

getBlockShell(params: GetBlock): Promise<any>

getBlockHeader(params: GetBlock): Promise<any>

simulateOperation(params: SimulateOperation): Promise<any>

getChainId(params: GetChainId): Promise<any>

getCheckpoint(params: GetChainId): Promise<any>

getInvalidBlocks(params: GetInvalidBlocks): Promise<any>

isBootstrapped(params: GetChainId): Promise<any>

getLevelsCheckpoint(params: GetChainId): Promise<any>

getLevelsCaboose(params: GetChainId): Promise<any>

getLevelsSavePoint(params: GetChainId): Promise<any>

getErrorsSchema(): Promise<any>

getNodeVersion(): Promise<any>

getProtocol(params: GetProtocol): Promise<any>

getConfig(): Promise<any>

getHistoryMode(): Promise<any>

getNetworkDal(): Promise<any>

getUserActivatedProtocolOverrides(): Promise<any>

getUserActivatedUpgrades(): Promise<any>

injectOperation(params: InjectOperation): Promise<string>

injectBlock(params: InjectBlock): Promise<string>

injectProtocol(params: InjectProtocol): Promise<string>
}
Loading

0 comments on commit 1cc1624

Please sign in to comment.