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

o2oprotocol

v0.0.25

Published

Smart Contracts (listing, purchase, controller) without directly interfacing with the Blockchain or IPFS.

Downloads

29

Readme

O2OProtocol JS Documentation

Introduction

Welcome to the o2oprotocol.js documentation! o2oprotocol.js is a Javascript library for interacting with the O2O Protocol. Using the library you can create new listings from your applications, purchase them, or update them from your own off-chain applications.

More information can be found at O2OProtocol Platform Readme

Warning

This is still an alpha version which will evolve significantly before the main net release.

Install

NPM

npm install o2oprotocol --save

Yarn

yarn add o2oprotocol

Local

For developing on o2oprotocol.js, it is better to link the package rather than installing it. (Otherwise you would need to run npm build everytime you made a change to the package.)

In the directory ./packages/contracts/ run:

truffle compile

This will create the .json files for our solidity contracts.

In the directory ./packages/o2oprotocol.js run:

npm link

Now change tabs (or diectories) to the repo for your DApp (for example, the O2OProtocol eServices) run:

npm link o2oprotocol

This will create a symlink, direcly linking the dapp to your local o2oprotocol.js package.

Next, you will need to start your local development blockchain.

In the directory ./packages/contracts/ run:

truffle develop

Then in the console run:

migrate --reset

Import

import { contractService, ipfsService, o2oService } from 'o2oprotocol'

IPFS

If you are running a local IPFS daemon then set the following environment variables:

export IPFS_DOMAIN=127.0.0.1
export IPFS_API_PORT=5001
export IPFS_GATEWAY_PORT=8080
export IPFS_GATEWAY_PROTOCOL=http

Configure your local IPFS daemon with the following settings to avoid CORS errors:

ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["localhost:*"]'
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods '["GET", "POST", "PUT"]'
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Credentials '["true"]'

Troubleshooting

Python 3

If you have Python 3 installed, you may see this error when installing dependencies:

gyp ERR! stack Error: Python executable "/Users/aiham/.pyenv/shims/python" is v3.6.4, which is not supported by gyp.

Resolve this by configuring npm to use Python 2 (where python2.7 is a binary accessible from your $PATH):

npm config set python python2.7

Tests

When you begin developing, run npm test and keep it running while you develop.

View test results in your browser (with MetaMask installed and setup) at http://localhost:8081

Tests are automatically rerun when source or test code is changed.

Run a subset of tests using the grep query string parameter, for example: http://localhost:8081/?grep=IpfsService

Documentation

Needed