Skip to content

FFI callback traits force non async #1389

@xstoicunicornx

Description

@xstoicunicornx

Which crate is this feature request for (if any)?

payjoin-ffi

Question

Hey there,

As part of my BOSS 2026 project I am working on proving out the Javascript FFI bindings. My first step has been building out a plain node project that essentially recreates the payjoin-cli functionality just to get a feel for the bindings api (all this bindings stuff is totally foreign to me).

My question is in regards to the callback method within the CanBroadcast trait here:

pub trait CanBroadcast: Send + Sync {
fn callback(&self, tx: Vec<u8>) -> Result<bool, ForeignError>;
}

When the bindings are generated in javascript it is forcing a non async function to be used as the callback. Is it realistic to expect this to be a non async function in javascript?

My current implementation was planning to call the bitcoin-cli testmempoolaccept to implement the callback method but I do not know of a non async way of doing this. Was there better recommended way of implementing callback?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions