Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
1ac7e3f
feat: add external wallet signing for channel funding
joii2020 Feb 3, 2026
30f310f
Add signer interface with fiber-wasm
joii2020 Feb 4, 2026
c644398
open_channel_with_external_funding returns the final version (tx)
joii2020 Feb 9, 2026
7fdeb6c
wasm support open_channel_with_external_funding
joii2020 Feb 9, 2026
0c4ab99
Fix CI
joii2020 Feb 9, 2026
1bec86a
Update js dependencies
joii2020 Feb 10, 2026
d38e129
Add a timeout mechanism for fiber-external-funding.
joii2020 Feb 12, 2026
ac7a29a
Fix Error
joii2020 Feb 12, 2026
906ce6e
refactor: extract shared logic from FundingTxBuilder and ExternalFund…
joii2020 Feb 12, 2026
ca06ee8
docs: annotate independent bug fixes mixed into external funding changes
joii2020 Feb 12, 2026
3f8e55c
fix: replace assert! with error return in is_tx_final for UDT data le…
joii2020 Feb 12, 2026
b2310c2
docs: add explanation comment for normalize_dep_type workaround
joii2020 Feb 12, 2026
b02b91f
fix: restore trailing newline in fiber-js/package.json
joii2020 Feb 12, 2026
ac1f4bb
Fix reestablish test flakiness and duplicate invoice settlement
joii2020 Feb 14, 2026
1113c6f
fix(fiber): avoid persisting external funding pre-submit state
joii2020 Feb 14, 2026
fc47354
rpc: use channel_id for external funding open result
joii2020 Feb 14, 2026
82eeb64
Update wasm deps
joii2020 Feb 24, 2026
2ce6a24
test(e2e): add external-funding-open success flow and docs
joii2020 Feb 27, 2026
929900a
Fix external funding tx negotiation flow
joii2020 Mar 2, 2026
166290f
Fix e2e test: external_funding
joii2020 Mar 3, 2026
2d0067b
Fix CI: revret tests/bruno/environments
joii2020 Mar 3, 2026
cb0c8e6
Optimize doc: fiber-js
joii2020 Mar 3, 2026
7e8932b
Reset invalid changes to load wasm in fiber-js
joii2020 Mar 3, 2026
c2dc2e4
Reset fiber-js build command
joii2020 Mar 3, 2026
d12eb69
refactor(wasm): handle dep_type normalization at serde layer
joii2020 Mar 3, 2026
e8e6814
test: add boundary case tests for optional ckbSecretKey parameter
joii2020 Mar 3, 2026
a1e2402
Update fiber-js package (jest)
joii2020 Mar 3, 2026
4ca226f
Revert several bugs unrelated to the current PR
joii2020 Mar 3, 2026
5f04d92
refactor: reuse json_dep_type for DepType serde in RPC
joii2020 Mar 3, 2026
fa389ef
fix(channel): replace assert! with error return for UDT data length c…
joii2020 Mar 3, 2026
5ab18ba
fix(channel): restore missing revocation send nonce on reestablish
joii2020 Mar 3, 2026
42490b2
fix(network): on-the-fly channel reestablish on message arrival
joii2020 Mar 3, 2026
1b57d10
Fix error when rebase
joii2020 Mar 4, 2026
9026f4c
Fix Error on wasm-test
joii2020 Mar 4, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/fiber-lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ jsonrpsee = { version = "0.25.1", features = [

[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
wasm-bindgen-test = "0.3.50"
wasm-bindgen-futures = "0.4.50"

[lints.clippy]
expect-fun-call = "allow"
Expand Down
35 changes: 34 additions & 1 deletion crates/fiber-lib/src/ckb/actor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use serde::{Deserialize, Serialize};
use serde_with::serde_as;

use super::{
funding::{FundingContext, LiveCellsExclusionMap},
funding::{ExternalFundingContext, FundingContext, LiveCellsExclusionMap},
signer::LocalSigner,
tx_tracing_actor::{
CkbTxTracer, CkbTxTracingActor, CkbTxTracingArguments, CkbTxTracingMessage,
Expand Down Expand Up @@ -46,6 +46,16 @@ pub enum CkbChainMessage {
FundingRequest,
RpcReplyPort<Result<FundingTx, FundingError>>,
),
/// Build an unsigned funding transaction for external signing.
/// The user will sign this transaction with their own wallet.
BuildUnsignedFundingTx {
funding_tx: FundingTx,
request: FundingRequest,
funding_source_lock_script: packed::Script,
funding_source_lock_script_cell_deps: Vec<packed::CellDep>,
funding_cell_lock_script: packed::Script,
reply: RpcReplyPort<Result<FundingTx, FundingError>>,
},
VerifyFundingTx {
local_tx: packed::Transaction,
remote_tx: packed::Transaction,
Expand Down Expand Up @@ -132,6 +142,29 @@ impl Actor for CkbChainActor {
};
let _ = reply_port.send(result);
}
CkbChainMessage::BuildUnsignedFundingTx {
funding_tx,
request,
funding_source_lock_script,
funding_source_lock_script_cell_deps,
funding_cell_lock_script,
reply,
} => {
let context = ExternalFundingContext {
rpc_url: state.config.rpc_url.clone(),
funding_source_lock_script,
funding_source_lock_script_cell_deps,
funding_cell_lock_script,
};
let result = funding_tx
.build_unsigned_for_external_funding(
request,
context,
&mut state.live_cells_exclusion_map,
)
.await;
let _ = reply.send(result);
}
CkbChainMessage::VerifyFundingTx {
local_tx,
remote_tx,
Expand Down
38 changes: 35 additions & 3 deletions crates/fiber-lib/src/ckb/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,8 @@ serde_with::serde_conv!(
);

serde_with::serde_conv!(
DepTypeWrapper,
/// Wrapper for DepType serialization that supports both `dep_group` and `depGroup` formats.
pub DepTypeWrapper,
DepType,
|s: &DepType| -> String {
let v = match s {
Expand All @@ -209,15 +210,46 @@ serde_with::serde_conv!(
v.to_string()
},
|s: String| {
// Support both snake_case (dep_group) and camelCase (depGroup) from JS libraries
let v = match s.to_lowercase().as_str() {
"code" => DepType::Code,
"dep_group" => DepType::DepGroup,
_ => return Err("invalid hash type"),
"dep_group" | "depgroup" => DepType::DepGroup,
_ => return Err("invalid dep type"),
};
Ok(v)
}
);

/// Wrapper for ckb_jsonrpc_types::DepType that supports both `dep_group` and `depGroup` formats.
/// This is used for RPC serialization compatibility with JS libraries like Lumos.
pub mod json_dep_type {
use ckb_jsonrpc_types::DepType;
use serde::{Deserialize, Deserializer, Serialize, Serializer};

pub fn serialize<S>(dep_type: &DepType, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
{
let s = match dep_type {
DepType::Code => "code",
DepType::DepGroup => "dep_group",
};
s.serialize(serializer)
}

pub fn deserialize<'de, D>(deserializer: D) -> Result<DepType, D::Error>
where
D: Deserializer<'de>,
{
let s = String::deserialize(deserializer)?;
match s.to_lowercase().as_str() {
"code" => Ok(DepType::Code),
"dep_group" | "depgroup" => Ok(DepType::DepGroup),
_ => Err(serde::de::Error::custom("invalid dep type")),
}
}
}

#[serde_as]
#[derive(Serialize, Deserialize, Debug, Clone, Default, Eq, PartialEq, Hash)]
pub struct UdtScript {
Expand Down
Loading
Loading