Skip to content

Commit a4ec6d0

Browse files
committed
fix hyperclient
1 parent 057cd8d commit a4ec6d0

File tree

5 files changed

+17
-3
lines changed

5 files changed

+17
-3
lines changed

Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,9 @@ install-updater = false
113113
inherits = "release"
114114
lto = "thin"
115115

116+
[profile.release]
117+
strip = true
118+
116119
[workspace.dependencies]
117120
polkadot-sdk = { version = "0.9.0", default-features = false }
118121

modules/hyperclient/hyperclient.d.ts

+2
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ export interface IHyperbridgeConfig {
5959
rpc_url: string;
6060
// state machine identifier as a string
6161
state_machine: string;
62+
// consensus state identifier of hyperbridge on the destination chain
63+
consensus_state_id: string;
6264
}
6365

6466
export interface IPostRequest {

modules/hyperclient/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@polytope-labs/hyperclient",
33
"description": "The hyperclient is a library for managing (in-flight) ISMP requests",
4-
"version": "1.1.0",
4+
"version": "1.2.0",
55
"author": "Polytope Labs (hello@polytope.technology)",
66
"license": "Apache-2.0",
77
"bugs": {

modules/hyperclient/src/interfaces.rs

+10-1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ pub struct JsSubstrateConfig {
5151
pub struct JsHyperbridgeConfig {
5252
pub state_machine: String,
5353
pub rpc_url: String,
54+
pub consensus_state_id: String,
5455
}
5556

5657
#[derive(Clone, Eq, PartialEq, Debug, Deserialize, Serialize)]
@@ -138,7 +139,14 @@ impl TryFrom<JsClientConfig> for ClientConfig {
138139
let conf = SubstrateConfig {
139140
rpc_url: val.rpc_url.clone(),
140141
state_machine,
141-
consensus_state_id: [0u8; 4],
142+
consensus_state_id: {
143+
if val.consensus_state_id.len() != 4 {
144+
Err(anyhow!("Invalid consensus state id: {:?}", val.consensus_state_id))?
145+
}
146+
let mut dest = [0u8; 4];
147+
dest.copy_from_slice(&val.consensus_state_id.as_bytes());
148+
dest
149+
},
142150
hash_algo: HashAlgorithm::Keccak,
143151
};
144152

@@ -366,6 +374,7 @@ mod tests {
366374

367375
let js_hyperbridge = JsHyperbridgeConfig {
368376
rpc_url: "ws://127.0.0.1:9990".to_string(),
377+
consensus_state_id: "PARA".into(),
369378
state_machine: "KUSAMA-4009".into(),
370379
};
371380

modules/hyperclient/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ impl HyperClient {
9797
let _ = tracing_subscriber::fmt()
9898
.with_max_level(tracing::Level::TRACE)
9999
.with_writer(
100-
// To avoide trace events in the browser from showing their
100+
// To avoid trace events in the browser from showing their
101101
// JS backtrace, which is very annoying, in my opinion
102102
MakeConsoleWriter::default().map_trace_level_to(tracing::Level::INFO),
103103
)

0 commit comments

Comments
 (0)