Skip to content

duneanalytics/sim-idx-ts

Repository files navigation

@duneanalytics/sim-idx

npm version npm downloads License: MIT Tests Prettier TypeScript

A TypeScript library for writing Sim IDX apps.

Installation

npm install @duneanalytics/sim-idx
# or
yarn add @duneanalytics/sim-idx
# or
pnpm add @duneanalytics/sim-idx

API Reference

App Creation

import { create } from '@duneanalytics/sim-idx';

interface Env {
  CUSTOM_VAR: string;
}

const c = create<Env>();

Database Client

import { db } from '@duneanalytics/sim-idx';

// Get database client from Hono context
const client = db.client(context);

Blockchain Types

import { address, bytes32, uint256, int256 } from '@duneanalytics/sim-idx';
import { Address, Bytes, Uint, Int } from '@duneanalytics/sim-idx';

// Address type
const walletAddress = address('wallet_address');

// Bytes types (1-32 bytes)
const hash = bytes32('transaction_hash');
const shortData = bytes16('short_data');

// Integer types
const balance = uint256('balance');
const signedValue = int256('signed_value');

Environment Variables

The library expects these environment variables:

  • DB_CONNECTION_STRING: Your database connection string

Development

# Install dependencies
pnpm install

# Run tests
pnpm test

# Build the library
pnpm build

# Lint code
pnpm lint

# Format code
pnpm fix:prettier

Deploying

If you have the power to deploy, you can run the following commands to deploy the package to the npm registry:

⚠️ Important: Only deploy from the main branch

  1. Tag a new version of the package:
npm version <patch|minor|major>
  1. Push the tag to the remote repository:
git push --tags
  1. Publish the package to the npm registry:
npm publish
  1. Create a new release on GitHub with the same version number.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

About

No description, website, or topics provided.

Resources

License

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •