Skip to content

Commit

Permalink
Group criteria added (#764)
Browse files Browse the repository at this point in the history
* feat: created define criteria and add criteria

* feat: added some more dropdowns in add criteria

* fix: added critera options

* feat: worked on criterias

* Arbitrum changes (#735)

* fix: inital implementation for arbitrum changes

* fix: more changes

* fix: added final changes

* fix: fixed few ui issues

* fix: fixed minor issue

* fix: added operstor

* fix: added dummy 2d data

* fix: fixed test

* feat: condition type added

* feat: adder done

* feat: all/any added on condition box

* fix: minor fixes

* fix: fixed typo

* fix: fixed upload group image ui

* Multiple group criteria (#747)

* fix: fixed multiple criteria Ui

* fix: fixed conditions code

---------

Co-authored-by: KlausMikhaelson <[email protected]>

* docs: added Class Examples (#739)

* docs: added documentation

* docs: fixed chat class examples

* docs: fix notif class

* docs: fixed stream examples

* docs: fix nft grp update

* docs: fixed logs

* Message Type Implementations (#730)

* fix: added video & audio messages

* fix: fixed meta, reaction & added intent & readReceipt

* fix: added reply

* fix: added composite, fixed receipt

* fix: local tests (#744)

* fix(env and index): fixes typo RECIPEINT to RECIPIENT (#743)

fix #733

* Update README.md (#742)

Changed the discord link

* feat: add criteria done

* fix: fixed themes

* feat: rule deletion done

* feat: condition update done

* feat: add criteria update lablel done

* feat: edit rule auto fill done

* feat: pr changes done

* feat: refactor type and hooks

* fix: fixed mobilde view

* fix: fixed scroll

* feat: added icon in groupinfo to show if it is token gated or not (#748)

* feat: added icon in groupinfo to show if it is token gated or not

* fix: fixed minor text

* feat: created group criteria info modal and fixed dropdown

* fix: made changes as per the review

* fix: removed more options from conditions in group info

* fix: fixed minor issues

---------

Co-authored-by: Monalisha Mishra <[email protected]>

* feat: drop down labels

* fix: fixed

* fix: fixed dropdown

* Gp states fix (#763)

* feat: conditions to chat added

* feat: generation of payload done

* refactor: rule generation done

* feat: operator undefined fix

* fix: fixed condition ui

* feat: create group rest api call done

* fix: fixed dropdown

* feat: group detail info fix done

* fix: added validation for guild

---------

Co-authored-by: Abishek Bashyal <[email protected]>

---------

Co-authored-by: KlausMikhaelson <[email protected]>
Co-authored-by: Ashis Kumar Pradhan <[email protected]>
Co-authored-by: Abishek Bashyal <[email protected]>
Co-authored-by: akp111 <[email protected]>
Co-authored-by: Aman Gupta <[email protected]>
Co-authored-by: strykerin <[email protected]>
Co-authored-by: Rahul Pandey <[email protected]>
Co-authored-by: dinesh <[email protected]>
Co-authored-by: Satyam <[email protected]>
  • Loading branch information
10 people authored Oct 10, 2023
1 parent 7252b17 commit 794aa59
Show file tree
Hide file tree
Showing 90 changed files with 5,680 additions and 985 deletions.
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
echo "\nRunning GIT hooks..."
yarn cleanbuild
yarn nx affected --target=lint
# yarn nx affected --target=test
yarn nx affected --target=test
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<h4 align="center">

<a href="discord.gg/pushprotocol">
<a href="https://discord.com/invite/pushprotocol">
<img src="https://img.shields.io/badge/discord-7289da.svg?style=flat-square" alt="discord">
</a>
<a href="https://twitter.com/pushprotocol">
Expand Down Expand Up @@ -177,7 +177,7 @@ node main
- **[Website](https://push.org)** To checkout our Product.
- **[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](discord.gg/pushprotocol)** for support and discussions with the community and the team.
- **[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.
- **[Twitter](https://twitter.com/pushprotocol)** for the latest updates on the product and published blogs.

Expand All @@ -196,7 +196,7 @@ Read how you can contribute <a href="https://github.com/ethereum-push-notificati
Not sure where to start? Join our discord and we will help you get started!


<a href="discord.gg/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>
<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>
Expand Down
4 changes: 2 additions & 2 deletions packages/examples/sdk-backend-node/.env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ VIDEO_CHAIN_ID=your_video_chain_id
# VIDEO SENDER ADDRESS
VIDEO_SENDER_ADDRESS=your_video_sender_address

# VIDEO RECIPEINT ADDRESS
VIDEO_RECIPEINT_ADDRESS=your_video_recipeint_address
# VIDEO RECIPIENT ADDRESS
VIDEO_RECIPIENT_ADDRESS=your_video_recipient_address

# VIDEO CHAT ID
VIDEO_CHAT_ID=your_video_chat_id
4 changes: 2 additions & 2 deletions packages/examples/sdk-backend-node/chat/nftChat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -526,9 +526,9 @@ async function PushAPI_nft_chat_updateGroup(
chatId,
groupName: updatedNftGroupName,
groupDescription,
members: [nftAccount2, nftAccount3],
members: [nftAccount2, nftAccount3, nftAccount1],
groupImage,
admins: [nftAccount2],
admins: [nftAccount1],
account: nftAccount1,
signer: nftSigner1,
pgpPrivateKey: pgpDecrpyptedPvtKey,
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/sdk-backend-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"author": "",
"license": "ISC",
"dependencies": {
"@pushprotocol/restapi": "0.0.1-alpha.39",
"@pushprotocol/restapi": "0.0.1-alpha.44",
"@pushprotocol/socket": "^0.5.2"
}
}
192 changes: 192 additions & 0 deletions packages/examples/sdk-backend-node/pushAPI/channel.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
import { PushAPI } from '@pushprotocol/restapi';
import { config } from '../config';
import { ethers } from 'ethers';

// CONFIGS
const { env, showAPIResponse } = config;

export const runPushAPIChannelCases = async (): Promise<void> => {
if (!process.env.WALLET_PRIVATE_KEY) {
console.log(
'skipping PushAPI.channel examples, no private key passed in .env'
);
return;
}
// -------------------------------------------------------------------
// -------------------------------------------------------------------
// Signer Generation
const provider = new ethers.providers.JsonRpcProvider(
'https://goerli.blockpi.network/v1/rpc/public' // Goerli Provider
);
const signer = new ethers.Wallet(
`0x${process.env.WALLET_PRIVATE_KEY}`,
provider
);
const randomWallet1 = ethers.Wallet.createRandom().address;
const randomWallet2 = ethers.Wallet.createRandom().address;
// -------------------------------------------------------------------
// -------------------------------------------------------------------
const userAlice = await PushAPI.initialize(signer, { env });
// -------------------------------------------------------------------
// -------------------------------------------------------------------
console.log('PushAPI.channel.info');
const channelInfo = await userAlice.channel.info();
if (showAPIResponse) {
console.log(channelInfo);
}
console.log('PushAPI.channel.info | Response - 200 OK\n\n');
// -------------------------------------------------------------------
// -------------------------------------------------------------------
console.log('PushAPI.channel.search');
const searchedChannels = await userAlice.channel.search(
'push' // search by name or address
);
if (showAPIResponse) {
console.log(searchedChannels);
}
console.log('PushAPI.channel.search | Response - 200 OK\n\n');
// -------------------------------------------------------------------
// -------------------------------------------------------------------
console.log('PushAPI.channel.subscribers');
const channelSubscribers = await userAlice.channel.subscribers();
if (showAPIResponse) {
console.log(channelSubscribers);
}
console.log('PushAPI.channel.subscribers | Response - 200 OK\n\n');
// -------------------------------------------------------------------
// -------------------------------------------------------------------
console.log('PushAPI.channel.send');
if (channelInfo) {
const broadcastNotif = await userAlice.channel.send(['*'], {
notification: {
title: 'test',
body: 'test',
},
});
const targetedNotif = await userAlice.channel.send([randomWallet1], {
notification: {
title: 'test',
body: 'test',
},
});
const subsetNotif = await userAlice.channel.send(
[randomWallet1, randomWallet2],
{
notification: {
title: 'test',
body: 'test',
},
}
);
if (showAPIResponse) {
console.log(broadcastNotif, targetedNotif, subsetNotif);
}
console.log('PushAPI.channel.send | Response - 200 OK\n\n');
} else {
console.log(
'skipping PushAPI.channel.send as no channel exists with the signer\n\n'
);
}
// -------------------------------------------------------------------
// -------------------------------------------------------------------
// These Examples requires wallet to hold some ETH & PUSH
const balance = await provider.getBalance(signer.address);
if (parseFloat(ethers.utils.formatEther(balance)) < 0.001) {
console.log(
'skipping PushAPI.channel examples, wallet does not have enough balance to pay fee'
);
}
// -------------------------------------------------------------------
// -------------------------------------------------------------------
console.log('PushAPI.channel.create');
if (channelInfo) {
console.log('skipping PushAPI.channel.create as it already exists\n\n');
} else {
const createdChannel = await userAlice.channel.create({
name: 'Test Channel',
description: 'Test Description',
icon: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAz0lEQVR4AcXBsU0EQQyG0e+saWJ7oACiKYDMEZVs6GgSpC2BIhzRwAS0sgk9HKn3gpFOAv3v3V4/3+4U4Z1q5KTy42Ql940qvFONnFSGmCFmiN2+fj7uCBlihpgh1ngwcvKfwjuVIWaIGWKNB+GdauSk8uNkJfeNKryzYogZYoZY40m5b/wlQ8wQM8TayMlKeKcaOVkJ71QjJyuGmCFmiDUe+HFy4VyEd57hx0mV+0ZliBlihlgL71w4FyMnVXhnZeSkiu93qheuDDFDzBD7BcCyMAOfy204AAAAAElFTkSuQmCC',
url: 'https://push.org',
});
if (showAPIResponse) {
console.log(createdChannel);
}
console.log('PushAPI.channel.create | Response - 200 OK\n\n');
}
// -------------------------------------------------------------------
// -------------------------------------------------------------------
console.log('PushAPI.channel.update');
const updatedChannel = await userAlice.channel.update({
name: 'Updated Name',
description: 'Testing new description',
url: 'https://google.com',
icon: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAz0lEQVR4AcXBsU0EQQyG0e+saWJ7oACiKYDMEZVs6GgSpC2BIhzRwAS0sgk9HKn3gpFOAv3v3V4/3+4U4Z1q5KTy42Ql940qvFONnFSGmCFmiN2+fj7uCBlihpgh1ngwcvKfwjuVIWaIGWKNB+GdauSk8uNkJfeNKryzYogZYoZY40m5b/wlQ8wQM8TayMlKeKcaOVkJ71QjJyuGmCFmiDUe+HFy4VyEd57hx0mV+0ZliBlihlgL71w4FyMnVXhnZeSkiu93qheuDDFDzBD7BcCyMAOfy204AAAAAElFTkSuQmCC',
});
if (showAPIResponse) {
console.log(updatedChannel);
}
console.log('PushAPI.channel.update | Response - 200 OK\n\n');
// -------------------------------------------------------------------
// -------------------------------------------------------------------
console.log('PushAPI.channel.verify');
// only verified channels can verify other channels (otherwise this action is skipped by sdk)
if (channelInfo.verified_status) {
const verifiedTrx = await userAlice.channel.verify(
'0x35B84d6848D16415177c64D64504663b998A6ab4'
);
if (showAPIResponse) {
console.log(verifiedTrx);
}
}
console.log('PushAPI.channel.verify | Response - 200 OK\n\n');
// -------------------------------------------------------------------
// -------------------------------------------------------------------
console.log('PushAPI.channel.setting');
const channelSettingTrx = await userAlice.channel.setting([
{ type: 0, default: 1, description: 'My Notif Settings' },
]);
if (showAPIResponse) {
console.log(channelSettingTrx);
}
console.log('PushAPI.channel.setting | Response - 200 OK\n\n');
// -------------------------------------------------------------------
// -------------------------------------------------------------------
console.log('PushAPI.channel.delegate.add');
const addedDelegate = await userAlice.channel.delegate.add(
`eip155:5:${randomWallet1}`
);

if (showAPIResponse) {
console.log(addedDelegate);
}
console.log('PushAPI.channel.delegate.add | Response - 200 OK\n\n');
// -------------------------------------------------------------------
// -------------------------------------------------------------------
console.log('PushAPI.channel.delegate.get');
const delegates = await userAlice.channel.delegate.get();
if (showAPIResponse) {
console.log(delegates);
}
console.log('PushAPI.channel.delegate.get | Response - 200 OK\n\n');
// -------------------------------------------------------------------
// -------------------------------------------------------------------
console.log('PushAPI.channel.delegate.remove');
const removedDelegate = await userAlice.channel.delegate.remove(
`eip155:5:${randomWallet1}`
);
if (showAPIResponse) {
console.log(removedDelegate);
}
console.log('PushAPI.channel.delegate.remove | Response - 200 OK\n\n');
// -------------------------------------------------------------------
// -------------------------------------------------------------------
console.log('PushAPI.channel.alias.info');
const aliasInfo = await userAlice.channel.alias.info({
alias: '0x35B84d6848D16415177c64D64504663b998A6ab4',
aliasChain: 'POLYGON',
});
if (showAPIResponse) {
console.log(aliasInfo);
}
console.log('PushAPI.channel.alias.info | Response - 200 OK\n\n');
};
Loading

0 comments on commit 794aa59

Please sign in to comment.