ergoplatform / ergo-lib-wasm

ergo-lib bindings for JS/TS
Creative Commons Zero v1.0 Universal
4 stars 3 forks source link

Lifting `JsValue` into rust structs is broken #36

Closed ross-weir closed 1 year ago

ross-weir commented 1 year ago

This was working a few months ago but is now broken with no changes to the codebase. Something in a upstream package might have changed.

Something about this line appears to have changed: https://github.com/ergoplatform/ergo-lib-wasm/blob/6cad90e46d685a921d9124f09ebeeafbf172486e/packages/ergo-lib-wasm/src/ir/constants.rs#L700

try_into should be our implementation so maybe to_owned impl changed? Or Deref?

https://github.com/ergoplatform/ergo-lib-wasm/actions/runs/4988260730/jobs/8930811270?pr=35

Edit:

This is where it's breaking: https://github.com/ergoplatform/ergo-lib-wasm/blob/6cad90e46d685a921d9124f09ebeeafbf172486e/packages/ergo-wasm-derive/src/lib.rs#L250-L251

ross-weir commented 1 year ago

The fix for nodejs is changing this line to use "__wbg_ptr" instead of "ptr", need to check if this is nodejs specific

https://github.com/ergoplatform/ergo-lib-wasm/blob/6cad90e46d685a921d9124f09ebeeafbf172486e/packages/ergo-wasm-derive/src/lib.rs#L248-L249

Edit: not nodejs specific, applies to all envs