|
| 1 | +/** |
| 2 | + * Concordium gRPC Client — React Native stub |
| 3 | + * |
| 4 | + * Metro resolves this file instead of grpcClient.ts on React Native, |
| 5 | + * severing the dependency chain to @grpc/grpc-js, @grpc/proto-loader, |
| 6 | + * and node:path. The bridge layer (sync, broadcast, sign) uses only |
| 7 | + * proxyClient (HTTP REST) and never reaches these functions at runtime. |
| 8 | + */ |
| 9 | +import type { CryptoCurrency } from "@ledgerhq/types-cryptoassets"; |
| 10 | +import type { |
| 11 | + Block, |
| 12 | + BlockInfo, |
| 13 | + Operation, |
| 14 | + ListOperationsOptions, |
| 15 | + Page, |
| 16 | +} from "@ledgerhq/coin-framework/api/index"; |
| 17 | + |
| 18 | +type GRPCClient = never; |
| 19 | + |
| 20 | +export function getClient(_currency: CryptoCurrency): GRPCClient { |
| 21 | + throw new Error("gRPC client is not available in React Native"); |
| 22 | +} |
| 23 | + |
| 24 | +export async function withClient<T>( |
| 25 | + _currency: CryptoCurrency, |
| 26 | + _execute: (client: GRPCClient) => Promise<T>, |
| 27 | + _retries?: number, |
| 28 | +): Promise<T> { |
| 29 | + throw new Error("gRPC client is not available in React Native"); |
| 30 | +} |
| 31 | + |
| 32 | +export async function getLastBlock(_currency: CryptoCurrency): Promise<BlockInfo> { |
| 33 | + throw new Error("gRPC getLastBlock() method is not available in React Native"); |
| 34 | +} |
| 35 | + |
| 36 | +export async function getBlockInfoByHeight( |
| 37 | + _currency: CryptoCurrency, |
| 38 | + _height: number, |
| 39 | +): Promise<BlockInfo> { |
| 40 | + throw new Error("gRPC getBlockInfoByHeight() method is not available in React Native"); |
| 41 | +} |
| 42 | + |
| 43 | +export async function getBlockByHeight(_currency: CryptoCurrency, _height: number): Promise<Block> { |
| 44 | + throw new Error("gRPC getBlockByHeight() method is not available in React Native"); |
| 45 | +} |
| 46 | + |
| 47 | +export async function getOperations( |
| 48 | + _currency: CryptoCurrency, |
| 49 | + _address: string, |
| 50 | + _options: ListOperationsOptions, |
| 51 | +): Promise<Page<Operation>> { |
| 52 | + throw new Error("gRPC getOperations() method is not available in React Native"); |
| 53 | +} |
0 commit comments