Files
monero_c/impls/monero.ts
renovate[bot] 3e63391d90 chore(deps): update zano digest to fbeb658 (#123)
* chore(deps): update zano digest to fbeb658

* fix zano patches

* update checksum

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: cyan <cyjan@mrcyjanek.net>
2025-03-07 12:23:52 +01:00
..
2025-01-16 09:37:11 +01:00
2024-09-19 10:59:07 +02:00
2025-01-15 14:04:42 +01:00
2024-09-19 10:59:07 +02:00

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 {
      loadMoneroDylib,
      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
    // You can also use loadWowneroDylib for Wownero
    loadMoneroDylib();
    
    const wm = await WalletManager.new();
    const wallet = await wm.createWallet("./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 { loadMoneroDylib, 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);
    loadMoneroDylib(lib);
    
    const wm = await WalletManager.new();
    const wallet = await wm.createWallet("./my_wallet", "password");
    
    console.log(await wallet.address());
    
    await wallet.store();