open-index/open-npm huggingface dataset:
npm package: @stackpay/sdk
Description: A secure and easy-to-use SDK for processing sBTC payments on the Stacks blockchain
Author: StackPay Team
Latest version: 0.2.0

# StackPay SDK

A simple and secure SDK for processing sBTC payments on the Stacks blockchain testnet.

## Installation

```bash
npm install @stackpay/sdk
```

## Quick Start

```typescript
import { StackPay } from '@stackpay/sdk';

// Initialize StackPay (defaults to testnet)
const stackPay = new StackPay();

// Process a payment
async function makePayment() {
  try {
    const recipientAddress = 'ST2CY5V39NHDPWSXMW9QDT3HC3GD6Q6XX4CFRK9AG';
    const amount = 0.1; // sBTC amount
    const txId = await stackPay.initiatePayment(amount, recipientAddress);
    console.log(`Payment initiated! Transaction ID: ${txId}`);
  } catch (error) {
    console.error('Payment failed:', error);
  }
}
```

## Features

- ✨ Simple API for sBTC payments
- 🔒 Secure transaction handling
- 🧪 Built-in testnet support
- ⚡ Promise-based async operations

## Environment Setup

Create a `.env` file in your project root:

```env
STACKS_PRIVATE_KEY=your_private_key_here
```

## API Reference

### `StackPay`

Main class for handling payments.

#### Constructor

```typescript
new StackPay(isTestnet = true)
```

- `isTestnet`: Boolean to determine if testnet should be used (default: true)

#### Methods

##### `initiatePayment`
```typescript
async initiatePayment(amount: number, recipient: string): Promise<string>
```
- `amount`: Amount in sBTC
- `recipient`: Recipient's Stacks address
- Returns: Transaction ID

## Testing

```bash
npm test
```

## Development

1. Clone the repository
2. Install dependencies: `npm install`
3. Build: `npm run build`
4. Run tests: `npm test`

## Security

This SDK is in MVP stage. Always test thoroughly on testnet before using in production.

## License

MIT License