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

@cyberlab/cyberconnect-v2

v0.0.1-alpha.21

Published

CyberConnect official v2 SDK

Downloads

22

Readme

CyberConnect V2

Getting started

Installation

npm install @cyberlab/cyberconnect-v2
or
yarn add @cyberlab/cyberconnect-v2

Basic usage

Init CyberConnect

import CyberConnect, {
  Env
} from '@cyberlab/cyberconnect-v2';

const cyberConnect = new CyberConnect({
  appId: 'cyberconnect',
  namespace: 'CyberConnect',
  env: Env.Production,
  provider: provider,
  signingMessageEntity: 'CyberConnect' || your entity,
});
  • appId - Your application id, can be any string less than 128 characters.
  • namespace - Your applciation name.
  • env - (optional) Env decides the endpoints. Now we have staging and production. (The default value is Env.Production).
  • provider - The corresponding provider of the given chain.
  • signingMessageEntity - (optional) Use to describe the entity users sign their message with. Users will see it when authorizing in the wallet I authorize ${signingMessageEntity} from this device using signing key:. The default entity is CyberConnect.

Follow

cyberConnect.follow(handle);
  • handle - The ccProfile handle to follow.

Unfollow

cyberConnect.unfollow(handle);
  • handle - The ccProfile handle to unfollow.

Like content

cyberConnect.like(id);

Parameters

  • id: string - The content id to like which can the id of a post, comment or an essence.

Return

  • response: LikeResponse - like response
type LikeResponse = {
  status: Status;
};

enum Status {
  SUCCESS,
  INVALID_PARAMS,
  RATE_LIMITED,
  TARGET_NOT_FOUND,
  ALREADY_DONE,
  INVALID_MESSAGE,
  INVALID_SIGNATURE,
  MESSAGE_EXPIRED,
}

Dislike content

cyberConnect.dislike(id);

Parameters

  • id: string - The content id to dislike which can the id of a post, comment or an essence.

Return

  • response: DislikeResponse - dislike response
type DislikeResponse = {
  tsInServer: number;
  status: Status;
};

enum Status {
  SUCCESS,
  INVALID_PARAMS,
  RATE_LIMITED,
  TARGET_NOT_FOUND,
  ALREADY_DONE,
  INVALID_MESSAGE,
  INVALID_SIGNATURE,
  MESSAGE_EXPIRED,
}

Cancel reaction

cyberConnect.cancelReaction(id);

Parameters

  • id: string - The content id to cancel reaction on which can the id of a post, comment or an essence.

Return

  • response: CancelReactionResponse - cancel reaction response
type CancelReactionResponse = {
  status: Status;
};

enum Status {
  SUCCESS,
  INVALID_PARAMS,
  RATE_LIMITED,
  TARGET_NOT_FOUND,
  ALREADY_DONE,
  INVALID_MESSAGE,
  INVALID_SIGNATURE,
  MESSAGE_EXPIRED,
}

Creating post

cyberConnect.createPost(content);

Parameters

  • content: Content - post content
interface Content {
  title: string;
  body: string;
  author: string; // The ccProfile handle of the author
}

Return

  • response: PublishResponse - publish response
type PublishResponse = {
  status: Status;
  contentID: string;
  arweaveTxHash: string;
  tsInServer: number;
};

enum Status {
  SUCCESS,
  INVALID_PARAMS,
  RATE_LIMITED,
  HANDLE_NOT_FOUND,
  CONTENT_NOT_FOUND,
  TARGET_NOT_FOUND,
  NOT_PROFILE_OWNER,
  ALREADY_EXISTED,
  INVALID_MESSAGE,
  INVALID_SIGNATURE,
  MESSAGE_EXPIRED,
  INVALID_SIGNING_KEY,
}

Updating post

cyberConnect.updatePost(id, content);

Parameters

  • id: string - published post id
  • content: Content - new post content
interface Content {
  title: string;
  body: string;
  author: string; // The ccProfile handle of the author
}

Return

  • response: PublishResponse - publish response
type PublishResponse = {
  status: Status;
  contentID: string;
  arweaveTxHash: string;
  tsInServer: number;
};

enum Status {
  SUCCESS,
  INVALID_PARAMS,
  RATE_LIMITED,
  HANDLE_NOT_FOUND,
  CONTENT_NOT_FOUND,
  TARGET_NOT_FOUND,
  NOT_PROFILE_OWNER,
  ALREADY_EXISTED,
  INVALID_MESSAGE,
  INVALID_SIGNATURE,
  MESSAGE_EXPIRED,
  INVALID_SIGNING_KEY,
}

Creating comment

cyberConnect.createComment(targetContentId, content);

Parameters

  • targetContentId: string - target content id to comment on, which can be a post, an essence or a comment

  • content: Content - comment content

interface Content {
  title: string;
  body: string;
  author: string; // The ccProfile handle of the author
}

Return

  • response: PublishResponse - publish response
type PublishResponse = {
  status: Status;
  contentID: string;
  arweaveTxHash: string;
  tsInServer: number;
};

enum Status {
  SUCCESS,
  INVALID_PARAMS,
  RATE_LIMITED,
  HANDLE_NOT_FOUND,
  CONTENT_NOT_FOUND,
  TARGET_NOT_FOUND,
  NOT_PROFILE_OWNER,
  ALREADY_EXISTED,
  INVALID_MESSAGE,
  INVALID_SIGNATURE,
  MESSAGE_EXPIRED,
  INVALID_SIGNING_KEY,
}

Updating comment

cyberConnect.updateComment(commentId,, targetContentId, content);

Parameters

  • commentId: string - comment id to update
  • targetContentId: string - target content id to comment on, which can be a post, an essence or a comment
  • content: Content - new comment content
interface Content {
  title: string;
  body: string;
  author: string; // The ccProfile handle of the author
}

Return

  • response: PublishResponse - publish response
type PublishResponse = {
  status: Status;
  contentID: string;
  arweaveTxHash: string;
  tsInServer: number;
};

enum Status {
  SUCCESS,
  INVALID_PARAMS,
  RATE_LIMITED,
  HANDLE_NOT_FOUND,
  CONTENT_NOT_FOUND,
  TARGET_NOT_FOUND,
  NOT_PROFILE_OWNER,
  ALREADY_EXISTED,
  INVALID_MESSAGE,
  INVALID_SIGNATURE,
  MESSAGE_EXPIRED,
  INVALID_SIGNING_KEY,
}

Verify the proof

After creating or updating a post successfully, you can use arweaveTxHash to verify the proof, go to https://arweave.net/ + arweaveTxHash.

Contributing

We are happy to accept small and large contributions, feel free to make a suggestion or submit a pull request.