npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

rss3-next

v0.7.0

Published

JavaScript SDK for [RSS3-Hub](https://github.com/NaturalSelectionLabs/RSS3-Hub)

Downloads

8,847

Readme

RSS3 SDK JavaScript

JavaScript SDK for RSS3-Hub

Install

npm install rss3 --save

or

yarn add rss3
import RSS3 from 'rss3';

or

const RSS3 = require('rss3').default;

API

Initialization

interface IOptions {
    endpoint: string;
    agentSign?: boolean;
}

interface IOptionsMnemonic extends IOptions {
    mnemonic?: string;
    mnemonicPath?: string;
}

interface IOptionsPrivateKey extends IOptions {
    privateKey: string;
}

interface IOptionsSign extends IOptions {
    address: string;
    sign: (data: string) => Promise<string>;
}

new RSS3(options: IOptionsMnemonic | IOptionsPrivateKey | IOptionsSign);

Example:

New

const rss3 = new RSS3({
    endpoint: 'https://rss3-hub-playground-6raed.ondigitalocean.app',
});

Mnemonic

const rss3 = new RSS3({
    endpoint: 'https://rss3-hub-playground-6raed.ondigitalocean.app',
});

PrivateKey

const rss3 = new RSS3({
    endpoint: 'https://rss3-hub-playground-6raed.ondigitalocean.app',
    privateKey: '0x47e18d6c386898b424025cd9db446f779ef24ad33a26c499c87bb3d9372540ba',
});

MetaMask

const metaMaskWeb3 = new Web3(window.ethereum);
window.ethereum
    .request({
        method: 'eth_requestAccounts',
    })
    .then(async (accounts) => {
        const address = metaMaskWeb3.utils.toChecksumAddress(accounts[0]);
        const rss3 = new RSS3({
            endpoint: 'https://rss3-hub-playground-6raed.ondigitalocean.app',
            address,
            sign: async (data) => await metaMaskWeb3.eth.personal.sign(data, address),
        });
        rss3.files.set(await rss3.files.get(address));
        await rss3.files.sync();
    });

Account

account.mnemonic

If initialized with privateKey or custom sign function, then this value is undefined

account.mnemonic: string | undefined

account.privateKey

If initialized with custom sign function, then this value is undefined

account.privateKey: string | undefined

account.address

account.address: string

Files

files.sync()

Please note that changes will only be synced to the node after files.sync() is successfully executed

files.sync(): string[]

Example:

const changedFiles = rss3.files.sync();

files.get()

files.get(fileID: string): Promise<RSS3Content>

Example:

const file = await rss3.files.get(rss3.account.address);

Profile

profile.get()

profile.get(personaID: string = account.address): Promise<RSS3Profile>

Example:

const profile = rss3.profile.get();

profile.patch()

profile.patch(profile: RSS3Profile): Promise<RSS3Profile>

Example:

const newProfile = await rss3.profile.patch({
    name: 'RSS3',
    avatar: 'https://cloudflare-ipfs.com/ipfs/QmZWWSspbyFtWpLZtoAK35AjEYK75woNawqLgKC4DRpqxu',
    bio: 'RSS3 is an open protocol designed for content and social networks in the Web 3.0 era.',
});

Items

items.get()

items.get(fileID: string = account.address): Promise<{
    items: RSS3Item[],
    items_next?: string,
}>

Example:

const list1 = await rss3.items.get();
const items1 = list1.items;
const list2 = await rss3.items.get(list1.items_next);
const items2 = list2.items;

Item

item.get

item.get(itemID: string): Promise<RSS3Item>

Example:

const item = await rss3.item.get('0x47e18d6c386898b424025cd9db446f779ef24ad33a26c499c87bb3d9372540ba-item-0');

item.post

item.post(item: RSS3ItemInput): Promise<RSS3ItemInput>

Example:

const item = await rss3.item.post({
    title: 'Hello RSS3',
    summary: 'RSS3 is an open protocol designed for content and social networks in the Web 3.0 era.',
});

item.patch

item.patch(item: RSS3ItemInput): Promise<RSS3ItemInput>

Example:

const newItem = await rss3.item.patch({
    title: 'Hi RSS3',
});

Links

links.get

links.get(fileID: string): Promise<RSS3Links[]>;
links.get(fileID: string, type: string): Promise<RSS3Links>;

Example:

const following = await rss3.links.get(rss3.account.address, 'following');

links.post

links.post(links: RSS3LinksInput): Promise<RSS3Links>

Example:

const following = await rss3.links.post({
    type: 'following',
    list: ['0xd0B85A7bB6B602f63B020256654cBE73A753DFC4'],
});

links.delete

links.delete(type: string): Promise<RSS3Links>

Example:

const following = await rss3.links.delete('following');

links.patch

links.patch(links: RSS3LinksInput): Promise<RSS3Links>

Example:

const following = await rss3.links.patch({
    type: 'following',
    tags: ['test'],
    list: ['0xd0B85A7bB6B602f63B020256654cBE73A753DFC4', '0xC8b960D09C0078c18Dcbe7eB9AB9d816BcCa8944'],
});

Link

link.post

link.post(type: string, personaID: string): Promise<RSS3Links>

Example:

const following = await rss3.link.post('following', '0xd0B85A7bB6B602f63B020256654cBE73A753DFC4');

link.delete

link.delete(type: string, personaID: string): Promise<RSS3Links>

Example:

const following = await rss3.link.delete('following', '0xd0B85A7bB6B602f63B020256654cBE73A753DFC4');

Backlinks

backlinks.get

backlinks.get(personaID?: string): Promise<RSS3Backlink[]>
backlinks.get(personaID: string, type: string): Promise<string[]>

Example:

const followers = await rss3.backlinks.get(rss3.account.address, 'following');

Accounts

accounts.post

accounts.post(account: RSS3Account): Promise<RSS3Account>

Example:

const account = await rss3.accounts.post(account);

accounts.delete

accounts.delete(account: {
    platform: string;
    identity: string;
}): Promise<RSS3Account>

Example:

const account = await rss3.accounts.delete(account);

accounts.getSigMessage

accounts.getSigMessage(account): string;

Example:

const sigMessage = await rss3.accounts.getSigMessage(account);

Assets

assets.patchTags

assets.patchTags(asset: RSS3Asset, tags: string[]): Promise<RSS3Asset>

Example:

const account = await rss3.ssets.patchTags(asset, tags);