Skip to content

Commit e3628db

Browse files
committed
chore: move concordium grpc overrides to coin-module level
1 parent 8ed67e5 commit e3628db

File tree

4 files changed

+61
-29
lines changed

4 files changed

+61
-29
lines changed

.changeset/shy-terms-double.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@ledgerhq/live-common": minor
3+
"@ledgerhq/coin-concordium": minor
4+
---
5+
6+
Move Concordium gRPC React Native overrides to coin-concordium level

libs/coin-modules/coin-concordium/.unimportedrc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
"src/test/fixtures.ts",
2525
"src/test/testHelpers.ts",
2626
"src/test/walletConnectFixtures.ts",
27-
"src/types/errors.ts"
27+
"src/types/errors.ts",
28+
"src/network/grpcClient.native.ts"
2829
],
2930
"ignoreUnused": []
3031
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
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+
}

libs/ledger-live-common/src/families/concordium/setup.native.ts

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)