open-index/open-npm huggingface dataset:
npm package: @spacemesh/address-wasm
Description: WASM-Implementation of BECH32 address codec
Latest version: 0.2.1

## @spacemesh/address-wasm

[![npm (scoped)](https://img.shields.io/npm/v/@spacemesh/address-wasm.svg)](https://www.npmjs.com/package/@spacemesh/address-wasm)
[![npm bundle size (minified)](https://img.shields.io/bundlephobia/min/@spacemesh/address-wasm.svg)](https://www.npmjs.com/package/@spacemesh/address-wasm)

This package implements BECH32 address encoder and verifier.

To start using the library you need to install it first:
```sh
yarn add @spacemesh/address-wasm
```

And then start using it in your code:
```js
import Bech32 from '@spacemesh/address-wasm'

(async () => {
  // Initialize wasm
  // Init function requires an HRPNetwork string
  // It will be called automatically on calling any of methods
  // in case it was not called before.
  Bech32.init();
  // Then you can setHRPNetwork:
  Bech32.setHRPNetwork('sm');

  // Get some public key
  const publicKey = Uint8Array.from([1, 2, 3, ..., 20]);
  // And generate address from it
  const addr = Bech32.generateAddress(publicKey);
  // You can also verify it
  console.log(Bech32.verify(addr)); // true
  // Then you can change HRP Network
  Bech32.setHRPNetwork('smtest');
  // And now previously generated address becomes invalid,
  // because it refers to different HRP network
  console.log(Bech32.verify(addr)); // false
  // And get byte-representation of the address:
  console.log(Bech32.parse(addr)); // [0, 0, 0, 0, 1, 2, ..., 20]
})();

// You can also call `verify`, `parse`, `generateAddress` methods
// with second argument: HRP. Then it will behave like pure function.
console.log(Bech32.generateAddress(publicKey, 'sm')); // 'sm1q...'
console.log(Bech32.generateAddress(publicKey, 'stest')); // 'stest1q...'
console.log(Bech32.verify(someAddr, 'stest')); // true / false
```

### For contributors

This package contains Wasm implementation in golang, that uses `spacemeshos/address` implementation inside.
Also, package includes Javascript wrapper over Wasm runner, that provides a clean facade for functions.

You will need to install Go (check out version in `go.mod`), NodeJS and yarn.
Then you can just type:
```
make
```

To run different build processes — check out Makefile. For example to build only wasm file you can run
```
make gen-wasm
```
npm package: @spacemesh/sm-codec
Description: Spacemesh Transaction Codec library
Author: Spacemesh
Latest version: 0.9.0-athena.4

## @spacemesh/sm-codec

TypeScript library provides easy way to encode, decode, and sign transactions.

See usage examples below:

```js
// Import
import { SingleSigTemplate, StdMethods } from '@spacemesh/sm-codec';
import { sign } from '@noble/ed25519';

// SingleSig example
(() => {
  // Get method
  const spawnTpl = SingleSigTemplate.methods[StdMethods.Spawn];

  // Prepare SpawnPayload
  const spawnPayload = {
    Nonce: 0n,
    GasPrice: 1n,
    Arguments: {
      PublicKey: Uint8Array.from([/* your public key: 32 bytes */]),
    },
  };
  // Calculate Principal address (of your new account)
  const principal = spawnTpl.principal(spawnPayload.Arguments);
  // Encode SpawnTransaction
  const rawTx = spawnTpl.encode(principal, spawnPayload);
  // Get transaction hash, it is used in signing
  const txHash = hash(rawTx);
  // Then use `ed25519` library to sign the hash with your private key
  const sig = sign(myPrivateKey, txHash);
  // And finally sign tx (actualy it concatenates bytes)
  const signedTx = spawnTpl.sign(rawTx, sig);

  // Note: Principal method exists on any method
  // So this example will work as well:
  SingleSigTemplate.methods[StdMethods.Spend].principal(spawnPayload.Arguments);
})();
  ```

  Example of creating your own template:
  ```js
  import { PublicKey, SingleSig, Codecs } from '@spacemesh/sm-codec';
  import { Struct, str } from 'scale-ts';

  const spawnCodec = Struct({
    Owner: PublicKey,
  });
  const saySmthCodec = Struct({
    message: str,
  })

  // Address of the template in the network
  // 24 bytes length
  const address = Uint8Array.from([
    0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 100,
  ]);

  // Creating own templates
  const spawnTpl = new Transaction({
    address,
    methodSelector: 0,
    spawnArgsCodec: spawnCodec,
    // For Spawn transaction it is neccessary to add a template address into payload
    payloadCodec: withTemplateAddress(address, spawnCodec),
    sigCodec: SingleSig,
  });

  const saySmthTpl =
    new Transaction({
      address,
      methodSelector: 1,
      spawnArgsCodec: spawnCodec,
      payloadCodec: saySmthCodec,
      sigCodec: SingleSig,
    });
  
  // Use as in examples above
  const principal = saySmthTpl.principal({
    Owner: Uint8Array.from([ /* 32 bytes  */ ]),
  });

  const rawTx = saySmthTpl.encode(principal, {
    message: 'hello world',
  });

})();
```
npm package: @spacemesh/svm-codec
Description: svm-codec npm package for node and browser javascript apps.
Author: Spacemesh authors
Latest version: 0.1.3

## svm-codec npm package
A [public npm package](https://www.npmjs.com/package/@spacemesh/svm-codec) providing the Spacemesh svm-codec for browser and node.js apps.

### Setup
`yarn`

Copy an `svm_codec.wasm` file to include in the package from the Spacemesh svm codec crate. No autoamted pull is implemented yet.

### Building
`yarn build`

### Testing
`yarn test`

### Linting
`yarn lint`

### Publishing
`npm publish --access=public`

### Using
> look at `index.test.ts` for some useful helper functions for working with the package that you may want to use in your code.

svm_codev.wasm is not included in the package as different javascript apps will want to load it in different ways. e.g. load from app resources in a node.js or electron app. Load using a resources' loader in a web-app.

### Electron / Node.js App

Add `svm_codec.wasm` to be used by the lib to your app's resources.

```TypeScript
import fs from 'fs';
import Path from 'path';

import * as SvmCodec from '@spacemesh/svm-codec';

const path = Path.resolve(__dirname, 'svm_codec.wasm');
const code = fs.readFileSync(path);

await SvmCodec.init(code);

// call svmCodec functions...

```

### Web App

Load the binary data of svm_codec.wasm from your website static resoruces.

```TypeScript
import * as SvmCodec from '@spacemesh/svm-codec';

const code = .... // load data from svm_codec.wasm here...
await SvmCodec.init(code);

// call svmCodec functions....
```
-----

### Known Issues
- integration with svm-codec releases is NYI.
npm package: @spaceninja/half-tone
Description: A simple web component to apply a halftone filter to an image.
Author: Scott Vandehey
Latest version: 1.0.1

# Half-Tone

[![NPM version](http://img.shields.io/npm/v/@spaceninja/half-tone.svg)](https://www.npmjs.org/package/@spaceninja/half-tone)

A simple web component to apply a halftone filter to an image.

- [Demo](https://half-tone.netlify.app/)

## How Does It Work?

Wrap a standard `<img>` element in a `<half-tone>` element, and it will automatically have a halftone filter applies.

## Installation

```shell
npm install @spaceninja/half-tone
```

## Usage

```html
<half-tone>
  <img src="..." alt="..." />
</half-tone>

<script type="module" src="half-tone.js"></script>
```

### Attributes

You can configure the filter by setting any of the following attributes on the `<half-tone>` element.

| attribute          | default value |
| ------------------ | ------------- |
| `dot-size`         | `4px`         |
| `dot-color`        | `#333`        |
| `dot-contrast`     | `2000%`       |
| `dot-angle`        | `15deg`       |
| `photo-brightness` | `80%`         |
| `photo-contrast`   | `120%`        |
| `photo-blur`       | `2px`         |
| `blend-mode`       | `hard-light`  |
npm package: @spaceninja/writing-progress
Description: A web component for authors to track progress towards a word count goal.
Author: Scott Vandehey
Latest version: 1.1.0

# writing-progress

[![NPM version](http://img.shields.io/npm/v/@spaceninja/writing-progress.svg)](https://www.npmjs.org/package/@spaceninja/writing-progress)

A web component for authors to track progress towards a word count goal.

- [Demo](https://writing-progress.netlify.app/)

## How Does It Work?

Add the `<writing-progress>` element to your page with a `word-count` attribute, and it will calculate the progress towards your goal.

## Installation

```shell
npm install @spaceninja/writing-progress
```

## Usage

```html
<writing-progress word-count="19873"></writing-progress>

<script type="module" src="writing-progress.js"></script>
```

### Attributes

You can configure the component by setting any of the following attributes on the `<writing-progress>` element.

| attribute    | default value             |
| ------------ | ------------------------- |
| `word-count` | none                      |
| `goal`       | `100000`                  |
| `round`      | none                      |
| `start-date` | first day of current year |
| `end-date`   | last day of current year  |