File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change 1
1
use crate :: byron:: utils:: ProtocolMagic ;
2
2
use cml_core_wasm:: impl_wasm_conversions;
3
3
use wasm_bindgen:: prelude:: wasm_bindgen;
4
+ use cml_crypto_wasm:: TransactionHash ;
4
5
5
6
#[ wasm_bindgen]
6
7
pub struct NetworkInfo ( cml_chain:: genesis:: network_info:: NetworkInfo ) ;
@@ -43,3 +44,36 @@ impl NetworkInfo {
43
44
cml_chain:: genesis:: network_info:: NetworkInfo :: sancho_testnet ( ) . into ( )
44
45
}
45
46
}
47
+
48
+ #[ wasm_bindgen]
49
+ pub struct ByronGenesisRedeem ( pub ( crate ) ( cml_crypto:: TransactionHash , cml_chain:: byron:: ByronAddress ) ) ;
50
+
51
+ #[ wasm_bindgen]
52
+ impl ByronGenesisRedeem {
53
+ pub fn new ( txid : & TransactionHash , address : & crate :: byron:: ByronAddress ) -> Self {
54
+ ByronGenesisRedeem ( ( txid. clone ( ) . into ( ) , address. clone ( ) . into ( ) ) )
55
+ }
56
+
57
+ pub fn txid ( & self ) -> TransactionHash {
58
+ self . 0 . 0 . into ( )
59
+ }
60
+
61
+ pub fn address ( & self ) -> crate :: byron:: ByronAddress {
62
+ self . 0 . 1 . clone ( ) . into ( )
63
+ }
64
+ }
65
+
66
+
67
+ #[ wasm_bindgen]
68
+ pub fn genesis_txid_byron ( pubkey : & cml_crypto_wasm:: PublicKey , protocol_magic : Option < u32 > ) -> ByronGenesisRedeem {
69
+ let redeem = cml_chain:: genesis:: byron:: parse:: redeem_pubkey_to_txid (
70
+ & pubkey. clone ( ) . as_ref ( ) . 0 ,
71
+ protocol_magic. map ( |pm| ProtocolMagic :: new ( pm) . into ( ) )
72
+ ) ;
73
+ ByronGenesisRedeem ( redeem)
74
+ }
75
+
76
+ #[ wasm_bindgen]
77
+ pub fn genesis_txid_shelley ( address : & crate :: address:: Address ) -> TransactionHash {
78
+ TransactionHash :: from ( cml_chain:: genesis:: shelley:: parse:: redeem_address_to_txid ( & address. clone ( ) . into ( ) ) )
79
+ }
You can’t perform that action at this time.
0 commit comments