0.1.11 • Published 1 year ago

spirals-sprotocol-sdk-react v0.1.11

Weekly downloads
-
License
-
Repository
-
Last release
1 year ago

Spirals Protocol SDK

This SDK allows you to integrate a Spirals Protocol Impact Widget React Component onto your app, displaying the impact metrics of your Spirals project.


Using the SDK

Installation

In order to use the SDK, you can download the package directly from NPM by running:

yarn add spirals-protocol-sdk-react

Usage

Add the Spirals Protocol Impact Widget into your project by importing the React Component into your app, with the address of the project.

import { ImpactWidget } from 'spirals-protocol-sdk-react';

class App extends Component {
  
  constructor() {
    super();
  }

  render() {
      const address = 'insert address of project here';
      return (
        <div className="App">
            <p>Testing Spirals Protocol Impact Badge</p>
            <ImpactWidget address={address}/>
        </div>
      ); 
  }
}

Developing in the SDK

Testing the SDK

You can test this SDK by cloning this repo and running the included quick test react app located within src. After cloning, do the following:

  1. Install the packages
yarn install
  1. Start the app
yarn start

This should open up localhost:3000 where you can see a simple screen with the Impact Widget on the screen.

Publishing

The components of the SDK that get published to NPM are contained within the src/lib so that's the folder where you'll edit the library. As you're developing, you can alter the App.js test react app to import the components from the src/lib folder instead of the published NPM package to test your work. To publish, do the following:

  1. Run the build, which will create a dist folder containing bundled code from the src/lib folder.
npm run build
  1. Publish the package to the NPM registry
npm publish