Skip to content
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

JS SDK #72

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft

JS SDK #72

wants to merge 7 commits into from

Conversation

n8maninger
Copy link
Member

@n8maninger n8maninger commented Dec 3, 2024

Draft of a potential JS sdk in Rust. There's a lot not to like in here, but there may be some things that are okay. As far as I can tell there is no easy way to unify the browser and nodejs packages in Rust.

// create a transaction
const txn = new Transaction();
txn.siacoinOutputs.push({ "address": "...", "value": 100n });

// load a transaction from JSON
const txn = new Transaction(await getTransaction(id));

Copy link
Member

@ChrisSchinnerl ChrisSchinnerl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall this looks pretty good to me. I'll leave it to devs more experience in JS to determine whether this feels 'native' though :P


[features]
default = []
test_in_browser = []
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this. Doesn't seem very nice to require our lib to expose a feature just for testing. Maybe we can get away with using the WASM_BINDGEN_USE_BROWSER environment variable somehow?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤷🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants