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
3 changes: 2 additions & 1 deletion packages/TBC20-app/.prettierrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"printWidth": 100,
"semi": false,
"singleQuote": true
"singleQuote": true,
"trailingComma": "none"
}
6 changes: 4 additions & 2 deletions packages/TBC20-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@
"start": "react-scripts start",
"build": "react-scripts build",
"eject": "react-scripts eject",
"lint": "eslint --ext .ts,.tsx,.js src/ --fix",
"prettier": "./node_modules/.bin/prettier --write 'src/**/*.{js,jsx,ts,tsx,json,css,scss,md}'"
"lint": "eslint --ext .ts,.tsx,.js src/",
"lint-fix": "eslint --ext .ts,.tsx,.js src/ --fix",
"prettier": "./node_modules/.bin/prettier --write 'src/**/*.{js,jsx,ts,tsx,json,css,scss,md}'",
"types": "tsc --noEmit"
},
"eslintConfig": {
"extends": "react-app"
Expand Down
3 changes: 2 additions & 1 deletion packages/TBC20/.prettierrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"printWidth": 100,
"semi": false,
"singleQuote": true
"singleQuote": true,
"trailingComma": "none"
}
2 changes: 2 additions & 0 deletions packages/TBC20/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@
"clean": "rimraf coverage build tmp",
"clean-logs": "rm -f *.log 2> /dev/null",
"lint": "eslint src test --ext .ts,.tsx",
"lint-fix": "eslint src test --ext .ts,.tsx --fix",
"prebuild": "npm run lint",
"start": "node build/src/main.js",
"prettier": "prettier --write \"src/**/*.{js,jsx,ts,tsx,css,scss,md}\"",
"types": "tsc",
"test": "mocha --config .mocharc.json",
"test-and-show": "../../scripts/test-and-show.sh tbc20-test.log "
Expand Down
2 changes: 1 addition & 1 deletion packages/TBC20/src/token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export class TBC20 implements ITBC20 {
const revs = await this.computer.query({ publicKey })
const bags = await Promise.all(revs.map(async (rev: string) => this.computer.sync(rev)))
return bags.flatMap((bag: Token & { _root: string }) =>
bag._root === this.mintId ? [bag] : [],
bag._root === this.mintId ? [bag] : []
)
}

Expand Down
3 changes: 2 additions & 1 deletion packages/TBC404-app/.prettierrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"printWidth": 100,
"semi": false,
"singleQuote": false
"singleQuote": false,
"trailingComma": "none"
}
3 changes: 2 additions & 1 deletion packages/TBC404/.prettierrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"printWidth": 100,
"semi": false,
"singleQuote": true
"singleQuote": true,
"trailingComma": "none"
}
3 changes: 2 additions & 1 deletion packages/TBC721-app/.prettierrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"printWidth": 100,
"semi": false,
"singleQuote": false
"singleQuote": false,
"trailingComma": "none"
}
3 changes: 2 additions & 1 deletion packages/TBC721/.prettierrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"printWidth": 100,
"semi": false,
"singleQuote": true
"singleQuote": true,
"trailingComma": "none"
}
25 changes: 25 additions & 0 deletions packages/chat/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"parser": "@typescript-eslint/parser",
"extends": ["airbnb-base", "prettier"],
"plugins": [],
"env": {
"jest": true
},
"globals": {
"document": true,
"window": true
},
"rules": {
"semi": ["error", "never"],
"import/extensions": "off",
"lines-between-class-members": "off",
"import/prefer-default-export": "off",
"no-underscore-dangle": [
"error",
{
"allowAfterThis": true,
"allow": ["_readers", "_owners", "_amount", "_id", "_rev", "_root"]
}
]
}
}
3 changes: 2 additions & 1 deletion packages/chat/.prettierrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"printWidth": 100,
"semi": false,
"singleQuote": true
"singleQuote": true,
"trailingComma": "none"
}
11 changes: 10 additions & 1 deletion packages/chat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"eject": "react-scripts eject"
"eject": "react-scripts eject",
"lint": "eslint src",
"lint-fix": "eslint src --fix"
},
"eslintConfig": {
"extends": "react-app"
Expand All @@ -32,5 +34,12 @@
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"eslint": "^8.57.0",
"eslint-config-airbnb-typescript": "^17.1.0",
"eslint-config-prettier": "~9.1.0",
"eslint-plugin-import": "^2.29.1"
}
}
25 changes: 25 additions & 0 deletions packages/components/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"parser": "@typescript-eslint/parser",
"extends": ["airbnb-base", "prettier", "plugin:@typescript-eslint/recommended"],
"plugins": ["@typescript-eslint"],
"env": {
"jest": true,
"browser": true
},
"globals": {},
"rules": {
"semi": ["error", "never"],
"import/extensions": "off",
"import/no-unresolved": "off",
"lines-between-class-members": "off",
"import/prefer-default-export": "off",
"@typescript-eslint/no-explicit-any": "off",
"no-underscore-dangle": [
"error",
{
"allowAfterThis": true,
"allow": ["_readers", "_owners", "_amount", "_id", "_rev", "_root"]
}
]
}
}
3 changes: 2 additions & 1 deletion packages/components/.prettierrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"printWidth": 100,
"semi": false,
"singleQuote": false
"singleQuote": false,
"trailingComma": "none"
}
14 changes: 12 additions & 2 deletions packages/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,27 @@
"scripts": {
"tsc-compile": "rm -rf built/* && tsc",
"install-monorepo": "cd ../../../ && npm run delete-node-modules && npm install && cd monorepo/packages/components",
"compile": "npm run tsc-compile && npm run install-monorepo"
"compile": "npm run tsc-compile && npm run install-monorepo",
"lint": "eslint --fix . --ext .ts,.tsx --ignore-pattern built/",
"lint-fix": "eslint src --fix",
"prettier": "prettier --write \"src/**/*.{js,jsx,ts,tsx,css,scss,md}\"",
"types": "tsc --noEmit"
},
"author": "",
"license": "ISC",
"dependencies": {
"@bitcoin-computer/lib": "^0.19.0-beta.0",
"eslint": "^8.57.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-prettier": "~9.1.0",
"eslint-plugin-import": "^2.29.1",
"flowbite": "^2.3.0",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@babel/preset-react": "^7.23.3"
"@babel/preset-react": "^7.23.3",
"@typescript-eslint/eslint-plugin": "^7.9.0",
"@typescript-eslint/parser": "^7.9.0"
}
}
27 changes: 15 additions & 12 deletions packages/components/src/Auth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,22 @@ function getPath(chain: string, network: string): string {

function getEnvVariable(name: string) {
const res = process.env[name]
if (typeof res === "undefined") {
throw new Error(`Cannot find environment variable "${name}" in the .env file.`)
}
else return res
if (typeof res === "undefined") {
throw new Error(`Cannot find environment variable "${name}" in the .env file.`)
} else return res
}

function getUrl(chain: Chain, network: Network) {
return getEnvVariable(`REACT_APP_${chain.toUpperCase()}_${network.toUpperCase()}_URL`)
}

function defaultConfiguration() {
const chain = (localStorage.getItem("CHAIN") || getEnvVariable(`REACT_APP_CHAIN`) || "LTC") as Chain
const network = (localStorage.getItem("NETWORK") || getEnvVariable(`REACT_APP_NETWORK`) || "regtest") as Network
const chain = (localStorage.getItem("CHAIN") ||
getEnvVariable(`REACT_APP_CHAIN`) ||
"LTC") as Chain
const network = (localStorage.getItem("NETWORK") ||
getEnvVariable(`REACT_APP_NETWORK`) ||
"regtest") as Network
const url = getUrl(chain, network)
return { chain, network, url }
}
Expand All @@ -66,7 +69,7 @@ function browserConfiguration() {
chain: localStorage.getItem("CHAIN") as Chain,
network: localStorage.getItem("NETWORK") as Network,
path: localStorage.getItem("PATH"),
url: localStorage.getItem("URL"),
url: localStorage.getItem("URL")
}
}

Expand All @@ -77,7 +80,7 @@ function getComputer(): Computer {

function MnemonicInput({
mnemonic,
setMnemonic,
setMnemonic
}: {
mnemonic: string
setMnemonic: Dispatch<string>
Expand Down Expand Up @@ -180,7 +183,7 @@ function ChainInput({ chain, setChain }: { chain: Chain; setChain: Dispatch<Chai

function NetworkInput({
network,
setNetwork,
setNetwork
}: {
network: Network
setNetwork: Dispatch<Network>
Expand Down Expand Up @@ -255,7 +258,7 @@ function PathInput({
chain,
network,
path,
setPath,
setPath
}: {
chain: string
network: string
Expand Down Expand Up @@ -292,7 +295,7 @@ function UrlInput({
chain,
network,
url,
setUrl,
setUrl
}: {
chain: Chain
network: Network
Expand Down Expand Up @@ -412,5 +415,5 @@ export const Auth = {
browserConfiguration,
getComputer,
LoginForm,
LoginModal,
LoginModal
}
12 changes: 6 additions & 6 deletions packages/components/src/Card.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export function Card({ content }: any) {
return (<div className="block mt-4 mb-8 p-6 bg-white border border-gray-200 rounded-lg shadow dark:bg-gray-800 dark:border-gray-700">
<pre className="font-normal text-gray-700 dark:text-gray-400 text-xs">
{content}
</pre>
</div>)
}
return (
<div className="block mt-4 mb-8 p-6 bg-white border border-gray-200 rounded-lg shadow dark:bg-gray-800 dark:border-gray-700">
<pre className="font-normal text-gray-700 dark:text-gray-400 text-xs">{content}</pre>
</div>
)
}
6 changes: 3 additions & 3 deletions packages/components/src/ComputerContext.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Computer } from '@bitcoin-computer/lib'
import { createContext } from 'react'
import { Computer } from "@bitcoin-computer/lib"
import { createContext } from "react"

export const ComputerContext = createContext(new Computer())
export const ComputerContext = createContext(new Computer())
2 changes: 1 addition & 1 deletion packages/components/src/Drawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,5 @@ function Component({ Content, id }: any) {

export const Drawer = {
Component,
ShowDrawer,
ShowDrawer
}
46 changes: 22 additions & 24 deletions packages/components/src/Error404.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
export const Error404 = () => {
return (
<section className="w-full bg-white dark:bg-gray-900">
<div className="py-8 px-4 mx-auto max-w-screen-xl lg:py-16 lg:px-6">
<div className="mx-auto max-w-screen-sm text-center">
<h1 className="mb-4 text-6xl tracking-tight font-extrabold text-blue-700 dark:text-blue-600">
404
</h1>
<p className="mb-4 text-3xl tracking-tight font-bold text-gray-700 md:text-4xl dark:text-white">
Something's missing.
</p>
<p className="mb-4 text-lg font-light text-gray-500 dark:text-gray-400">
Sorry, we can't find that page. You'll find lots to explore on the home page.{" "}
</p>
<a
href="/"
className="inline-flex text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:focus:ring-blue-900 my-4"
>
Back to Homepage
</a>
</div>
export const Error404 = () => (
<section className="w-full bg-white dark:bg-gray-900">
<div className="py-8 px-4 mx-auto max-w-screen-xl lg:py-16 lg:px-6">
<div className="mx-auto max-w-screen-sm text-center">
<h1 className="mb-4 text-6xl tracking-tight font-extrabold text-blue-700 dark:text-blue-600">
404
</h1>
<p className="mb-4 text-3xl tracking-tight font-bold text-gray-700 md:text-4xl dark:text-white">
Something's missing.
</p>
<p className="mb-4 text-lg font-light text-gray-500 dark:text-gray-400">
Sorry, we can't find that page. You'll find lots to explore on the home page.{" "}
</p>
<a
href="/"
className="inline-flex text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:focus:ring-blue-900 my-4"
>
Back to Homepage
</a>
</div>
</section>
)
}
</div>
</section>
)
10 changes: 5 additions & 5 deletions packages/components/src/Gallery.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Computer } from "@bitcoin-computer/lib"
import { useContext, useEffect, useState } from "react"
import { Link, useLocation } from "react-router-dom"
import { jsonMap, strip, toObject } from "./common/utils"
import { initFlowbite } from "flowbite"
import { jsonMap, strip, toObject } from "./common/utils"
import { useUtilsComponents } from "./UtilsContext"
import { ComputerContext } from "./ComputerContext"

Expand All @@ -13,7 +13,7 @@ export type UserQuery<T extends Class> = Partial<{
publicKey: string
limit: number
offset: number
order: 'ASC' | 'DESC'
order: "ASC" | "DESC"
ids: string[]
contract: {
class: T
Expand Down Expand Up @@ -173,8 +173,8 @@ export default function WithPagination<T extends Class>(q: UserQuery<T>) {
const fetch = async () => {
showLoader(true)
const query = { ...q, ...params }
query["offset"] = contractsPerPage * pageNum
query["limit"] = contractsPerPage + 1
query.offset = contractsPerPage * pageNum
query.limit = contractsPerPage + 1
const result = await computer.query(query)
setIsNextAvailable(result.length > contractsPerPage)
setRevs(result)
Expand Down Expand Up @@ -220,5 +220,5 @@ export default function WithPagination<T extends Class>(q: UserQuery<T>) {

export const Gallery = {
FromRevs,
WithPagination,
WithPagination
}
Loading