diff options
| author | Konstantin Ullrich <konstantinullrich12@gmail.com> | 2024-10-07 12:37:30 +0200 |
|---|---|---|
| committer | Konstantin Ullrich <konstantinullrich12@gmail.com> | 2024-10-07 12:37:30 +0200 |
| commit | 98272ee381bd07081502dd426226f58c879300a6 (patch) | |
| tree | 672f6f06727dbc1c84270973ce13e9403913e481 /impls/monero.ts/README.md | |
| parent | 04b29d84a2c368c677cf5ec946269203622ca170 (diff) | |
| parent | 67f4baa015a4407d096e35b6e5a81d72932fb55f (diff) | |
Merge branch 'master' into ledger
# Conflicts:
# .github/workflows/full_check.yaml
# impls/monero.dart/lib/monero.dart
# impls/monero.dart/pubspec.yaml
# patches/monero/0016-add-dummy-device-for-ledger.patch
Diffstat (limited to 'impls/monero.ts/README.md')
| -rw-r--r-- | impls/monero.ts/README.md | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/impls/monero.ts/README.md b/impls/monero.ts/README.md new file mode 100644 index 0000000..e3b20f6 --- /dev/null +++ b/impls/monero.ts/README.md @@ -0,0 +1,42 @@ +# 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](https://github.com/Im-Beast/monero-tui/blob/main/.github/workflows/dev-build.yml) build workflow as an example of doing so. + ```ts + 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](https://jsr.io/@denosaurs/plug) to achieve the result. + ```ts + 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(); + ``` |
