input-output-hk / js-cardano-wasm

various cardano javascript using wasm bindings
MIT License
31 stars 21 forks source link

wasmgen continued #53

Closed SebastienGllmt closed 5 years ago

SebastienGllmt commented 5 years ago

We're finally moving to webpack 4 on Yoroi and I need to update the wasm bindings to get it working.

I rebased the wallet-wasm2 onto master (since it's way out of date) and then tried to make the wasm generation work but there have been quite a few changes in the rust-cardano library since the wallet-wasm2 change so there's a bunch of compiler errors that need to be fixed.

I'd appreciate help fixing these if you have time 🙏

error[E0624]: method `from_slice` is private
  --> src/lib.rs:59:35
   |
59 |         let xprv = handle_result!(hdwallet::XPrv::from_slice(bytes));
   |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0624]: method `from_slice` is private
  --> src/lib.rs:69:36
   |
69 |         let xprv  = handle_result!(hdwallet::XPrv::from_slice(&bytes));
   |                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0061]: this function takes 2 parameters but 1 parameter was supplied
   --> src/lib.rs:131:21
    |
131 |         let attrs = address::Attributes::new_bootstrap_era(None);
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected 2 parameters

error[E0061]: this function takes 2 parameters but 1 parameter was supplied
   --> src/lib.rs:139:21
    |
139 |         let attrs = address::Attributes::new_bootstrap_era(Some(payload.0.clone()));
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected 2 parameters

error[E0599]: no method named `to_bytes` found for type `cardano::address::ExtendedAddr` in the current scope
   --> src/lib.rs:190:38
    |
190 |         util::base58::encode(&self.0.to_bytes())
    |                                      ^^^^^^^^

error[E0277]: the trait bound `cardano::address::ExtendedAddr: cbor_event::Deserialize` is not satisfied
   --> src/lib.rs:195:74
    |
195 |         let addr  = handle_result!(cbor_event::de::RawCbor::from(&bytes).deserialize());
    |                                                                          ^^^^^^^^^^^ the trait `cbor_event::Deserialize` is not implemented for `cardano::address::ExtendedAddr`

error[E0277]: the trait bound `cardano::address::ExtendedAddr: cbor_event::Deserialize` is not satisfied
   --> src/lib.rs:200:73
    |
200 |         let addr  = handle_result!(cbor_event::de::RawCbor::from(bytes).deserialize());
    |                                                                         ^^^^^^^^^^^ the trait `cbor_event::Deserialize` is not implemented for `cardano::address::ExtendedAddr`

error[E0599]: no method named `is_some` found for type `std::result::Result<cardano::hdpayload::Path, cardano::hdpayload::Error>` in the current scope
   --> src/lib.rs:263:39
    |
263 |             self.key.decrypt_path(dp).is_some()
    |                                       ^^^^^^^
NicolasDP commented 5 years ago

don't use wallet-wasm2, the be new bindgen generated API is in cardano-wallet directory on master branch