New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

near-social-local-viewer

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

near-social-local-viewer

A CLI tool that allows you to run and test your Near Social Widgets locally using just your preferred code editor and your default browser.

  • 2.1.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

NEAR Social Bridge Logo NEAR Social Local Viewer

Build Status Version Downloads

A CLI tool that allows you to run and test your Near Social Widgets locally using just your preferred code editor and your default browser.

Tool intended only for Widgets that will run within Near Social

Check out an example project using this tool here.

Node: 16.10.0

Install it using npm or yarn:

# npm
npm install near-social-local-viewer --save-dev

# yarn
yarn add near-social-local-viewer -D

Starting the Viewer

You can start by running the following command:

# mainnet
npx init-viewer path/to/widgets/

# testnet
npx init-viewer path/to/widgets/ --testnet

The Viewer is going to open automatically and watch all the widgets inside path/to/widgets/ folder.

Changing the Viewer PORT

You can change the viewer port:

VIEWER_PORT=3005 npx init-viewer path/to/widgets/

Widgets example

Below is an example of 2 widgets with interactions:

UserNameAccountView

const userName = props.name;
const userAccoundId = props.accountId;

return (
  <div>
    <span>{userName}</span> <span>(@{userAccoundId})</span>
  </div>
);

ProfileView

const IPFS_NEAR_SOCIAL_THUMBNAIL_URL =
  "https://i.near.social/thumbnail/https://ipfs.near.social/ipfs/";

const accountId = context.accountId || "wendersonpires.near";
const profile = socialGetr(`${accountId}/profile`);
const profileImage = `${IPFS_NEAR_SOCIAL_THUMBNAIL_URL}${profile.image.ipfs_cid}`;

return (
  <div>
    <img src={profileImage} alt="profile avatar" />
    {/* Using another local or remote widget */}
    <Widget
      src="wendersonpires.near/widget/NSLVWidget"
      props={{
        src: "wendersonpires.near/widget/UserNameAccountView",
        srcProps: { name: "Wendz", accountId },
      }}
    />
  </div>
);

Testnet

Use wendersonpires.testnet/widget/NearSocialBridgeCore while creating your application using testnet. E.g.:

const accountId = context.accountId || "wendersonpires.testnet";

return (
  <div>
    <Widget
      src="wendersonpires.testnet/widget/NSLVWidget"
      props={{
        src: "wendersonpires.testnet/widget/UserNameAccountView",
        srcProps: { name: "Wendz", accountId },
      }}
    />
  </div>
);

Good to know

This project was inspired by NearSocial Viewer

Keywords

FAQs

Package last updated on 21 Apr 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc