Skip to content

Gbogboade1/push-sdk

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PUSH-SDK

PUSH SDK is a Javascript based Monorepo of packages that helps developers to

  • build PUSH features into their DApps
  • get access to PUSH Push Nodes APIs
  • render PUSH Notifications UI

without having to write a lot of boilerplate code. All the heavy lifting is done by the SDK, so that you the developer can focus on building features and bootstrap a DApp with PUSH features in no time!

The SDK provides a suite of solutions for different problems. It is written in Typescript and supports React, React Native, Plain JS, Node JS based platforms. (We are adding support for more!)

It is also built on top of standard Web3 packages like ethers, @web3-react

Packages available

Click on the packages to view more details.

Sample Usage

How to use a package from the SDK?

Let's take @pushprotocol/restapi as an example.

Open a teminal and enter

mkdir sdk-quickstart
cd sdk-quickstart

# at sdk-quickstart, hit enter for all if no change from default intended
yarn init 

# or NPM
npm init

If you want to use ES6 Modules syntax then inside package.json set “type” to “module”.

# install the sdk "restapi" package & its peer dependencies in your app
yarn add @pushprotocol/restapi ethers

# or NPM
npm install @pushprotocol/restapi ethers
touch main.js

For CommonJS Syntax

// import in main.js
const PushAPI = require("@pushprotocol/restapi");

OR

For ES6 modules Syntax

// import in main.js
import * as PushAPI from "@pushprotocol/restapi";
// use a feature from restapi package,
// here "getFeeds" gets all the notifications for the user address provided
const main = async() => {
  const notifications = await PushAPI.user.getFeeds({
    user: 'eip155:5:0xD8634C39BBFd4033c0d3289C4515275102423681', // user address in CAIP
    env: 'staging'
  });

  // log the notifications 
  console.log('notifications: \n\n', notifications);
}

main();

Then to run this code open terminal and type

node main

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 94.4%
  • Java 2.4%
  • C++ 1.0%
  • Objective-C++ 0.6%
  • JavaScript 0.5%
  • CSS 0.3%
  • Other 0.8%