Skip to content

mistcash/sdk

Repository files navigation

MIST.cash SDK

A TypeScript SDK for interacting with MIST.cash - a privacy-focused protocol on Starknet.

Overview

The MIST SDK is a monorepo containing multiple packages that provide different layers of functionality for building applications with MIST.cash:

Quick Start

For React Applications

pnpm add @mistcash/react

📝 TODO

For Non-React Applications/Backends

pnpm add @mistcash/sdk

📝 TODO

Packages

@mistcash/react

React hooks and utilities for MIST.cash integration. Provides the useMist hook that manages state, asset fetching, and transaction sending.

Key Features:

  • Input state management (val*, set* items)
  • Asset selection and fetching
  • Contract interaction with loading states
  • Transaction error handling

View Package Documentation

@mistcash/sdk

Core SDK containing the fundamental utilities for interacting with MIST.cash contracts.

Key Features:

  • Typed contract creation (getChamber)
  • Asset fetching from transactions (fetchTxAssets)
  • Transaction validation and verification

View Package Documentation

@mistcash/config

Configuration package containing ABIs, contract addresses, and type definitions.

Key Features:

  • Chamber contract ABI (CHAMBER_ABI)
  • Mainnet contract addresses (CHAMBER_ADDR_MAINNET)
  • TypeScript contract types (ChamberTypedContract)

View Package Documentation

Important Notes

📝 TODO

Examples

Fetching Transaction Assets

import { getChamber, fetchTxAssets } from '@mistcash/sdk';

const contract = getChamber(provider);
const assets = await fetchTxAssets(contract, transactionKey, recipientAddress);

console.log('Available assets:', assets);

Reading Transaction with Secret

import { txSecret } from '@mistcash/crypto';
import { getChamber } from '@mistcash/sdk';

const contract = getChamber(provider);
const secret = await txSecret(valKey, valTo);
const asset = await contract.read_tx(secret);

Computing Transaction Hash

import { txHash } from '@mistcash/crypto';

const hash = await txHash(transactionKey, recipientAddress, tokenAddress, amount);

Important Notes

⚠️ Transaction State Limitations: The contract cannot determine which transactions have been spent. The fetchTxAssets function will show assets even if the transaction has already been used.

⚠️ Transaction Guarantee: fetchTxAssets guarantees that a transaction was generated but does not verify if it's still spendable.

Contributing

We welcome contributions! Please see our Contributing Guide for details on how to get started.

Development Setup

# Clone the repository
git clone https://github.com/mistcash/sdk.git
cd sdk

# Install dependencies
pnpm install

# Build all packages
pnpm build

# Run tests
pnpm test

License

MIT License - see LICENSE file for details.

Support


Built with ❤️ for the Starknet ecosystem.

About

MIST.cash SDK for integrating private payments into your project

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages