open-index/open-npm huggingface dataset:
npm package: @sovereign-sdk/indexer
Description: A simple indexer for Sovereign SDK rollups
Latest version: 0.4.21

# @sovereign-sdk/indexer

An extendable indexer for Sovereign SDK rollups written in TypeScript.

## Running

With your database accessible & rollup running the indexer can be started like so:

```bash
DATABASE_URL="postgres://YOUR_DB_STRING" npx @sovereign-sdk/indexer --rollup-url http://localhost:12346
```

## Database Setup

The indexer expects the database to have the events table structure as defined in `db/create_events_table.sql`. This table is used to store rollup events with their associated metadata, timestamps, and payload information.

Currently this package doesn't perform migration management or have any extra opinions about database schema so it can potentially connect to existing databases, this might change in the future though.

#### Local development

For local development of your rollup+application you might want to have the indexer run against a local postgres database, the following section provides instructions on how to do this.

#### Prerequisites

- Docker installed on your system
- Docker daemon running

#### Setup Steps

1. Pull the official Postgres Docker image:

```bash
docker pull postgres
```

2. Create and start a Postgres container:

```bash
docker run --name sov-indexer-db \
  -e POSTGRES_PASSWORD=admin123 \
  -d \
  -p 5432:5432 \
  postgres
```

> **Note**: If you change the password, make sure to update it in the `dev` npm script connection string as well.

3. Verify the container is running:

```bash
docker ps
```

4. If you need to start an existing container later:

```bash
docker start sov-indexer-db
```

5. Initialize the database schema:

```bash
docker exec -i sov-indexer-db psql -U postgres < ./db/create_events_table.sql
```

### Connection Details

- Host: `localhost`
- Port: `5432`
- Username: `postgres`
- Password: `admin123`
- Database: `postgres`

### Useful Docker Commands

Stop the container:

```bash
docker stop sov-indexer-db
```

Remove the container (will delete all data):

```bash
docker rm sov-indexer-db
```

View container logs:

```bash
docker logs sov-indexer-db
```
npm package: @sovereign-sdk/modules
Description: A package providing convenient helpers for interacting with core Sovereign SDK modules
Latest version: 0.3.2

# @sovereign-sdk/modules

[![npm version](https://img.shields.io/npm/v/@sovereign-sdk/modules.svg)](https://www.npmjs.com/package/@sovereign-sdk/modules)
[![CI](https://github.com/Sovereign-Labs/sovereign-sdk/actions/workflows/typescript.ci.yml/badge.svg)](https://github.com/Sovereign-Labs/sovereign-sdk/actions/workflows/typescript.ci.yml)

Convenient helpers for interacting with core Sovereign SDK modules.

## Installation

```bash
npm install @sovereign-sdk/modules
```

## Usage

### Bank Module

```typescript
import { BankModule } from "@sovereign-sdk/modules";
import { StandardRollup } from "@sovereign-sdk/web3";

const rollup = new StandardRollup({
  url: "https://your-rollup-node.com",
  // ... other config
});

const bank = new BankModule(rollup);

// Get balance for an address
const balance = await bank.getBalance(address, tokenAddress);
```
npm package: @sovereign-sdk/serializers
Description: A package providing serialization for types used by Sovereign SDK apps
Latest version: 0.1.3

# @sovereign-sdk/serializers

[![npm version](https://img.shields.io/npm/v/@sovereign-sdk/serializers.svg)](https://www.npmjs.com/package/@sovereign-sdk/serializers)
[![CI](https://github.com/Sovereign-Labs/sovereign-sdk/actions/workflows/typescript.ci.yml/badge.svg)](https://github.com/Sovereign-Labs/sovereign-sdk/actions/workflows/typescript.ci.yml)

A package providing [Borsh](https://borsh.io/) serialization for types used by Sovereign SDK applications.

## Installation

```bash
npm install @sovereign-sdk/serializers
```

## Development

This package includes comprehensive tests that verify compatibility between the JavaScript and WebAssembly implementations:

```bash
# Run tests
pnpm test

# Build the package
pnpm build

# Lint and format
pnpm run fix
```
npm package: @sovereign-sdk/signers
Description: Signer interface and default implementations for use with Sovereign SDK applications
Latest version: 0.5.2

# @sovereign-sdk/signers

[![npm version](https://img.shields.io/npm/v/@sovereign-sdk/signers.svg)](https://www.npmjs.com/package/@sovereign-sdk/signers)
[![CI](https://github.com/Sovereign-Labs/sovereign-sdk/actions/workflows/typescript.ci.yml/badge.svg)](https://github.com/Sovereign-Labs/sovereign-sdk/actions/workflows/typescript.ci.yml)

A signer interface and implementations for use with Sovereign SDK applications.

## Installation

```
npm install @sovereign-sdk/signers
```

## Features

- 🔐 Abstract `Signer` interface that can be implemented to provide custom signers for use in `@sovereign-sdk/web3`.
- 🦊 MetaMask Snap signer implementation for use with [Sovereign's Universal MetaMask Snap](https://github.com/Sovereign-Labs/sovereign-universal-snap)


## Usage

### MetaMask Snap Signer


```typescript
import { newMetaMaskSnapSigner } from '@sovereign-sdk/signers';

// Initialize the signer
const signer = newMetaMaskSnapSigner({
  curve: 'ed25519', // or 'secp256k1'
  schema: {
    // Your rollup schema
  },
  snapId: 'npm:@sovereign-sdk/metamask-snap', // Metamask snap origin, can be changed to `local:localhost:8080` for local development
});

// Get public key
const publicKey = await signer.publicKey();

// Sign a message
const message = new Uint8Array([/* your message */]);
const signature = await signer.sign(message);
```

### Custom Signer Implementation

You can implement your own signer by implementing the `Signer` interface if your wallet is not currently supported.

```typescript
import { Signer } from '@sovereign-sdk/signers';

class MySigner implements Signer {
  publicKey() {
    // retrieve the public key from your wallet
    return new Uint8Array([/* your public key */]);
  }

  async sign(message: Uint8Array) {
    // sign the message
    return new Uint8Array([/* your signature */]);
  }
}
```
npm package: @sovereign-sdk/types
Description: Core type definitions for Sovereign SDK blockchain interactions
Latest version: 0.1.2

# @sovereign-sdk/types

Core type definitions for Sovereign SDK blockchain interactions.

## Overview

This package provides TypeScript type definitions for working with "standard" Sovereign SDK rollups. While Sovereign SDK rollups are fully generic and can define custom types for transactions, blocks, and other primitives, this package contains the default type definitions used by the standard Sovereign SDK implementation.

## Standard Types

While Sovereign SDK supports this level of customization, most rollups will use a common set of primitives. This package provides type definitions for these standard components (and more):

- `UnsignedTransaction` - Standard unsigned transaction format
- `Transaction` - Standard signed transaction format

These types work out-of-the-box with the default Sovereign SDK rollup configuration and are compatible with the other packages in this monorepo (`@sovereign-sdk/web3`, `@sovereign-sdk/signers`, etc.).

## Usage

```typescript
import type { UnsignedTransaction, Transaction } from "@sovereign-sdk/types";

// Use the standard transaction types
const unsignedTx: UnsignedTransaction = {
  // Standard transaction fields
};

const signedTx: Transaction = {
  // Standard signed transaction fields
};
```

## Custom Types

If your rollup uses custom transaction or block formats that differ from the standard Sovereign SDK types, you can:

1. Define your own types in your application
2. Extend or modify these standard types as needed
3. Use the generic interfaces provided by other packages in this monorepo

The Sovereign SDK's flexibility means you're never locked into these standard definitions if your use case requires something different.
npm package: @sovereign-sdk/universal-wallet-wasm
Description: [![npm version](https://img.shields.io/npm/v/@sovereign-sdk/universal-wallet-wasm.svg)](https://www.npmjs.com/package/@sovereign-sdk/universal-wallet-wasm) [![CI](https://github.com/Sovereign-Labs/sovereign-sdk/actions/workflows/typescript.ci.yml/badge.sv
Latest version: 0.6.0

# @sovereign-sdk/universal-wallet-wasm

[![npm version](https://img.shields.io/npm/v/@sovereign-sdk/universal-wallet-wasm.svg)](https://www.npmjs.com/package/@sovereign-sdk/universal-wallet-wasm)
[![CI](https://github.com/Sovereign-Labs/sovereign-sdk/actions/workflows/typescript.ci.yml/badge.svg)](https://github.com/Sovereign-Labs/sovereign-sdk/actions/workflows/typescript.ci.yml)

WebAssembly bindings for Sovereign SDK's universal wallet, providing schema validation and serialization utilities.

## Installation

```bash
npm install @sovereign-sdk/universal-wallet-wasm
```

## Features

- 🔄 JSON to [Borsh](https://borsh.io/) serialization of rollup types
- 📝 Schema validation
- 📄 Human-readable display of Borsh bytes

## Usage

```typescript
import { Schema, KnownTypeId } from '@sovereign-sdk/universal-wallet-wasm';

// Initialize schema from JSON outputted during rollup compilation
const schema = Schema.fromJSON(JSON.stringify(yourSchemaJson));

// Convert JSON to Borsh bytes
const runtimeCall = { value_setter: { set_many_values: [4, 6] } };
const borshBytes = schema.jsonToBorsh(
  schema.knownTypeIndex(KnownTypeId.RuntimeCall),
  JSON.stringify(runtimeCall)
);

// Display Borsh bytes as human-readable string
const displayed = schema.display(
  schema.knownTypeIndex(KnownTypeId.RuntimeCall),
  borshBytes
);
```

## Development Guide

This package uses [wasm-pack](https://rustwasm.github.io/wasm-pack/) to compile Rust code to WebAssembly and generate JavaScript bindings.

### Prerequisites

1. Install Rust (version 1.79 or later)
2. Install Node.js dependencies: `pnpm install`

### Build Commands

- `pnpm build` - Builds both Node.js and ESM targets
- `pnpm compile:node` - Builds Node.js target only
- `pnpm compile:esm` - Builds ESM target only
- `pnpm test` - Runs tests

### Project Structure

```
universal-wallet-wasm/
├── src/           # Rust source code
├── tests/         # TypeScript tests
├── dist/         # Compiled outputs (generated)
│   ├── node/     # Node.js target
│   └── esm/      # ESM target
└── Cargo.toml    # Rust dependencies
└── package.json  # NPM package configuration
```

### Making Changes

1. Edit Rust code in `src/lib.rs`
2. Run `pnpm build` to compile
3. Add tests in `tests/` directory
4. Run `pnpm test` to verify changes