{"id":20170676,"url":"https://github.com/bitcoinschema/js-bso","last_synced_at":"2026-06-09T10:31:47.453Z","repository":{"id":211937428,"uuid":"730322118","full_name":"BitcoinSchema/js-bso","owner":"BitcoinSchema","description":"BSocial Library","archived":false,"fork":false,"pushed_at":"2026-03-16T23:39:42.000Z","size":33,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2026-03-17T09:56:42.440Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BitcoinSchema.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-12-11T17:09:54.000Z","updated_at":"2026-03-16T23:39:45.000Z","dependencies_parsed_at":null,"dependency_job_id":"45a5f543-1f7a-45b4-90cd-70de6c484373","html_url":"https://github.com/BitcoinSchema/js-bso","commit_stats":null,"previous_names":["bitcoinschema/js-bso"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/BitcoinSchema/js-bso","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BitcoinSchema%2Fjs-bso","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BitcoinSchema%2Fjs-bso/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BitcoinSchema%2Fjs-bso/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BitcoinSchema%2Fjs-bso/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BitcoinSchema","download_url":"https://codeload.github.com/BitcoinSchema/js-bso/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BitcoinSchema%2Fjs-bso/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34103355,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-09T02:00:06.510Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-14T01:20:14.545Z","updated_at":"2026-06-09T10:31:47.448Z","avatar_url":"https://github.com/BitcoinSchema.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @bitcoinschema/bso-lib\n\nBitcoin Social transaction creation library for BSV. Creates OP_RETURN transactions following the B://, MAP, and BSocial protocols.\n\n## Installation\n\n```bash\nbun add @bitcoinschema/bso-lib @bsv/sdk\n```\n\n## Quick Start\n\n```typescript\nimport { createPost, createMessage, createLike, Context } from \"@bitcoinschema/bso-lib\";\n\n// Create a post\nconst postTx = await createPost(\"Hello Bitcoin!\");\n\n// Create a message in a channel\nconst msgTx = await createMessage(\"Hey everyone\", { channel: \"general\" });\n\n// Like a post\nconst likeTx = await createLike(\"abc123...txid\");\n```\n\n## Transaction Functions\n\nAll functions are async and return a `Transaction` from `@bsv/sdk`.\n\n### Messages\n\n```typescript\n// Simple message\nconst tx = await createMessage(\"Hello World\");\n\n// Message to a channel\nconst tx = await createMessage(\"Channel message\", { channel: \"general\" });\n\n// Direct message to a BAP identity\nconst tx = await createMessage(\"Private message\", { toBapId: \"...\" });\n```\n\n### Posts\n\n```typescript\n// Simple post\nconst tx = await createPost(\"My post content\");\n\n// Post with context\nconst tx = await createPost(\"Check this out\", {\n  context: Context.URL,\n  contextValue: \"https://example.com\",\n});\n\n// Post with tags\nconst tx = await createPost(\"Tagged post\", {\n  tags: [\"bitcoin\", \"bsv\"],\n});\n```\n\n### Replies\n\n```typescript\nconst tx = await createReply(\"Great point!\", \"original-txid\");\n```\n\n### Likes\n\n```typescript\nconst tx = await createLike(\"txid-to-like\");\nconst tx = await createUnlike(\"txid-to-unlike\");\n```\n\n### Follows\n\n```typescript\nconst tx = await createFollow(\"bap-id-to-follow\");\nconst tx = await createUnfollow(\"bap-id-to-unfollow\");\n```\n\n### Videos\n\n```typescript\nconst tx = await createVideo(\"youtube\", \"dQw4w9WgXcQ\");\n\n// With duration and start time\nconst tx = await createVideo(\"youtube\", \"dQw4w9WgXcQ\", {\n  duration: 212,\n  start: 30,\n});\n```\n\n### Reposts \u0026 Friends\n\n```typescript\nconst tx = await createRepost(\"original-txid\");\nconst tx = await createFriend(\"bap-id\", { publicKey: \"...\" });\n```\n\n## BMAP Client\n\nQuery the BMAP API for social data.\n\n```typescript\nimport {\n  getPostsByBapId,\n  getFeedByBapId,\n  getLikesForPost,\n  getChannelMessages,\n  subscribeToChannel,\n} from \"@bitcoinschema/bso-lib\";\n\n// Get posts by identity\nconst posts = await getPostsByBapId(\"bap-id\");\n\n// Get feed (posts from followed users)\nconst feed = await getFeedByBapId(\"bap-id\");\n\n// Get likes for a post\nconst likes = await getLikesForPost(\"txid\");\n\n// Get channel messages\nconst messages = await getChannelMessages(\"general\");\n\n// Subscribe to real-time channel updates (SSE)\nconst eventSource = subscribeToChannel(\"general\", {\n  onMessage: (post) =\u003e console.log(\"New message:\", post),\n  onError: (err) =\u003e console.error(err),\n});\n\n// Stop listening\neventSource.close();\n```\n\n### Custom Queries\n\n```typescript\nimport { queryBmap, buildPostsQuery, buildLikesQuery } from \"@bitcoinschema/bso-lib\";\n\n// Build and execute a custom query\nconst query = buildPostsQuery({ bapId: \"...\", limit: 10 });\nconst posts = await queryBmap(\"post\", query);\n\n// Query builders available:\n// buildPostsQuery({ address?, bapId?, channel?, limit? })\n// buildMessagesQuery({ channel?, address?, limit? })\n// buildLikesQuery({ address?, txid?, limit? })\n// buildFollowsQuery({ address?, limit? })\n// buildFriendsQuery({ address?, limit? })\n```\n\n### Submit Transactions\n\n```typescript\nimport { ingestTransaction } from \"@bitcoinschema/bso-lib\";\n\n// Submit a signed transaction to the BMAP indexer\nconst result = await ingestTransaction(signedTx.toHex());\nconsole.log(\"Indexed:\", result.txid);\n```\n\n## Identity Signing\n\nSign transactions with AIP using your identity key:\n\n```typescript\nimport { PrivateKey } from \"@bsv/sdk\";\n\nconst identityKey = PrivateKey.fromWif(\"...\");\n\nconst tx = await createPost(\"Signed post\", {\n  identityKey,\n});\n```\n\n## Context Types\n\n| Context | Description |\n|---------|-------------|\n| `Context.Topic` | Categorize by topic |\n| `Context.URL` | Reference a URL |\n| `Context.Tx` | Reply to a transaction |\n| `Context.Channel` | Post to a channel |\n| `Context.BapID` | Reference a BAP identity |\n\n## Development\n\n```bash\nbun install       # Install dependencies\nbun test          # Run tests\nbun run build     # Build for production\nbun run lint      # Check code style\nbun run lint:fix  # Fix code style\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitcoinschema%2Fjs-bso","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbitcoinschema%2Fjs-bso","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitcoinschema%2Fjs-bso/lists"}