Files
monero_c/impls/monero.ts
cyan 1d8e0fb30b ledger changes (#41)
* ledger changes
* minor fix
* Implement monero queryWalletDevice
* update checksums
* Remove ledger_flutter_plus dependency
---------

Co-authored-by: Konstantin Ullrich <konstantinullrich12@gmail.com>
2024-10-21 12:54:58 +02:00
..
2024-09-19 10:59:07 +02:00
2024-10-21 12:54:58 +02:00
2024-09-19 10:59:07 +02: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 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 { 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 Wallet.create(wm, "./my_wallet", "password");
    
    console.log(await wallet.address());
    
    await wallet.store();