* initial ts commit * monero.ts improvements * test on latest, build on debian:bookworm * feat: upstream changes to bindings * chore: update checksums * feat: allow manually loading dylib * chore: add readme * fix: free strings after being read to prevent potential memory leaks * fix: load dylib * fix: checksum checks segfaulting because of freeing const variables --------- Co-authored-by: Mateusz Franik <47059999+Im-Beast@users.noreply.github.com> Co-authored-by: Im-Beast <franik.mateusz@gmail.com>
monero.ts
monero_c bindings for Deno.
Usage
This library does not ship with monero_c libraries.
To use these bindings you have to bring your own monero_c libraries.
There are at least two ways to do so:
- Ahead-of-time, during builds where you only ship necessary library for a given platform.
See monero-tui build workflow as an example of doing so.import { loadDylib, Wallet, WalletManager } from "https://raw.githubusercontent.com/MrCyjaneK/monero_c/master/impls/monero.ts/mod.ts"; // Try to load dylib from the default lib/* path loadDylib(); const wm = await WalletManager.new(); const wallet = await Wallet.create(wm, "./my_wallet", "password"); console.log(await wallet.address()); await wallet.store(); - Just-in-time, where you download and cache the library at runtime.
You can use something like plug to achieve the result.import { dlopen } from "jsr:@denosaurs/plug"; // It's recommened to put the monero.ts github link into your import_map to reduce the url clutter import { loadDylib, symbols, Wallet, WalletManager } from "https://raw.githubusercontent.com/MrCyjaneK/monero_c/master/impls/monero.ts/mod.ts"; // Load dylib loaded by plug const lib = await dlopen(..., symbols); loadDylib(lib); const wm = await WalletManager.new(); const wallet = await Wallet.create(wm, "./my_wallet", "password"); console.log(await wallet.address()); await wallet.store();