Skip to content
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
11 changes: 11 additions & 0 deletions packages/chat/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Application configuration
VITE_CHAIN=LTC
VITE_NETWORK=regtest
VITE_URL=http://127.0.0.1:1031

# Application Port
VITE_PORT=1032

# Smart Contract Locations
# Run 'npm run deploy' and copy the output here
VITE_CHAT_MOD_SPEC=b7fa7873fb6fcf7f13555c6cf18cc7361ba7ff9f146f50b502e2bc5abbe2b28a:0
25 changes: 0 additions & 25 deletions packages/chat/.eslintrc

This file was deleted.

1 change: 1 addition & 0 deletions packages/chat/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

# production
/build
/dist

# misc
.DS_Store
Expand Down
2 changes: 1 addition & 1 deletion packages/chat/.prettierrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"printWidth": 100,
"semi": false,
"singleQuote": true,
"singleQuote": false,
"trailingComma": "none"
}
1 change: 1 addition & 0 deletions packages/chat/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ Have a look at the [docs](https://docs.bitcoincomputer.io/) for the Bitcoin Comp
If you have any questions, please let us know on <a href="https://t.me/thebitcoincomputer" target="_blank">Telegram</a>, <a href="https://twitter.com/TheBitcoinToken" target="_blank">Twitter</a>, or by email clemens@bitcoincomputer.io.

## Development Status

See [here](https://github.com/bitcoin-computer/monorepo/tree/main/packages/lib#development-status).

## Price
Expand Down
28 changes: 28 additions & 0 deletions packages/chat/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import js from '@eslint/js'
import globals from 'globals'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'
import tseslint from 'typescript-eslint'

export default tseslint.config(
{ ignores: ['dist'] },
{
extends: [js.configs.recommended, ...tseslint.configs.recommended],
files: ['**/*.{ts,tsx}'],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
},
plugins: {
'react-hooks': reactHooks,
'react-refresh': reactRefresh,
},
rules: {
...reactHooks.configs.recommended.rules,
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
},
},
)
Binary file removed packages/chat/imgs/chat-screen.png
Binary file not shown.
13 changes: 13 additions & 0 deletions packages/chat/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Bitcoin Computer Chat App</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
67 changes: 34 additions & 33 deletions packages/chat/package.json
Original file line number Diff line number Diff line change
@@ -1,41 +1,42 @@
{
"name": "@bitcoin-computer/chat",
"version": "0.22.0-beta.0",
"name": "chat",
"private": true,
"dependencies": {
"@bitcoin-computer/lib": "^0.22.0-beta.0",
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.3.2",
"@testing-library/user-event": "^7.1.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.3.0",
"react-scripts": "5.0.1",
"web-vitals": "^2.1.4"
},
"version": "0.22.0-beta.0",
"type": "module",
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"eject": "react-scripts eject",
"lint": "eslint src",
"lint-fix": "eslint src --fix"
},
"eslintConfig": {
"extends": "react-app"
"dev": "vite",
"build": "tsc -b && vite build",
"lint": "eslint .",
"preview": "vite preview",
"test": "vitest",
"deploy": "node --loader ts-node/esm scripts/deploy.ts"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
"dependencies": {
"@bitcoin-computer/components": "^0.22.0-beta.0",
"@bitcoin-computer/lib": "^0.22.0-beta.0",
"flowbite": "^2.3.0",
"react": "^18.3.1",
"react-dom": "^18.3.1"
},
"devDependencies": {
"@babel/plugin-proposal-private-property-in-object": "^7.21.11"
"@eslint/js": "^9.9.0",
"@testing-library/jest-dom": "^6.5.0",
"@testing-library/react": "^16.0.1",
"@testing-library/user-event": "^14.5.2",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@vitejs/plugin-react": "^4.3.1",
"autoprefixer": "^10.4.20",
"eslint": "^9.9.0",
"eslint-plugin-react-hooks": "^5.1.0-rc.0",
"eslint-plugin-react-refresh": "^0.4.9",
"globals": "^15.9.0",
"jsdom": "^25.0.0",
"postcss": "^8.4.44",
"tailwindcss": "^3.4.10",
"typescript": "^5.5.3",
"typescript-eslint": "^8.0.1",
"vite": "^5.4.1",
"vitest": "^2.0.5"
}
}
6 changes: 6 additions & 0 deletions packages/chat/postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export default {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}
Binary file added packages/chat/public/BitcoinComputer-Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed packages/chat/public/favicon.ico
Binary file not shown.
43 changes: 0 additions & 43 deletions packages/chat/public/index.html

This file was deleted.

Binary file added packages/chat/public/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed packages/chat/public/logo192.png
Binary file not shown.
Binary file removed packages/chat/public/logo512.png
Binary file not shown.
25 changes: 0 additions & 25 deletions packages/chat/public/manifest.json

This file was deleted.

3 changes: 0 additions & 3 deletions packages/chat/public/robots.txt

This file was deleted.

1 change: 1 addition & 0 deletions packages/chat/public/vite.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
53 changes: 53 additions & 0 deletions packages/chat/scripts/deploy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import { config } from "dotenv"
import * as readline from "node:readline/promises"
import { stdin as input, stdout as output } from "node:process"
import { Computer } from "@bitcoin-computer/lib"
import { ChatSc } from "../src/contracts/chat.js"

config()

const rl = readline.createInterface({ input, output })

const { VITE_CHAIN: chain, VITE_NETWORK: network, VITE_URL: url, MNEMONIC: mnemonic } = process.env

if (network !== "regtest") {
if (!mnemonic) throw new Error("Please set MNEMONIC in the .env file")
}

const computer = new Computer({ chain, network, mnemonic, url })
if (network === "regtest") {
await computer.faucet(2e8)
}

const balance = await computer.wallet.getBalance()

// Summary
console.log(`Chain \x1b[2m${chain}\x1b[0m
Network \x1b[2m${network}\x1b[0m
Node Url \x1b[2m${url}\x1b[0m
Address \x1b[2m${computer.wallet.address}\x1b[0m
Mnemonic \x1b[2m${mnemonic}\x1b[0m
Balance \x1b[2m${balance.balance / 1e8}\x1b[0m`)

const answer = await rl.question("\nDo you want to deploy the contract? \x1b[2m(y/n)\x1b[0m")
if (answer === "n") {
console.log("\n Aborting...\n")
} else {
console.log("\n * Deploying ChatSc contract...")
const chatModSpec = await computer.deploy(`export ${ChatSc}`)

console.log(`
Successfully deployed chat smart contract.

-----------------
ACTION REQUIRED
-----------------

(1) Update the following rows in your .env file.

VITE_CHAT_MOD_SPEC\x1b[2m=${chatModSpec}\x1b[0m
(2) Run 'npm start' to start the application.
`)
}

rl.close()
38 changes: 38 additions & 0 deletions packages/chat/src/App.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
.App {
text-align: center;
}

.App-logo {
height: 40vmin;
pointer-events: none;
}

@media (prefers-reduced-motion: no-preference) {
.App-logo {
animation: App-logo-spin infinite 20s linear;
}
}

.App-header {
background-color: #282c34;
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: calc(10px + 2vmin);
color: white;
}

.App-link {
color: #61dafb;
}

@keyframes App-logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
Loading