Skip to content
This repository was archived by the owner on Dec 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
18,960 changes: 10,664 additions & 8,296 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"dependencies": {
"@open-rpc/client-js": "^1.6.2",
"debug": "^4.3.1",
"p2panda-js": "^0.1.0",
"p2panda-js": "^0.2.1",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-router": "^5.2.0",
Expand All @@ -51,6 +51,7 @@
"@typescript-eslint/eslint-plugin": "^4.15.1",
"@typescript-eslint/parser": "^4.15.1",
"babel-loader": "^8.2.2",
"copy-webpack-plugin": "^9.1.0",
"core-js": "^3.9.0",
"css-loader": "^5.2.0",
"eslint": "^7.20.0",
Expand Down
11 changes: 5 additions & 6 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import React, { useEffect, useState } from 'react';
import p2panda from 'p2panda-js';
import { createKeyPair, Session, wasm } from 'p2panda-js';

import { BambooLog } from '~/components/BambooLog';
import { Chatlog } from '~/components/Chatlog';
import { ENDPOINT, CHAT_SCHEMA } from '~/configs';
import { Instance, Session } from '~/p2panda-api';
import { Instructions } from '~/components/Instructions';

import type { EntryRecord } from '~/p2panda-api/types';
import type { EntryRecord } from 'p2panda-js';

import '~/styles.css';

Expand Down Expand Up @@ -44,21 +43,21 @@ const App = (): JSX.Element => {
useEffect(() => {
// Generate or load key pair on initial page load
const asyncEffect = async () => {
const { KeyPair } = await p2panda;
let privateKey = window.localStorage.getItem('privateKey');
if (!privateKey) {
const keyPair = new KeyPair();
const keyPair = await createKeyPair();
privateKey = keyPair.privateKey();
window.localStorage.setItem('privateKey', privateKey);
}
const { KeyPair } = await wasm;
setKeyPair(KeyPair.fromPrivateKey(privateKey));
};
asyncEffect();
}, []);

// Publish entries and refresh chat log to get the new message in the log
const handlePublish = async (message: string) => {
await Instance.create(
await session.create(
{
message,
date: new Date().toISOString(),
Expand Down
2 changes: 1 addition & 1 deletion src/components/BambooLog/LogEntry.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';

import type { EntryRecord } from '~/p2panda-api/types';
import type { EntryRecord } from 'p2panda-js';

type Props = {
entry: EntryRecord;
Expand Down
2 changes: 1 addition & 1 deletion src/components/BambooLog/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';

import { LogEntry } from '~/components/BambooLog/LogEntry';

import type { EntryRecord } from '~/p2panda-api/types';
import type { EntryRecord } from 'p2panda-js';

type Props = {
log: EntryRecord[];
Expand Down
2 changes: 1 addition & 1 deletion src/components/Chatlog/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';

import { PublishEntry } from '~/components/Chatlog/PublishEntry';

import type { EntryRecord } from '~/p2panda-api/types';
import type { EntryRecord } from 'p2panda-js';

type Props = {
log: EntryRecord[];
Expand Down
11 changes: 4 additions & 7 deletions src/components/Instructions.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import React, { useEffect } from 'react';

import { ENDPOINT, CHAT_SCHEMA } from '~/configs';
import { Session } from '~/p2panda-api';
import { Session, EntryRecord } from 'p2panda-js';
import { SyntaxHighlighter } from '~/syntaxHighlighter';

import type { EntryRecord } from '~/p2panda-api/types';

type Props = {
keyPair: Session['p2panda']['KeyPair'];
session: Session;
Expand Down Expand Up @@ -40,8 +38,7 @@ export const Instructions = ({
<div>
<h2>Make a key pair</h2>
<SyntaxHighlighter>
{`const { KeyPair } = await p2panda;
const keyPair = new KeyPair();
{`const keyPair = await createKeyPair();
const publicKey = keyPair.publicKey();
// => ${publicKey}
const privateKey = keyPair.privateKey();
Expand Down Expand Up @@ -73,7 +70,7 @@ ${session ? `// => ${session}` : ''}`}
<SyntaxHighlighter>{`const fields = {
message: '${currentMessage}'
};
const entry = await Instance.create(
const entry = await session.create(
fields,
{ schema: CHAT_SCHEMA, session, keyPair },
);`}</SyntaxHighlighter>
Expand All @@ -93,7 +90,7 @@ const entry = await Instance.create(
below.
</p>
<SyntaxHighlighter>
{`const entries = await Instance.query({}, {
{`const entries = await session.query({
schema: CHAT_SCHEMA,
session
});
Expand Down
8 changes: 0 additions & 8 deletions src/p2panda-api/index.ts

This file was deleted.

98 changes: 0 additions & 98 deletions src/p2panda-api/instance.ts

This file was deleted.

110 changes: 0 additions & 110 deletions src/p2panda-api/session.ts

This file was deleted.

Loading