-
Notifications
You must be signed in to change notification settings - Fork 79
Description
One of the limitations of WASM is persistence, in bdk-wasm changeset we opted to add to_json and from_json methods to the wallet changeset so that the rust code can interface with the js code using a simple json string and the js code can handle persistence.
@0xBEEFCAF3 and I have been discussing whether it makes sense to add these methods in the rust-payjoin crate (using serde_json) or if it makes more sense to do that at the bindings level (like in bdk-wasm, can do just for wasm specific builds if that's the only use case).
Something to consider is that using these methods would put you in a non-persisted assumption for the rust code, but persistence would in fact be happening (if implemented properly) so that may be a third logic path potentially.
My understanding based off what @0xBEEFCAF3 has told me so far is that currently the sender and receiver objects take a persister object. for this to work in wasm we would need to build a compatible persister in js that could be fed into rust context. That's possible but would probably involve pre-packaging the payjoin-wasm node module with a persister object. Since all we need to do on the js end is save/load a complete state object it's easier and simpler to just pass json string (as we opted for in bdk-wasm) so I expect that's a better way to go.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status