open-index/open-npm huggingface dataset:
npm package: @t3ned/channel
Description: Ergonomic, chaining-based Typescript framework for quick API development for Fastify
Author: T3NED
Latest version: 1.4.2-beta

<div align="center">
<img src="https://imgur.com/OU9UQJp.png" align="center" width="80%" alt="channel banner">
<br>
<br>
<img src="https://img.shields.io/github/package-json/v/T3NED/channel" align="center" alt="">
<img src="https://img.shields.io/npm/dm/@t3ned/channel" align="center" alt="">
<img src="https://img.shields.io/github/license/T3NED/channel" align="center" alt="">
<img src="https://img.shields.io/github/issues/T3NED/channel" align="center" alt="">
<img src="https://img.shields.io/github/issues-pr/T3NED/channel" align="center" alt="">

<br>
<br>

**Ergonomic, chaining-based Typescript framework for quick API development for Fastify**

</div>

## Installation

```shell
> pnpm add @t3ned/channel
```

## Usage

```ts
// index.ts

import { Application } from "@t3ned/channel";
import fastify from "fastify";

const server = fastify();
const app = new Application(server)
	.setRouteDirPath(__dirname, "api")
	.setEnvFilePath(process.cwd(), ".env")
	.setDevelopmentEnvName("DEVELOPMENT")
	.setRoutePrefix("/api")
	.setDefaultVersionPrefix("v")
	.setDefaultVersion(1);

app.listen(3000, "0.0.0.0")
	.then(() => console.log(`Listening on port ${app.port}`))
	.catch((error) => console.error(error));
```

```ts
// api/example.ts

import { HttpStatus, ApiError, Get, env } from "@t3ned/channel";
import { z } from "zod";

const getExampleParamsSchema = z.object({
	id: z.string().uuid(),
});

process.env.AUTHORIZATION = "EXAMPLE";

export const getExample = Get("/:id")
	.version(1)
	.status(HttpStatus.Found)
	.params(getExampleParamsSchema)
	.status(HttpStatus.Ok)
	.preHandler((req, _reply, done) => {
		const { authorization } = req.headers;

		if (authorization !== env("AUTHORIZATION")) {
			throw new ApiError() //
				.setCode(0)
				.setStatus(HttpStatus.Unauthorized)
				.setMessage("Unauthorized");
		}

		return done();
	})
	.handler(({ parsed }) => {
		return {
			id: parsed.params.id,
		};
	});
```
npm package: @t3ned/snowflake
Description: Snowflake id generation and utilities
Author: T3NED
Latest version: 1.0.0

<div align="center">
<!-- <img src="" align="center" width="80%" alt="snowflake banner"> -->
<br>
<br>
<img src="https://img.shields.io/github/package-json/v/T3NED/snowflake" align="center" alt="">
<img src="https://img.shields.io/npm/dm/@t3ned/snowflake" align="center" alt="">
<img src="https://img.shields.io/github/license/T3NED/snowflake" align="center" alt="">
<img src="https://img.shields.io/github/issues/T3NED/snowflake" align="center" alt="">
<img src="https://img.shields.io/github/issues-pr/T3NED/snowflake" align="center" alt="">

<br>
<br>

**Snowflake id generation and utilities**

</div>

## Installation

```shell
> pnpm add @t3ned/snowflake
```
npm package: @t3rn/types
Description: t3rn protocol's type definitions for use with polkadot.js clients
Author: t3rn
Latest version: 0.1.12

# @t3rn/types

This package contains all the necessary types and RPC calls to interact with the t3rn protocol via the @polkadot/api client.

## Usage

```typescript
import "@t3rn/types"; // always import for @polkadot/api augmentations
import { createType } from "@t3rn/types"; // function for building typesafe types
import { T3rnTypesSfxSideEffect } from "@polkadot/types/lookup"; // import the specific type that was added via augmentation

let sfx: T3rnTypesSfxSideEffect = createType(
  "T3rnTypesSfxSideEffect",
  // The second parameter is automatically typesafe!
  {
    target: "roco",
    maxReward: 1000000,
    insurance: 100000,
    encodedAction: "tran",
    encodedArgs: ["0x0", "0x1"],
    signature: "",
    enforceExecutor: "",
    rewardAssetId: 1,
  }
);
```

In your project's `tsconfig.json` add the following compiler options:

```json
 "compilerOptions": {
    "module": "esnext" /** Ensures tsc uses esmodules **/,
    "target": "ES2018" /** Use a recent target **/,
    "esModuleInterop": true ,
    "moduleResolution": "node",
    "skipLibCheck": true /** Important: skips type checking for external libraries  **/
  }
```

In your project's `package.json` add the following:

```json
  "type": "module" /** Ensures this package is esm **/,
  "exports": {
    ".": "./index.js"  /** Define your exports **/
  },
```
npm package: @t402/btc
Description: t402 Payment Protocol Bitcoin & Lightning Network Implementation
Author: T402 Team
Latest version: 2.8.1

# @t402/btc

Bitcoin & Lightning Network payment mechanism for the t402 protocol.

Supports:

- **BTC On-chain**: PSBT-based payments using the `exact` scheme
- **Lightning Network**: BOLT11 invoice payments with preimage verification

## Installation

```bash
npm install @t402/btc @t402/core
# or
pnpm add @t402/btc @t402/core
```

For PSBT construction with bitcoinjs-lib (optional):

```bash
npm install bitcoinjs-lib
```

## Networks

| Network           | CAIP-2 ID                                 |
| ----------------- | ----------------------------------------- |
| BTC Mainnet       | `bip122:000000000019d6689c085ae165831e93` |
| BTC Testnet       | `bip122:000000000933ea01ad0ee984209779ba` |
| Lightning Mainnet | `lightning:mainnet`                       |
| Lightning Testnet | `lightning:testnet`                       |

## Usage

### BTC On-chain Client

```typescript
import { registerExactBtcScheme } from '@t402/btc/exact/client'
import { t402Client } from '@t402/core/client'

const client = new t402Client()
registerExactBtcScheme(client, {
  signer: {
    signPsbt: async (psbt) => {
      /* sign PSBT */
    },
    getAddress: () => 'bc1q...',
    getPublicKey: () => '02...',
  },
})
```

### Lightning Client

```typescript
import { registerLightningScheme } from '@t402/btc/lightning/client'
import { t402Client } from '@t402/core/client'

const client = new t402Client()
registerLightningScheme(client, {
  signer: {
    payInvoice: async (bolt11) => {
      // Pay invoice via your Lightning node
      return { preimage: '...', paymentHash: '...' }
    },
    getNodePubKey: () => '02...',
  },
})
```

### Server (Resource Server)

```typescript
import { registerExactBtcScheme } from '@t402/btc/exact/server'
import { registerLightningScheme } from '@t402/btc/lightning/server'
import { t402ResourceServer } from '@t402/core/server'

const server = new t402ResourceServer(facilitatorClient)

// BTC on-chain
registerExactBtcScheme(server, {
  schemeConfig: { payTo: 'bc1q...' },
})

// Lightning
registerLightningScheme(server, {
  schemeConfig: {
    generateInvoice: async (amountSats, description, expiry) => {
      // Generate BOLT11 invoice via your Lightning node
      return { bolt11Invoice: 'lnbc...', paymentHash: '...' }
    },
  },
})
```

### Facilitator

```typescript
import { registerExactBtcScheme } from '@t402/btc/exact/facilitator'
import { registerLightningScheme } from '@t402/btc/lightning/facilitator'
import { t402Facilitator } from '@t402/core/facilitator'

const facilitator = new t402Facilitator()

// BTC on-chain
registerExactBtcScheme(facilitator, {
  signer: btcFacilitatorSigner,
  networks: 'bip122:000000000019d6689c085ae165831e93',
})

// Lightning
registerLightningScheme(facilitator, {
  signer: lnFacilitatorSigner,
  networks: 'lightning:mainnet',
})
```

## License

Apache-2.0
npm package: @t402/vue
Description: t402 Payment Protocol Vue Components & Composables
Author: T402 Team
Latest version: 2.8.1

# @t402/vue

Vue components and composables for the t402 Payment Protocol. Build payment-aware UIs with pre-built components and reactive composables.

## Installation

```bash
npm install @t402/vue
```

## Quick Start

```vue
<script setup lang="ts">
import { PaymentButton, usePaymentRequired } from '@t402/vue'

const { paymentRequired, requirements, pay, status } = usePaymentRequired('/api/data')
</script>

<template>
  <div v-if="paymentRequired">
    <PaymentButton :requirements="requirements" :status="status" @pay="pay" />
  </div>
  <div v-else>Premium content loaded!</div>
</template>
```

## Components

### PaymentButton

Renders a payment action button with loading and status states.

```vue
<PaymentButton :requirements="requirements" :status="status" @pay="handlePay" />
```

### PaymentDetails

Displays payment requirements (amount, network, recipient).

```vue
<PaymentDetails :requirements="requirements" />
```

### PaymentStatusDisplay

Shows the current payment status with appropriate UI feedback.

```vue
<PaymentStatusDisplay :status="status" />
```

### AddressDisplay

Renders a blockchain address with truncation and copy functionality.

```vue
<AddressDisplay address="0x1234...5678" />
```

## Composables

### usePaymentRequired

Detects 402 responses and extracts payment requirements.

```typescript
const {
  paymentRequired, // Ref<boolean>
  requirements, // Ref<PaymentRequirements[]>
  pay, // () => Promise<void>
  status, // Ref<PaymentStatus>
} = usePaymentRequired(url, options)
```

### usePaymentStatus

Tracks the lifecycle of a payment (idle, pending, confirming, complete, error).

```typescript
const { status, error, reset } = usePaymentStatus()
```

### useAsyncPayment

Manages async payment flows with automatic retry and status tracking.

```typescript
const { execute, status, error } = useAsyncPayment(paymentFn)
```

## Utilities

```typescript
import {
  isEvmNetwork,
  isSvmNetwork,
  isTonNetwork,
  getNetworkDisplayName,
  truncateAddress,
  formatTokenAmount,
  choosePaymentRequirement,
} from '@t402/vue'

// Network detection
isEvmNetwork('eip155:8453') // true

// Display helpers
getNetworkDisplayName('eip155:8453') // "Base"
truncateAddress('0x1234567890abcdef') // "0x1234...cdef"
formatTokenAmount(1500000n, 6) // "1.50"
```

## Peer Dependencies

- `vue` ^3.3.0

## Development

```bash
pnpm build    # Build the package
pnpm test     # Run unit tests
```

## Related Packages

- `@t402/core` - Core protocol types
- `@t402/react` - React components & hooks
- `@t402/paywall` - Universal paywall UI
- `@t402/fetch` - Fetch wrapper with automatic payment