1.0.1 • Published 8 months ago
@feiyangl1020/metaid-create-buzz v1.0.1
@feiyangl1020/metaid-create-buzz 🐝
A TypeScript library for creating and managing Buzz content on the MetaID protocol. Buzz is a decentralized social media post format that supports both public and pay-to-view content with media attachments.
Table of Contents
Features
- Create normal Buzz posts with text and media attachments
- Create pay-to-view Buzz posts with encrypted content
- Support both BTC and MVC chains
- Handle image and video uploads
- Support NFT attachments
- Configurable fee rates and network settings
Installation
npm install @feiyangl1020/metaid-create-buzz
# or
yarn add @feiyangl1020/metaid-create-buzz
# or
pnpm add @feiyangl1020/metaid-create-buzzUsage
Basic Setup
import { createBuzz, createNormalBuzz } from '@feiyangl1020/metaid-create-buzz';
// Initialize with your connector and network settings
const params = {
buzz: {
content: "Hello MetaID!",
publicImages: [],
encryptContent: "",
encryptImages: [],
nfts: []
},
host: "https://api.metaid.io",
feeRate: 1,
chain: "btc",
btcConnector: yourBtcConnector,
mvcConnector: yourMvcConnector,
network: "testnet"
};
// Create a normal buzz
const txId = await createNormalBuzz(params);
// Create a pay-to-view buzz
const payParams = {
...params,
isPayBuzz: true,
payInfo: {
manPubKey: "your_pubkey",
payType: "btc",
payAmount: 1000,
manDomain: "your.domain"
}
};
const payTxId = await createBuzz(payParams);API Reference
createBuzz(params: Props)
Creates a pay-to-view Buzz post with encrypted content.
Parameters
params: Configuration object containing:buzz: Buzz content detailshost: MetaID API hostfeeRate: Transaction fee ratechain: Blockchain ("btc" or "mvc")btcConnector: BTC wallet connectormvcConnector: MVC wallet connectornetwork: Network ("mainnet" or "testnet")isPayBuzz: Whether this is a pay-to-view buzzpayInfo: Payment configuration
createNormalBuzz(params: Props)
Creates a normal public Buzz post.
Dependencies
- @feiyangl1020/metaid
- browser-image-compression
- compressorjs
- crypto-js
- uuid
Development
To set up the development environment:
git clone https://github.com/feiyang1020/metaid-create-buzz.git
cd metaid-create-buzz
pnpm installBuilding
npm run buildBuilds the project to the dist folder using TypeScript.
Testing
Run unit tests with Jest:
npm testContributing
Contributions are welcome! Please open an issue or submit a pull request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/your-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin feature/your-feature) - Open a pull request
License
ISC © feiyang1020