New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create JS/Kotlin/etc. bindings for bitcoin_client_rs #111
Comments
I did some experiments in trying to create JS bindings with === I did manage to use the transport object from JS code(from === A limitation of #[wasm_bindgen]
pub struct BitcoinClientJS {
client: BitcoinClient<Transport>,
} I tried to import a transport object from JS and implement the #[wasm_bindgen]
extern "C" {
pub type TransportJS;
#[wasm_bindgen(method)]
pub async fn send(this: &TransportJS, cla: u8, ins: u8, p1: u8, p2: u8, data: &[u8])
-> JsValue;
}
#[async_trait]
impl Transport for TransportJS {
type Error = Box<dyn Error>;
async fn exchange(&self, command: &APDUCommand) -> Result<(StatusWord, Vec<u8>), Self::Error> {
todo!()
}
} That should be possible as per the initial experiment above, but I couldn't make it work; apart from some painful limitations of
I don't know how to fix this; attempts to wrap things in === A second attempt to avoid having to call JS code from Rust world initially seemed promising, but the existing implementation of the Transport class depend on the
|
I found this: |
Thanks @edouardparis, I didn't manage even in that way, either − but it's a useful reference for this issue. |
It would be very useful to create bindings from the rust library to various targets that developers need - especially JS and JVM-based.
The text was updated successfully, but these errors were encountered: