A Typescript library for publishing and discovering applications on the Metanet.
Metanet Apps allows developers to:
- Publish application metadata to the Bitcoin SV blockchain using PushDrop tokens
- Update existing app listings with new metadata
- Discover apps using various search criteria like domain, category, tags, and more
- Build a decentralized app catalog
npm install metanet-appsimport { AppCatalog } from 'metanet-apps'
const catalog = new AppCatalog({
// Optional parameters:
// overlayTopic: 'custom_topic', // Defaults to 'tm_apps'
// overlayService: 'custom_service', // Defaults to 'ls_apps'
// networkPreset: 'mainnet', // or 'testnet', 'local'
// acceptDelayedBroadcast: false
})const appMetadata = {
version: '0.1.0',
name: 'My Awesome App',
description: 'This app does amazing things on Metanet',
icon: 'https://example.com/icon.png',
domain: 'myapp.example.com',
category: 'utility',
tags: ['tools', 'productivity'],
release_date: new Date().toISOString()
}
const result = await catalog.publishApp(appMetadata)
console.log('Published app:', result)// Find by domain
const appsByDomain = await catalog.findApps({ domain: 'myapp.example.com' })
// Find by category
const utilityApps = await catalog.findApps({ category: 'utility' })
// Find by tags
const productivityApps = await catalog.findApps({ tags: ['productivity'] })
// Find by publisher
const myApps = await catalog.findApps({ publisher: '03abcdef...' })
// Fuzzy search by name
const searchResults = await catalog.findApps({ name: 'awesome' })// First, find the app you want to update
const [myApp] = await catalog.findApps({ domain: 'myapp.example.com' })
// Create updated metadata
const updatedMetadata = {
...myApp.metadata,
description: 'Updated description',
version: '0.2.0',
changelog: 'Added new features'
}
// Send the update
const result = await catalog.updateApp(myApp, updatedMetadata)
console.log('Updated app:', result)The main class for interacting with the Metanet Apps ecosystem.
new AppCatalog(options: AppCatalogOptions)options.overlayTopic?: Optional custom overlay topic (defaults to "tm_apps")options.overlayService?: Optional custom overlay service (defaults to "ls_apps")options.wallet?: Optional pre-configured walletoptions.networkPreset?: Optional network preset ("mainnet" | "testnet" | "local")options.acceptDelayedBroadcast?: Optional broadcast options (defaults to false)
publishApp(metadata: PublishedAppMetadata, opts?: { wallet?: WalletInterface }): Promise<Transaction | BroadcastResponse | BroadcastFailure>: Publishes an app to the overlay networkupdateApp(prev: PublishedApp, newMetadata: PublishedAppMetadata): Promise<BroadcastResponse | BroadcastFailure>: Updates an existing app listingremoveApp(prev: PublishedApp): Promise<BroadcastResponse | BroadcastFailure>: Removes an app listing from the overlay networkfindApps(query?: AppCatalogQuery, opts?: { resolver?: LookupResolver, wallet?: WalletInterface, includeBeef?: boolean }): Promise<PublishedApp[]>: Searches for apps based on the provided query with support for pagination and sorting
Query options for finding apps:
interface AppCatalogQuery {
domain?: string
publisher?: string // PubKeyHex
name?: string
category?: string
tags?: string[]
limit?: number
skip?: number
sortOrder?: 'asc' | 'desc'
startDate?: string
endDate?: string
}Metadata for a published app:
interface PublishedAppMetadata {
version: '0.1.0'
name: string
description: string
icon: string // URL or UHRP
httpURL?: string
uhrpURL?: string
domain: string
publisher?: string // Automatically set by the library from wallet's identity key
short_name?: string
category?: string
tags?: string[]
release_date: string // ISO-8601
changelog?: string
banner_image_url?: string
screenshot_urls?: string[]
}A published app with its metadata and token information:
interface PublishedApp {
metadata: PublishedAppMetadata
token: {
txid: string
outputIndex: number
lockingScript: string
satoshis: number
beef?: number[]
}
}This project is licensed under the Open BSV License.
Peer-to-peer Privacy Systems Research, LLC