Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge alpha #547

Merged
merged 20 commits into from
Jul 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
e66ac5c
ci(restapi): 🎉 cut beta release to restapi-v0.0.1-alpha.20
mohammeds1992 Jul 3, 2023
c05d024
fix: Merge branch 'alpha' into alpha-deployment
mohammeds1992 Jul 7, 2023
81d2cc9
ci(restapi): 🎉 cut beta release to restapi-v0.0.1-alpha.21
mohammeds1992 Jul 7, 2023
5c84e2f
fix: Merge branch 'alpha' into alpha-deployment
mohammeds1992 Jul 7, 2023
61d15a7
ci(restapi): 🎉 cut beta release to restapi-v0.0.1-alpha.22
mohammeds1992 Jul 7, 2023
54c5721
fix: Merge branch 'alpha' into alpha-deployment
mohammeds1992 Jul 11, 2023
15cb912
Spaces backend examples (#522)
mohammeds1992 Jul 11, 2023
f29df59
test: added autoleave tcs (#525)
Aman035 Jul 11, 2023
e7f2d30
Spaces SDK alpha publish (#520)
madhur-push Jul 11, 2023
7b316ec
fix: Merge branch 'main' into alpha
mohammeds1992 Jul 11, 2023
ccdf532
fix: fix unable to decrypt case (#527)
Aman035 Jul 11, 2023
b120e30
fix: Merge branch 'alpha' into alpha-deployment
mohammeds1992 Jul 12, 2023
7893196
ci(restapi): 🎉 cut beta release to restapi-v0.0.1-alpha.23
mohammeds1992 Jul 12, 2023
7255aed
Update README.md
mohammeds1992 Jul 12, 2023
b069298
Feat/notification theme (#524)
mishramonalisha76 Jul 13, 2023
899eb21
fix: rename chats to spaces
mohammeds1992 Jul 14, 2023
27c42b9
fix: spaces examples fixes
mohammeds1992 Jul 15, 2023
3519d39
fix: renamed spaces variables and removed some unused variables
mohammeds1992 Jul 16, 2023
d7e2cde
Update README.md
mohammeds1992 Jul 17, 2023
02447e2
chore(spaces): merge branch 'origin/alpha' into feat/spaces-implement…
madhur-push Jul 17, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 23 additions & 14 deletions packages/examples/sdk-backend-node/src/spaces/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export const runSpacesUseCases = async (): Promise < void > => {
╚════██║██╔═══╝ ██╔══██║██║ ██╔══╝ ╚════██║
███████║██║ ██║ ██║╚██████╗███████╗███████║
╚══════╝╚═╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝╚══════╝

`)

console.log('PushAPI.user.create');
Expand Down Expand Up @@ -136,18 +136,22 @@ async function PushAPI_space_create(
signer: signer,
});

const now = new Date();
const start = new Date(now.getTime() + 10 * 60000)
const end = new Date(now.getTime() + 60 * 60000);

const response = await PushAPI.space.create({
spaceName,
spaceDescription,
members: [`eip155:${randomWallet1}`, `eip155:${randomWallet2}`],
listeners: [`eip155:${randomWallet1}`, `eip155:${randomWallet2}`],
spaceImage,
admins: [],
speakers: [],
isPublic: true,
signer: signer,
pgpPrivateKey: pgpDecrpyptedPvtKey,
env: env as ENV,
scheduleAt: new Date("2023-07-15T14:48:00.000Z"),
scheduleEnd: new Date("2023-07-15T15:48:00.000Z")
scheduleAt: start,
scheduleEnd: end
});
console.log('PushAPI_chat_createSpace | Response - 200 OK');
if (!silent) {
Expand All @@ -174,6 +178,11 @@ async function PushAPI_space_update(
signer: signer,
});

const now = new Date();
const start = new Date(now.getTime() + 10 * 60000)
const end = new Date(now.getTime() + 60 * 60000);


// Actual API
// Convert image to base 64 and pass
// This is an idempotent operation, meaning it requires all space info to be passed no matter if only few things change
Expand All @@ -182,16 +191,16 @@ async function PushAPI_space_update(
spaceId,
spaceName,
spaceDescription,
members: [
listeners: [
`eip155:${randomWallet1}`,
`eip155:${randomWallet2}`,
`eip155:${randomWallet3}`,
`eip155:${signer.address}`,
],
spaceImage,
admins: [`eip155:${signer.address}`], // takes signer as admin automatically, add more if you want to
scheduleAt: new Date("2023-07-15T14:48:00.000Z"),
scheduleEnd: new Date("2023-07-15T15:48:00.000Z"),
speakers: [`eip155:${signer.address}`], // takes signer as admin automatically, add more if you want to
scheduleAt: start,
scheduleEnd: end,
status: PushAPI.ChatStatus.PENDING,
signer: signer,
pgpPrivateKey: pgpDecrpyptedPvtKey,
Expand Down Expand Up @@ -246,9 +255,9 @@ async function PushAPI_space_start_and_stop(
dictionaries: [adjectives, colors, animals],
}),
spaceDescription,
members: [`eip155:${randomWallet1}`, `eip155:${randomWallet2}`],
listeners: [`eip155:${randomWallet1}`, `eip155:${randomWallet2}`],
spaceImage,
admins: [],
speakers: [],
isPublic: true,
signer: signer,
pgpPrivateKey: pgpDecrpyptedPvtKey,
Expand Down Expand Up @@ -314,9 +323,9 @@ async function PushAPI_space_approve(
dictionaries: [adjectives, colors, animals],
}),
spaceDescription,
members: [`eip155:${randomWallet1}`, `eip155:${randomWallet2}`],
listeners: [`eip155:${randomWallet1}`, `eip155:${randomWallet2}`],
spaceImage,
admins: [],
speakers: [],
isPublic: true,
signer: signer,
pgpPrivateKey: pgpDecrpyptedPvtKey,
Expand Down Expand Up @@ -612,4 +621,4 @@ async function PushAPI_space_trending(silent = !showAPIResponse) {
if (!silent) {
console.log(response);
}
}
}
18 changes: 9 additions & 9 deletions packages/examples/sdk-frontend/pages/spaces/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ import Link from 'next/link';
import { useSpaceComponents } from './../../components/Spaces/useSpaceComponent';
import { useContext, useEffect, useState } from 'react';
import { useAccount, useSigner } from 'wagmi';
import * as PushAPI from "@pushprotocol/restapi";
import * as PushAPI from '@pushprotocol/restapi';
import { ENV } from '@pushprotocol/restapi/src/lib/constants';
import { AccountContext } from '../../contexts';

const Spaces: NextPage = () => {
const { address } = useAccount();
const { data: signer } = useSigner();

const {pgpPrivateKey, setPgpPrivateKey} = useContext<any>(AccountContext);
const { pgpPrivateKey, setPgpPrivateKey } = useContext<any>(AccountContext);
const { SpaceWidgetComponent } = useSpaceComponents();
const env = ENV.DEV;

Expand Down Expand Up @@ -70,10 +70,10 @@ const Spaces: NextPage = () => {
export default Spaces;

const Section = styled.div`
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
gap: 20px;
wrap: wrap;
}`;
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
gap: 20px;
flex-wrap: wrap;
`;
Loading