open-index/open-npm huggingface dataset:
npm package: @swarm-markets/cross-chain-access-sdk
Description: Swarm Cross-Chain Access SDK for stock market RWA trading
Latest version: 1.0.3

# @swarm/cross-chain-access-sdk

Swarm Cross-Chain Access SDK for trading stock market RWAs (Real World Assets).

## Installation

```bash
pnpm add @swarm/cross-chain-access-sdk
```

## Features

- **Stock Market Trading**: Buy and sell tokenized stocks (AAPL, MSFT, etc.)
- **Market Hours Checking**: Automatic market hours validation
- **Account Management**: Check account status and buying power
- **Cross-Chain Support**: Trade on multiple blockchain networks

## Quick Start

```typescript
import { CrossChainAccessClient, Network } from "@swarm/cross-chain-access-sdk";

const client = new CrossChainAccessClient({
  network: Network.POLYGON,
  privateKey: "0x...",
  userEmail: "user@example.com",
});

await client.initialize();

// Check if market is open
const [isAvailable, message] = await client.checkTradingAvailability();
console.log(message);

// Buy stock RWA with USDC
const result = await client.buy({
  rwaTokenAddress: "0xRWA...",
  rwaSymbol: "AAPL",
  usdcAmount: 1000,
  userEmail: "user@example.com",
});

console.log(`Trade executed: ${result.txHash}`);

await client.close();
```

## API

### CrossChainAccessClient

Main client for Cross-Chain Access trading.

```typescript
const client = new CrossChainAccessClient({
  network: Network.POLYGON, // Required: Network to trade on
  privateKey: "0x...", // Required: Private key for signing
  userEmail: "user@example.com", // Optional: User email
  rpcUrl: "https://...", // Optional: Custom RPC URL
});
```

#### Methods

- `initialize()` - Initialize and authenticate
- `close()` - Close and cleanup resources
- `checkTradingAvailability()` - Check if trading is available
- `getQuote(rwaSymbol)` - Get a quote for a stock symbol
- `buy(params)` - Buy RWA tokens with USDC
- `sell(params)` - Sell RWA tokens for USDC

### Market Hours

Check market hours (US stock market: 9:30 AM - 4:00 PM EST).

```typescript
import {
  MarketHours,
  isMarketOpen,
  getMarketStatus,
} from "@swarm/cross-chain-access-sdk";

// Check if market is open
if (isMarketOpen()) {
  console.log("Market is open!");
}

// Get detailed status
const status = getMarketStatus();
console.log(status.message); // "Market is open. Closes in 3h 45m"
```

### CrossChainAccessAPIClient

Low-level client for Cross-Chain Access API.

```typescript
import { CrossChainAccessAPIClient } from "@swarm/cross-chain-access-sdk";

const api = new CrossChainAccessAPIClient();
api.setAuthToken("...");

const quote = await api.getAssetQuote("AAPL");
console.log(`Ask: $${quote.askPrice}, Bid: $${quote.bidPrice}`);
```

## Supported Stock Symbols

The SDK supports trading tokenized versions of major US stocks, including:

- AAPL (Apple)
- MSFT (Microsoft)
- GOOGL (Alphabet)
- And many more...

## Market Hours

Trading is only available during US stock market hours:

- **Open**: 9:30 AM EST (14:30 UTC)
- **Close**: 4:00 PM EST (21:00 UTC)
- **Days**: Monday - Friday

## Supported Networks

- Polygon (Chain ID: 137) - Primary network
- Other networks may be available

## License

MIT
npm package: @swarm-markets/market-maker-sdk
Description: Swarm Market Maker SDK - Decentralized OTC trading for RWAs
Latest version: 1.0.3

# @swarm/market-maker-sdk

Swarm Market Maker SDK for peer-to-peer OTC trading on blockchain.

## Installation

```bash
pnpm add @swarm/market-maker-sdk
```

## Features

- **RPQ Service**: Request-for-Quote service for discovering offers
- **Smart Contract Integration**: Direct interaction with Market Maker contracts
- **Token Operations**: ERC20 approvals and transfers
- **Offer Management**: Make, take, and cancel offers

## Quick Start

```typescript
import { MarketMakerClient, Network } from "@swarm/market-maker-sdk";

const client = new MarketMakerClient({
  network: Network.POLYGON,
  privateKey: "0x...",
  rpqApiKey: "your-api-key",
});

await client.initialize();

// Get a quote
const quote = await client.getQuote(
  "0xFromToken...",
  "0xToToken...",
  100 // fromAmount
);

// Execute a trade
const result = await client.trade(
  "0xFromToken...",
  "0xToToken...",
  100 // fromAmount
);

console.log(`Trade executed: ${result.txHash}`);

await client.close();
```

## API

### MarketMakerClient

Main client for Market Maker operations.

```typescript
const client = new MarketMakerClient({
  network: Network.POLYGON, // Required: Network to trade on
  privateKey: "0x...", // Required: Private key for signing
  rpqApiKey: "your-api-key", // Required: RPQ Service API key
  userEmail: "user@example.com", // Optional: User email
  rpcUrl: "https://...", // Optional: Custom RPC URL
});
```

#### Methods

- `initialize()` - Initialize the client
- `close()` - Close and cleanup resources
- `getQuote(fromToken, toToken, fromAmount?, toAmount?)` - Get a quote
- `trade(fromToken, toToken, fromAmount?, toAmount?, affiliate?)` - Execute a trade
- `makeOffer(params)` - Create a new offer
- `cancelOffer(offerId)` - Cancel an existing offer

### RPQClient

Low-level client for RPQ Service API.

```typescript
import { RPQClient } from "@swarm/market-maker-sdk";

const rpq = new RPQClient("polygon", "api-key");
const offers = await rpq.getOffers("0xBuyAsset", "0xSellAsset");
```

### MarketMakerWeb3Client

Low-level client for smart contract interactions.

```typescript
import { MarketMakerWeb3Client, Network } from "@swarm/market-maker-sdk";

const web3Client = new MarketMakerWeb3Client(
  Network.POLYGON,
  "0xPrivateKey..."
);

const txHash = await web3Client.takeFixedOffer(
  123, // offerId
  "0xWithdrawToken", // withdrawal token address
  1000000000n // amount in wei
);
```

## Supported Networks

- Ethereum (Chain ID: 1)
- Polygon (Chain ID: 137)
- Base (Chain ID: 8453)
- BSC (Chain ID: 56)

## License

MIT
npm package: @swarm-markets/shared
Description: Shared utilities and types for Swarm SDKs
Latest version: 1.0.3

# @swarm/shared

Shared utilities, types, and clients used across all Swarm SDKs.

## Installation

```bash
pnpm add @swarm/shared
```

## Features

- **Network Configuration**: Supported blockchain networks (Ethereum, Polygon, Base, BSC)
- **Base API Client**: HTTP client with retry logic and error handling
- **Web3 Helper**: ERC20 token operations using viem
- **Swarm Auth**: Authentication with Swarm platform
- **Remote Config**: Fetch configuration from Swarm services
- **Type Definitions**: Shared types for quotes, trade results, etc.

## Usage

### Network Types

```typescript
import { Network, getNetworkName } from "@swarm/shared";

const network = Network.POLYGON;
console.log(getNetworkName(network)); // "polygon"
```

### Web3 Helper

```typescript
import { Web3Helper, Network } from "@swarm/shared";

const helper = new Web3Helper("0xPrivateKey...", Network.POLYGON);

// Get token balance
const balance = await helper.getBalance("0xTokenAddress");

// Transfer tokens
const txHash = await helper.transferToken("0xRecipient", "0xTokenAddress", 100);
```

### Swarm Auth

```typescript
import { SwarmAuth } from "@swarm/shared";

const auth = new SwarmAuth();
const tokens = await auth.verify("0xPrivateKey...");

console.log(tokens.accessToken);
```

### Base API Client

```typescript
import { BaseAPIClient, APIException } from "@swarm/shared";

class MyClient extends BaseAPIClient {
  constructor() {
    super("https://api.example.com");
  }

  async getData() {
    return this.makeRequest("GET", "/data");
  }
}
```

## Exports

- `Network` - Enum for supported networks
- `Quote` - Quote interface
- `TradeResult` - Trade result interface
- `BaseAPIClient` - Base HTTP client with retries
- `Web3Helper` - Web3 operations helper
- `SwarmAuth` - Authentication client
- `getConfigFetcher` - Remote configuration fetcher
- Various constants and utilities

## License

MIT
npm package: @swarm/ron-grammar
Description: A regular grammar for the Swarm Replicated Object Notation
Author: Victor Grishchenko
Latest version: 0.1.1

# Regex parsers for the Replicated Object Notation

see protocol docs at
    https://github.com/gritzko/ron

use:
```
> const RON=require('swarm-ron-grammar');
> RON.OP.exec('#time-orig`:loc=1"str"')
[ '#id`:l=1"str"',
  '',
  'time-orig',
  '`',
  'loc',
  '=1"str"',
  index: 0,
  input: '#id`:l=1"str"' ]
```