Skip to content

Commit 5b874d5

Browse files
committed
fix: 273 errors in WASM build remaining 33
Signed-off-by: gsstoykov <[email protected]>
1 parent d875381 commit 5b874d5

File tree

149 files changed

+1363
-624
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

149 files changed

+1363
-624
lines changed

Cargo.lock

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,8 @@ backoff = "0.4.0"
2525
ed25519-dalek = { version = "2.2.0", features = ["rand_core"] }
2626
fraction = { version = "0.15.1", default-features = false }
2727
futures-core = "0.3.31"
28-
# Transitive dependency of tonic 0.12
29-
h2 = "0.4.12"
30-
hedera-proto = { path = "./protobufs", version = "0.19.0", features = ["time_0_3", "fraction"] }
3128
hex = "0.4.3"
3229
hmac = "0.12.1"
33-
# Dependency of tonic 0.12
34-
hyper = { version = "1.6", default-features = false }
3530
log = "0.4.28"
3631
num-bigint = "0.4.3"
3732
once_cell = "1.21.3"
@@ -41,8 +36,6 @@ sha2 = "0.10.9"
4136
sha3 = "0.10.2"
4237
thiserror = "2.0.15"
4338
time = "0.3.43"
44-
tokio = { version = "1.47.0", features = ["time"] }
45-
tonic = "0.12.3"
4639
tinystr = { version = "0.7.0", default-features = false }
4740
arc-swap = "1.6.0"
4841
rlp = "0.6.1"
@@ -58,10 +51,6 @@ cbc = "0.1.2"
5851
aes = "0.8.3"
5952
md5 = "0.8.0"
6053
sec1 = { version = "0.7.3", features = ["der"] }
61-
tower = { version = "0.5.2", features = ["util"] }
62-
openssl = "0.10.72"
63-
hyper-util = "0.1.16"
64-
hyper-openssl = {version = "0.10.2", features = ["client-legacy"]}
6554

6655
[dependencies.futures-util]
6756
version = "0.3.31"
@@ -92,6 +81,26 @@ version = "0.1.14"
9281
default-features = false
9382
features = ["std", "arc-swap", "unsize"]
9483

84+
# Native-only dependencies (networking)
85+
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
86+
hedera-proto = { path = "./protobufs", version = "0.19.0", features = ["time_0_3", "fraction"] }
87+
tonic = "0.12.3"
88+
tokio = { version = "1.47.0", features = ["time"] }
89+
h2 = "0.4.12"
90+
hyper = { version = "1.6", default-features = false }
91+
tower = { version = "0.5.2", features = ["util"] }
92+
openssl = "0.10.72"
93+
hyper-util = "0.1.16"
94+
hyper-openssl = {version = "0.10.2", features = ["client-legacy"]}
95+
96+
# WASM-only dependencies (no networking)
97+
[target.'cfg(target_arch = "wasm32")'.dependencies]
98+
hedera-proto-wasm = { path = "./hedera-proto-wasm" }
99+
wasm-bindgen = "0.2"
100+
js-sys = "0.3"
101+
web-sys = { version = "0.3", features = ["console"] }
102+
getrandom = { version = "0.2", features = ["js"] }
103+
95104
[dev-dependencies]
96105
anyhow = "1.0.99"
97106
assert_matches = "1.5.0"

src/account/account_allowance_approve_transaction.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// SPDX-License-Identifier: Apache-2.0
22

3-
use hedera_proto::services;
4-
use services::crypto_service_client::CryptoServiceClient;
5-
use tonic::transport::Channel;
3+
use crate::proto::services;
4+
#[cfg(not(target_arch = "wasm32"))]
5+
use crate::proto::services::crypto_service_client::CryptoServiceClient;
66

77
use crate::ledger_id::RefLedgerId;
88
use crate::protobuf::FromProtobuf;
@@ -12,11 +12,11 @@ use crate::transaction::{
1212
ToSchedulableTransactionDataProtobuf,
1313
ToTransactionDataProtobuf,
1414
TransactionData,
15-
TransactionExecute,
1615
};
16+
#[cfg(not(target_arch = "wasm32"))]
17+
use crate::transaction::TransactionExecute;
1718
use crate::{
1819
AccountId,
19-
BoxGrpcFuture,
2020
Error,
2121
Hbar,
2222
NftId,
@@ -204,12 +204,13 @@ pub struct NftAllowance {
204204

205205
impl TransactionData for AccountAllowanceApproveTransactionData {}
206206

207+
#[cfg(not(target_arch = "wasm32"))]
207208
impl TransactionExecute for AccountAllowanceApproveTransactionData {
208209
fn execute(
209210
&self,
210-
channel: Channel,
211+
channel: services::Channel,
211212
request: services::Transaction,
212-
) -> BoxGrpcFuture<'_, services::TransactionResponse> {
213+
) -> crate::BoxGrpcFuture<'_, services::TransactionResponse> {
213214
Box::pin(async { CryptoServiceClient::new(channel).approve_allowances(request).await })
214215
}
215216
}

src/account/account_allowance_delete_transaction.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// SPDX-License-Identifier: Apache-2.0
22

3-
use hedera_proto::services;
4-
use hedera_proto::services::crypto_service_client::CryptoServiceClient;
5-
use tonic::transport::Channel;
3+
use crate::proto::services;
4+
#[cfg(not(target_arch = "wasm32"))]
5+
use crate::proto::services::crypto_service_client::CryptoServiceClient;
66

77
use crate::ledger_id::RefLedgerId;
88
use crate::protobuf::{
@@ -15,11 +15,11 @@ use crate::transaction::{
1515
ToSchedulableTransactionDataProtobuf,
1616
ToTransactionDataProtobuf,
1717
TransactionData,
18-
TransactionExecute,
1918
};
19+
#[cfg(not(target_arch = "wasm32"))]
20+
use crate::transaction::TransactionExecute;
2021
use crate::{
2122
AccountId,
22-
BoxGrpcFuture,
2323
Error,
2424
NftId,
2525
TokenId,
@@ -84,12 +84,13 @@ impl AccountAllowanceDeleteTransaction {
8484

8585
impl TransactionData for AccountAllowanceDeleteTransactionData {}
8686

87+
#[cfg(not(target_arch = "wasm32"))]
8788
impl TransactionExecute for AccountAllowanceDeleteTransactionData {
8889
fn execute(
8990
&self,
90-
channel: Channel,
91+
channel: services::Channel,
9192
request: services::Transaction,
92-
) -> BoxGrpcFuture<'_, services::TransactionResponse> {
93+
) -> services::BoxGrpcFuture<'_, services::TransactionResponse> {
9394
Box::pin(async { CryptoServiceClient::new(channel).delete_allowances(request).await })
9495
}
9596
}
@@ -123,6 +124,7 @@ impl ToSchedulableTransactionDataProtobuf for AccountAllowanceDeleteTransactionD
123124
}
124125
}
125126

127+
#[cfg(not(target_arch = "wasm32"))]
126128
impl From<AccountAllowanceDeleteTransactionData> for AnyTransactionData {
127129
fn from(transaction: AccountAllowanceDeleteTransactionData) -> Self {
128130
Self::AccountAllowanceDelete(transaction)

src/account/account_balance.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
use std::collections::HashMap;
44

5-
use hedera_proto::services;
5+
use crate::proto::services;
66
use prost::Message;
77

88
use crate::protobuf::ToProtobuf;

src/account/account_balance_query.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
// SPDX-License-Identifier: Apache-2.0
22

3-
use hedera_proto::services;
4-
use hedera_proto::services::crypto_service_client::CryptoServiceClient;
5-
use services::crypto_get_account_balance_query::BalanceSource;
6-
use tonic::transport::Channel;
3+
use crate::proto::services;
4+
#[cfg(not(target_arch = "wasm32"))]
5+
use crate::proto::services::crypto_service_client::CryptoServiceClient;
6+
#[cfg(not(target_arch = "wasm32"))]
7+
use crate::proto::services::crypto_get_account_balance_query::BalanceSource;
78

89
use crate::ledger_id::RefLedgerId;
910
use crate::query::{
@@ -15,7 +16,6 @@ use crate::query::{
1516
use crate::{
1617
AccountBalance,
1718
AccountId,
18-
BoxGrpcFuture,
1919
ContractId,
2020
Error,
2121
ToProtobuf,
@@ -107,6 +107,7 @@ impl ToQueryProtobuf for AccountBalanceQueryData {
107107
}
108108
}
109109

110+
#[cfg(not(target_arch = "wasm32"))]
110111
impl QueryExecute for AccountBalanceQueryData {
111112
type Response = AccountBalance;
112113

@@ -116,9 +117,9 @@ impl QueryExecute for AccountBalanceQueryData {
116117

117118
fn execute(
118119
&self,
119-
channel: Channel,
120+
channel: services::Channel,
120121
request: services::Query,
121-
) -> BoxGrpcFuture<'_, services::Response> {
122+
) -> services::BoxGrpcFuture<'_, services::Response> {
122123
Box::pin(async { CryptoServiceClient::new(channel).crypto_get_balance(request).await })
123124
}
124125
}

src/account/account_create_transaction.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// SPDX-License-Identifier: Apache-2.0
22

3-
use hedera_proto::services;
4-
use hedera_proto::services::crypto_service_client::CryptoServiceClient;
3+
use crate::proto::services;
4+
#[cfg(not(target_arch = "wasm32"))]
5+
use crate::proto::services::crypto_service_client::CryptoServiceClient;
56
use time::Duration;
6-
use tonic::transport::Channel;
77

88
use crate::ledger_id::RefLedgerId;
99
use crate::protobuf::{
@@ -17,11 +17,11 @@ use crate::transaction::{
1717
ToSchedulableTransactionDataProtobuf,
1818
ToTransactionDataProtobuf,
1919
TransactionData,
20-
TransactionExecute,
2120
};
21+
#[cfg(not(target_arch = "wasm32"))]
22+
use crate::transaction::TransactionExecute;
2223
use crate::{
2324
AccountId,
24-
BoxGrpcFuture,
2525
Error,
2626
EvmAddress,
2727
Hbar,
@@ -297,12 +297,13 @@ impl AccountCreateTransaction {
297297

298298
impl TransactionData for AccountCreateTransactionData {}
299299

300+
#[cfg(not(target_arch = "wasm32"))]
300301
impl TransactionExecute for AccountCreateTransactionData {
301302
fn execute(
302303
&self,
303-
channel: Channel,
304+
channel: services::Channel,
304305
request: services::Transaction,
305-
) -> BoxGrpcFuture<'_, services::TransactionResponse> {
306+
) -> services::BoxGrpcFuture<'_, services::TransactionResponse> {
306307
Box::pin(async { CryptoServiceClient::new(channel).create_account(request).await })
307308
}
308309
}
@@ -398,7 +399,7 @@ impl ToProtobuf for AccountCreateTransactionData {
398399
#[cfg(test)]
399400
mod tests {
400401
use expect_test::expect;
401-
use hedera_proto::services;
402+
use crate::proto::services;
402403
use hex_literal::hex;
403404
use time::Duration;
404405

src/account/account_delete_transaction.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// SPDX-License-Identifier: Apache-2.0
22

3-
use hedera_proto::services;
4-
use hedera_proto::services::crypto_service_client::CryptoServiceClient;
5-
use tonic::transport::Channel;
3+
use crate::proto::services;
4+
#[cfg(not(target_arch = "wasm32"))]
5+
use crate::proto::services::crypto_service_client::CryptoServiceClient;
66

77
use crate::ledger_id::RefLedgerId;
88
use crate::protobuf::{
@@ -15,11 +15,11 @@ use crate::transaction::{
1515
ToSchedulableTransactionDataProtobuf,
1616
ToTransactionDataProtobuf,
1717
TransactionData,
18-
TransactionExecute,
1918
};
19+
#[cfg(not(target_arch = "wasm32"))]
20+
use crate::transaction::TransactionExecute;
2021
use crate::{
2122
AccountId,
22-
BoxGrpcFuture,
2323
Error,
2424
Transaction,
2525
ValidateChecksums,
@@ -69,12 +69,13 @@ impl AccountDeleteTransaction {
6969

7070
impl TransactionData for AccountDeleteTransactionData {}
7171

72+
#[cfg(not(target_arch = "wasm32"))]
7273
impl TransactionExecute for AccountDeleteTransactionData {
7374
fn execute(
7475
&self,
75-
channel: Channel,
76+
channel: services::Channel,
7677
request: services::Transaction,
77-
) -> BoxGrpcFuture<'_, services::TransactionResponse> {
78+
) -> services::BoxGrpcFuture<'_, services::TransactionResponse> {
7879
Box::pin(async { CryptoServiceClient::new(channel).crypto_delete(request).await })
7980
}
8081
}
@@ -134,7 +135,7 @@ impl ToProtobuf for AccountDeleteTransactionData {
134135
#[cfg(test)]
135136
mod tests {
136137
use expect_test::expect;
137-
use hedera_proto::services;
138+
use crate::proto::services;
138139

139140
use crate::account::AccountDeleteTransactionData;
140141
use crate::protobuf::{

src/account/account_id.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use std::fmt::{
88
};
99
use std::str::FromStr;
1010

11-
use hedera_proto::services;
11+
use crate::proto::services;
1212

1313
use crate::entity_id::{
1414
Checksum,

src/account/account_info.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// SPDX-License-Identifier: Apache-2.0
22

3-
use hedera_proto::services;
3+
use crate::proto::services;
44
use prost::Message;
55
use time::{
66
Duration,

0 commit comments

Comments
 (0)