File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -1368,6 +1368,17 @@ pub fn sign_coin_spends(
13681368 sig. to_js ( )
13691369}
13701370
1371+ #[ napi]
1372+ pub fn hex_spend_bundle_to_coin_spends ( hex : String ) -> napi:: Result < Vec < CoinSpend > > {
1373+ let bytes = hex:: decode ( hex) . map_err ( js:: err) ?;
1374+ let spend_bundle = RustSpendBundle :: from_bytes ( & bytes) . map_err ( js:: err) ?;
1375+ spend_bundle
1376+ . coin_spends
1377+ . into_iter ( )
1378+ . map ( |cs| cs. to_js ( ) )
1379+ . collect :: < Result < Vec < CoinSpend > > > ( )
1380+ }
1381+
13711382#[ napi]
13721383/// Computes the ID (name) of a coin.
13731384///
@@ -1615,5 +1626,5 @@ pub fn simulator_new_program(pk: Buffer) -> napi::Result<Buffer> {
16151626 let pk = RustPublicKey :: from_js ( pk) ?;
16161627 let program =
16171628 to_program ( [ AggSigMe :: new ( pk, b"Hello, world!" . to_vec ( ) . into ( ) ) ] ) . map_err ( js:: err) ?;
1618- Ok ( program. to_js ( ) ? )
1629+ program. to_js ( )
16191630}
You can’t perform that action at this time.
0 commit comments