0.1.1 • Published 1 year ago

tlalocman-bdk-wasm v0.1.1

Weekly downloads
-
License
-
Repository
-
Last release
1 year ago

Rust WebAssembly utils

This project contains various utility functions written in Rust and compiled to WebAssembly (WASM) for use in web applications.

Contents

The following functions are currently included in this project:

  • add(a: i32, b: i32) -> i32: Adds two numbers and returns the result

  • from_miniscript_policy(miniscript: String) -> Option: Parses a miniscript string and returns a Bitcoin Script descriptor string

  • print_to_console(msg: &str): Sends a message string to the console

Usage

To use these functions in your web application, first import the corresponding .wasm file and the JavaScript wrapper file into your JavaScript module:

import init, { add, from_miniscript_policy, print_to_console } from 'tlalocman-wasm-utils';

Then, call the appropriate function and pass in any required parameters:

console.log(add(2, 3)); // Outputs: 5

console.log(from_miniscript_policy("pk(...)".to_string())); // Outputs: desc(pk(...))

print_to_console("Hello, world!"); // Outputs: Mensaje recibido: Hello, world!

Please note that when calling from_miniscript_policy, the function may return None if the input parameter is invalid or cannot be parsed.

0.1.1

1 year ago

0.1.0

1 year ago