Skip to content

withObsrvr/rs-stellar-history-archive-hasher

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

stellar-history-archive-hasher

WASM library for hashing Stellar transaction history archive entries. Provides functions to hash TransactionHistoryEntry and TransactionHistoryResultEntry XDR data.

Install

npm:

npm install @withobsrvr/stellar-history-archive-hasher

Cargo:

cargo add stellar-history-archive-hasher

Usage

Node.js (CommonJS)

const {
  hash_transaction_history_entry,
  hash_transaction_history_result_entry
} = require('@withobsrvr/stellar-history-archive-hasher');

const xdrBytes = new Uint8Array(Buffer.from(base64String, 'base64'));
const hash = hash_transaction_history_entry(xdrBytes);

Rust

use stellar_history_archive_hasher::internal::{
    hash_transaction_history_entry,
    hash_transaction_history_result_entry,
};

let hash = hash_transaction_history_entry(&xdr_bytes).unwrap();

Build

Prerequisites

Build for Node.js (CommonJS)

wasm-pack build --target nodejs --scope withobsrvr

Build for bundlers (ES modules)

wasm-pack build --target bundler --scope withobsrvr

Output goes to the pkg/ directory.

Test

# Rust unit tests
cargo test

# Manual smoke test (requires Node.js build)
node index.js

Upgrade dependencies

rustup update
cargo update

Publish

# npm (requires npm login to @withobsrvr org)
wasm-pack build --target nodejs --scope withobsrvr
wasm-pack publish --access public

# crates.io
cargo publish

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Rust 73.4%
  • Nix 16.3%
  • JavaScript 10.2%
  • Shell 0.1%