-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
152 changed files
with
7,767 additions
and
439 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import React, { useContext, useEffect, useState } from 'react'; | ||
import { ChatAndNotificationWidget, PUSH_TABS } from '@pushprotocol/uiweb'; | ||
import { EnvContext, Web3Context } from './context'; | ||
import * as PushAPI from '@pushprotocol/restapi'; | ||
import { IUser } from '@pushprotocol/restapi'; | ||
|
||
|
||
|
||
|
||
export const ChatWidgetTest = () => { | ||
|
||
const { account, library } = useContext<any>(Web3Context); | ||
const librarySigner = library.getSigner(); | ||
const [pvtKey,setPvtKey] = useState<string>(''); | ||
const {env} = useContext<any>(EnvContext); | ||
|
||
useEffect(()=>{ | ||
(async()=>{ | ||
const user = await PushAPI.user.get({ account: account, env }); | ||
const pvtkey = null; | ||
console.log(user) | ||
if (user?.encryptedPrivateKey) { | ||
const response = await PushAPI.chat.decryptPGPKey({ | ||
encryptedPGPPrivateKey: (user as IUser).encryptedPrivateKey, | ||
account: account, | ||
signer: librarySigner, | ||
env, | ||
toUpgrade: true, | ||
}); | ||
setPvtKey(response) | ||
} | ||
})(); | ||
|
||
},[account,env]) | ||
const onClose = () => { | ||
console.log('in here widget') | ||
}; | ||
return ( | ||
<ChatAndNotificationWidget | ||
account={account} | ||
env={env} | ||
decryptedPgpPvtKey={pvtKey} | ||
signer={librarySigner} | ||
// activeTab={PUSH_TABS.APP_NOTIFICATIONS} | ||
activeChat='0x3Cf13f6d91F50dca6eAD7356b78482c54CDd95ff' | ||
/> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<h1 align="center"> | ||
<a href="https://push.org/#gh-light-mode-only"> | ||
<img width='20%' height='10%' src="https://res.cloudinary.com/drdjegqln/image/upload/v1686227557/Push-Logo-Standard-Dark_xap7z5.png"> | ||
</a> | ||
<a href="https://push.org/#gh-dark-mode-only"> | ||
<img width='20%' height='10%' src="https://res.cloudinary.com/drdjegqln/image/upload/v1686227558/Push-Logo-Standard-White_dlvapc.png"> | ||
</a> | ||
</h1> | ||
|
||
<p align="center"> | ||
<i align="center">Push Protocol is a web3 communication network, enabling cross-chain notifications, messaging, video, and NFT chat for dapps, wallets, and services.🚀</i> | ||
</p> | ||
|
||
# Welcome to Push SDK Examples! | ||
This repository houses various practical examples that illustrate how to use the Push SDK effectively to enhance your applications with advanced web3 communication functionalities. | ||
|
||
## One-Stop Solution for Understanding the Implementation of Push Protocol's SDK | ||
|
||
The `push-sdk` repository provides two comprehensive examples that serve as practical guides for developers: | ||
|
||
1. `sdk-backend-node`: A backend implementation using Node.js. | ||
2. `sdk-frontend/video`: A frontend implementation focusing on video notifications. | ||
|
||
These examples illuminate the application of the Push Protocol in real-world scenarios, making it easier for you to effectively incorporate it into your own projects. | ||
|
||
They are the perfect starting point for any hacker looking to dive into the world of decentralized notifications. Explore, learn, and create with the Push Protocol. Happy hacking! | ||
|
||
# Docs | ||
- [Developer Docs](https://docs.push.org/developers) | ||
- [Documentation Hub](https://docs.push.org) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# SDK Backend Node Example | ||
|
||
Welcome to the SDK Backend Node Example project, a hands-on guide demonstrating how to leverage the power of Push Protocol in a backend environment using Node.js. This resource is an invaluable companion for developers keen to integrate Push Protocol into their backend services. Dive into the code to gain a comprehensive understanding of how to deploy various features of the Push Protocol in a Node.js backend. | ||
|
||
## Overview | ||
|
||
The `sdk-backend-node` project offers a practical tutorial on how to set up and configure Push Protocol on a server, including guidance on managing notifications and interfacing with the blockchain. This includes essential examples related to: | ||
|
||
- Push Notifications | ||
- Push Chat | ||
- Push NFT Chat | ||
- Push Video | ||
|
||
Through these examples, you'll see how these features can be successfully implemented and integrated using Push Protocol. | ||
|
||
## Getting Started | ||
|
||
Embark on your journey with this project by cloning the repository and installing the dependencies: | ||
|
||
```bash | ||
git clone https://github.com/ethereum-push-notification-service/push-sdk.git | ||
cd push-sdk | ||
yarn install | ||
``` | ||
***Note*** - We are using `yarn` and **strongly** advise to use yarn 1.x to avoid any NPM issues. | ||
|
||
## Setting up the SDK-Backend-Node | ||
1. Navigate to the `packages/examples/sdk-backend-node` directory. | ||
2. Set up your environment variables by creating a `.env` file based on the provided `.env.sample` file. | ||
|
||
## Running the SDK-Backend-Node | ||
### By GUI (preferred) | ||
1. Click on the `NX console` extension icon in the VSCode sidebar. | ||
2. Click on the `serve` target execute icon under `examples-sdk-backend-node` | ||
|
||
### By CLI | ||
1. Navigate to the root level of push-sdk repository. | ||
2. Run `yarn nx serve packages/examples/sdk-backend-node` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.