Skip to content

Commit

Permalink
fix: fixed some bugs and rebased main
Browse files Browse the repository at this point in the history
  • Loading branch information
akp111 committed May 22, 2024
2 parents c81e315 + 836e5c1 commit c8171d0
Show file tree
Hide file tree
Showing 215 changed files with 48,602 additions and 34,825 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

# dependencies
node_modules
.yarn

# IDEs and editors
/.idea
Expand Down
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"workbench.activityBar.orientation": "vertical"
"workbench.activityBar.orientation": "vertical",
"editor.formatOnSave": true
}
1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## Repo Setup

```
git clone https://github.com/ethereum-push-notification-service/push-sdk.git
git clone https://github.com/push-protocol/push-sdk.git
cd sdk
```
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ node main
- **[Docs](https://docs.push.org/developers/)** For comprehensive documentation.
- **[Blog](https://medium.com/push-protocol)** To learn more about our partners, new launches, etc.
- **[Discord](https://discord.com/invite/pushprotocol)** for support and discussions with the community and the team.
- **[GitHub](https://github.com/ethereum-push-notification-service)** for source code, project board, issues, and pull requests.
- **[GitHub](https://github.com/push-protocol)** for source code, project board, issues, and pull requests.
- **[Twitter](https://twitter.com/pushprotocol)** for the latest updates on the product and published blogs.


Expand All @@ -191,7 +191,7 @@ Push Protocol is an open source Project. We firmly believe in a completely trans
- Documentation Request: If you're reading the Push documentation and believe that we're missing something, please create a docs request.


Read how you can contribute <a href="https://github.com/ethereum-push-notification-service/push-sdk/blob/main/CONTRIBUTING.md
Read how you can contribute <a href="https://github.com/push-protocol/push-sdk/blob/main/CONTRIBUTING.md
">HERE</a>

Not sure where to start? Join our discord and we will help you get started!
Expand All @@ -200,6 +200,6 @@ Not sure where to start? Join our discord and we will help you get started!
<a href="https://discord.com/invite/pushprotocol" title="Join Our Community"><img src="https://www.freepnglogos.com/uploads/discord-logo-png/playerunknown-battlegrounds-bgparty-15.png" width="200" alt="Discord" /></a>

## License
Check out our License <a href='https://github.com/ethereum-push-notification-service/push-sdk/blob/main/license-v1.md'>HERE </a>
Check out our License <a href='https://github.com/push-protocol/push-sdk/blob/main/license-v1.md'>HERE </a>


12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sdk",
"version": "0.0.0",
"version": "1.3.0",
"license": "MIT",
"scripts": {
"prepare": "husky install",
Expand Down Expand Up @@ -56,11 +56,6 @@
"viem": "^1.3.0"
},
"devDependencies": {
"browserify-zlib": "^0.2.0",
"https-browserify": "^1.0.0",
"node-polyfill-webpack-plugin": "^3.0.0",
"stream-browserify": "^3.0.0",
"stream-http": "^3.2.0",
"@commitlint/cli": "^17.0.0",
"@commitlint/config-angular": "^17.0.0",
"@jscutlery/semver": "^2.27.1",
Expand Down Expand Up @@ -101,6 +96,7 @@
"@web3-react/types": "^6.0.7",
"babel-jest": "27.5.1",
"babel-plugin-styled-components": "^1.10.7",
"browserify-zlib": "^0.2.0",
"chai-as-promised": "^7.1.1",
"commitizen": "^4.2.5",
"cz-conventional-changelog": "^3.3.0",
Expand All @@ -110,20 +106,24 @@
"eslint-plugin-jsx-a11y": "^6.5.1",
"eslint-plugin-react": "^7.29.4",
"eslint-plugin-react-hooks": "^4.5.0",
"https-browserify": "^1.0.0",
"husky": "^8.0.0",
"jest": "27.5.1",
"jest-react-native": "18.0.0",
"metro": "0.70.2",
"metro-babel-register": "0.70.2",
"metro-react-native-babel-preset": "0.70.2",
"metro-resolver": "0.70.2",
"node-polyfill-webpack-plugin": "^3.0.0",
"nx": "14.1.7",
"patch-package": "^6.4.7",
"prettier": "^2.5.1",
"react-native-config": "1.4.5",
"react-native-svg": "12.3.0",
"react-native-svg-transformer": "1.0.0",
"react-test-renderer": "17.0.2",
"stream-browserify": "^3.0.0",
"stream-http": "^3.2.0",
"ts-jest": "27.1.4",
"ts-node": "9.1.1",
"typescript": "5.0.2"
Expand Down
23 changes: 20 additions & 3 deletions packages/examples/boilerplate/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
import { CONSTANTS, PushAPI } from '@pushprotocol/restapi';
import { ethers } from 'ethers';
import input from 'input';

console.log("Hello... what's my purpose?")
console.log("To train all the hackers..")
// Creating a random signer from a wallet, ideally this is the wallet you will connect
const signerAlice = ethers.Wallet.createRandom();

// Initialize wallet user, pass 'prod' instead of 'staging' for mainnet apps
const userAlice = await PushAPI.initialize(signerAlice, {
env: CONSTANTS.ENV.PROD,
});
const userBobAddress = '0x60cD05eb31cc16cC37163D514bEF162406d482e1';

const generateRandomWordsWithTimestamp = () => {
return `${Math.random()
.toString(36)
.substring(2)} - ${new Date().toISOString()}`;
};

userAlice.chat.send(userBobAddress, {
content: "Gm gm! It's a me... Alice! - " + generateRandomWordsWithTimestamp(),
});

console.log('Message sent from Alice to ', userBobAddress);
2 changes: 1 addition & 1 deletion packages/examples/boilerplate/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"author": "",
"license": "ISC",
"dependencies": {
"@pushprotocol/restapi": "latest",
"@pushprotocol/restapi": "1.7.11",
"ethers": "5.7.2",
"input": "1.0.1"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/sdk-backend-node/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Through these examples, you'll see how these features can be successfully implem
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
git clone https://github.com/push-protocol/push-sdk.git
cd push-sdk
yarn install
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export const runNotificaitonsLowLevelUseCases = async (): Promise<void> => {
await PushAPI_channels_unsubscribe();

// IMPORTANT: VARIOUS OTHER NOTIFICATIONS FORMAT SUPPORTED
// EXAMPLES HERE: https://github.com/ethereum-push-notification-service/push-sdk/blob/main/packages/restapi/README.md
// EXAMPLES HERE: https://github.com/push-protocol/push-sdk/blob/main/packages/restapi/README.md
console.log(
'PushAPI.payloads.sendNotification() [Direct Payload, Single Recipient]'
);
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/sdk-frontend-react/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Through these examples, you'll see how these features can be successfully implem
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
git clone https://github.com/push-protocol/push-sdk.git
cd push-sdk
yarn install
```
Expand Down
40 changes: 32 additions & 8 deletions packages/examples/sdk-frontend-react/src/app/ChatSupportTest.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useContext } from 'react';
import { Web3Provider } from '@ethersproject/providers';
import { SupportChat, ITheme } from '@pushprotocol/uiweb';
import { SupportChat, ITheme, ChatWidget } from '@pushprotocol/uiweb';
import { lightTheme } from '@pushprotocol/uiweb';
import { EnvContext, Web3Context } from './context';

Expand Down Expand Up @@ -32,13 +32,37 @@ export const ChatSupportTest = () => {

return (
//works as Chat as well as Support Chat
<SupportChat

signer={librarySigner}
supportAddress="4ac5ab85c9c3d57adbdf2dba79357e56b2f9ef0256befe750d9f93af78d2ca68"
env={env}
greetingMsg="How can i help you?"
theme={lightTheme}
<ChatWidget
key={'460336a9fa83112c95894af5471cd2b1091290a11298d87ec824ed74b7c14974'}
chatId="4ac5ab85c9c3d57adbdf2dba79357e56b2f9ef0256befe750d9f93af78d2ca68"
welcomeComponent={
<div
style={{
display: 'flex',
flexDirection: 'column',
border: '1px solid black',
overflow: 'auto',
height: '100%',
width: '100%',
}}
>
<p>Welcome</p>
<p>new chat</p>
<p>Welcome</p>
<p>new chat</p>
<p>Welcome</p>
<p>new chat</p>
<p>Welcome</p>
</div>
}
/>
// <SupportChat

// signer={librarySigner}
// supportAddress="4ac5ab85c9c3d57adbdf2dba79357e56b2f9ef0256befe750d9f93af78d2ca68"
// env={env}
// greetingMsg="How can i help you?"
// theme={lightTheme}
// />
);
};

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import { ChatProfile } from "@pushprotocol/uiweb";
import { ChatProfile } from '@pushprotocol/uiweb';

export const ChatProfileTest = () => {

return (
<div>
<ChatProfile
chatProfileLeftHelperComponent={<div>left component</div>}
chatProfileRightHelperComponent={<div>right component</div>}
chatId='monalisha.wallet'
// chatId='d9c2d6fa7132d49ea6d1b570f0ebd2bcc45c1ecac726eab993ad91c574fbe3c6'
/>
</div>
)
}
return (
<div>
<ChatProfile
chatProfileLeftHelperComponent={<div>left component</div>}
chatProfileRightHelperComponent={<div>right component</div>}
chatId="monalisha.wallet"
// chatId='36baf37e441fdd94e23406c6c716fc4e91a93a9ee68e070cd5b054534dbe09a6'
/>
</div>
);
};
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import styled from 'styled-components';

import { ChatView, CreateGroupModal, MODAL_BACKGROUND_TYPE, MODAL_POSITION_TYPE, UserProfile } from "@pushprotocol/uiweb";
import {
ChatView,
CreateGroupModal,
MODAL_BACKGROUND_TYPE,
MODAL_POSITION_TYPE,
UserProfile,
} from '@pushprotocol/uiweb';
import { Section } from '../components/StyledComponents';
import Img from '../../assets/epnsLogo.png';

Expand All @@ -13,22 +19,26 @@ const ChatViewComponentTest = () => {
return (
<div>
<h2>Chat View Test page</h2>

<CreateGroupModal onClose={()=>{console.log('in close')}} />
<ChatViewComponentCard>
{/* <CreateGroupModal onClose={()=>{console.log('in close')}} modalBackground={MODAL_BACKGROUND_TYPE.OVERLAY} modalPositionType={MODAL_POSITION_TYPE.RELATIVE}/> */}
<ChatView
onVerificationFail={() => console.log("Verification Failed")}

chatId='0xf8250D363BD1F25f52F10C21188fe82c68C049c4'
chatProfileLeftHelperComponent={<img src={Img} onClick={()=>console.debug('clicked')}/>}
{/* <CreateGroupModal
onClose={() => {
console.log('in close');
}}
/> */}
<ChatViewComponentCard>
{/* <CreateGroupModal onClose={()=>{console.log('in close')}} modalBackground={MODAL_BACKGROUND_TYPE.OVERLAY} modalPositionType={MODAL_POSITION_TYPE.RELATIVE}/> */}
<ChatView
onVerificationFail={() => console.log('Verification Failed')}
chatId="34c44214589cecc176a136ee1daf0f0231ecc6d6574b920b5ae39eb971fa3cb4"
chatProfileLeftHelperComponent={
<img src={Img} onClick={() => console.debug('clicked')} />
}
chatProfileRightHelperComponent={<div>right component</div>}

limit={10}
isConnected={true}
isConnected={true}
groupInfoModalBackground={MODAL_BACKGROUND_TYPE.OVERLAY}
groupInfoModalPositionType={MODAL_POSITION_TYPE.RELATIVE}
verificationFailModalPosition={MODAL_POSITION_TYPE.RELATIVE}
// groupInfoModalPositionType={MODAL_POSITION_TYPE.RELATIVE}
// verificationFailModalPosition={MODAL_POSITION_TYPE.RELATIVE}

// welcomeComponent={<div style={{display: "flex",flexDirection:'column',border:'1px solid black'}}>
// <p>Welcome</p>
Expand All @@ -39,20 +49,18 @@ const ChatViewComponentTest = () => {
// <p>new chat</p>
// <p>Welcome</p>


// </div>}

/>
/>
</ChatViewComponentCard>
</div>
);
}
};

export default ChatViewComponentTest;

const ChatViewComponentCard = styled(Section)`
height: 80vh;
position:relative;
position: relative;
`;
//c2d544ad9d1efd5c5a593b143bf8232875c926cf28015564e70ad078b95f807e
//4ac5ab85c9c3d57adbdf2dba79357e56b2f9ef0256befe750d9f93af78d2ca68
13 changes: 8 additions & 5 deletions packages/examples/sdk-frontend-react/src/app/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ export function App() {
const user = await PushApi.user.get({ account: account, env });
let pgpPrivateKey;
const librarySigner = await library.getSigner(account);
const pushUser = await PushAPI.initialize(librarySigner!, {
const pushUser = await PushAPI.initialize({
env: env,
account: account,
alpha: { feature: ['SCALABILITY_V2'] },
Expand Down Expand Up @@ -339,13 +339,13 @@ export function App() {
<Web3Context.Provider value={{ account, active, library, chainId }}>
<SocketContext.Provider value={socketData}>
<AccountContext.Provider value={{ pgpPrivateKey, setSpaceId }}>
<WidgetUIProvider

>
<WidgetUIProvider>
<ChatUIProvider
env={env}
theme={darkChatTheme}
signer={signer}
// user={pushUser}
debug={true}
>
<SpacesUIProvider spaceUI={spaceUI} theme={customDarkTheme}>
<Routes>
Expand Down Expand Up @@ -410,7 +410,10 @@ export function App() {
element={<SecretNotificationsTest />}
/>
<Route path="/channels" element={<ChannelsTest />} />
<Route path="/listchannels" element={<ListChannelsTest />} />
<Route
path="/listchannels"
element={<ListChannelsTest />}
/>
<Route path="/alias" element={<AliasTest />} />
<Route
path="/delegations"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const NETWORK_MAPPING: NwMappingType = {
97: 'BSC_TESTNET',
11155420: 'OPTIMISM_TESTNET',
10: 'OPTIMISM_MAINNET',
1442: 'POLYGON_ZK_EVM_TESTNET',
2442: 'POLYGON_ZK_EVM_TESTNET',
1101: 'POLYGON_ZK_EVM_MAINNET',
421614: 'ARBITRUM_TESTNET',
42161: 'ARBITRUMONE_MAINNET',
Expand All @@ -26,12 +26,14 @@ const NETWORK_MAPPING: NwMappingType = {
80085: 'BERACHAIN_TESTNET',
59141: 'LINEA_TESTNET',
59144: 'LINEA_MAINNET',
111557560: 'CYBER_CONNECT_TESTNET',
7560: 'CYBER_CONNECT_MAINNET'
};

const injected = new InjectedConnector({
supportedChainIds: [
1, 3, 4, 11155111, 42, 137, 80002, 56, 97, 10, 11155420, 1442, 1101, 421614,
42161, 122, 123, 80085, 59144, 59141,
1, 3, 4, 11155111, 42, 137, 80002, 56, 97, 10, 11155420, 2442, 1101, 421614,
42161, 122, 123, 80085, 59144, 59141, 111557560, 7560
],
});

Expand Down
Loading

0 comments on commit c8171d0

Please sign in to comment.