Initial Commit

This commit is contained in:
Qortal Dev 2023-10-11 16:41:55 -06:00
parent 8e148173aa
commit 7fe7c9da14
20 changed files with 108 additions and 27 deletions

View File

@ -1 +1,11 @@
# Q-Apps-Utils
# Q-App Utilities
This library contains many utility functions for interacting with the Qortal blockchain in order to abstract out qortalRequest calls. This enables Frontend Developers to write Q-Apps without needing to know the Qortal Core API while also significantly reducing the complexity and size of code involved in using it.
## What is Qortal
Qortal is a replacement for the traditional internet that provides user ownership of their data, 1 account for ALL websites, censorship immunity, and significantly more privacy and security than regular websites.
Instead of centralized servers, Terms of Service, and databases constantly getting hacked, users on Qortal share copies of the websites they visit with each other, and all code is run on the user's machine.
Websites and the data they use such as videos, audio, blog posts, etc. are stored on the Qortal Data Network either publicly, or an encrypted format that only the user or other authorized accounts can see.
Qortal Apps made by the development team can be found in the [Q-Apps repository](https://github.com/Qortal/Q-Apps)

2
index.js Normal file
View File

@ -0,0 +1,2 @@
const QortalUtils = require("./src/");
module.exports = QortalUtils;

43
package-lock.json generated
View File

@ -1,19 +1,21 @@
{
"name": "q-utils",
"version": "0.0.0",
"name": "qortal-app-utils",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "q-utils",
"version": "0.0.0",
"name": "qortal-app-utils",
"version": "1.0.0",
"dependencies": {
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@mui/icons-material": "^5.11.11",
"@mui/material": "^5.11.13",
"@mui/system": "^5.14.5",
"@types/node": "^20.8.4",
"colorsys": "github:netbeast/colorsys",
"node": "^20.7.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-dropzone": "^14.2.3",
@ -1371,6 +1373,14 @@
"integrity": "sha512-Hr5Jfhc9eYOQNPYO5WLDq/n4jqijdHNlDXjuAQkkt+mWdQR+XJToOHrsD4cPaMXpn6KO7y2+wM8AZEs8VpBLVA==",
"dev": true
},
"node_modules/@types/node": {
"version": "20.8.4",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.8.4.tgz",
"integrity": "sha512-ZVPnqU58giiCjSxjVUESDtdPk4QR5WQhhINbc9UBrKLU68MX5BF6kbQzTrkwbolyr0X8ChBpXfavr5mZFKZQ5A==",
"dependencies": {
"undici-types": "~5.25.1"
}
},
"node_modules/@types/parse-json": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.0.tgz",
@ -3094,6 +3104,26 @@
"integrity": "sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==",
"dev": true
},
"node_modules/node": {
"version": "20.7.0",
"resolved": "https://registry.npmjs.org/node/-/node-20.7.0.tgz",
"integrity": "sha512-GiKqtgSALW8+W7Zi9T2AI9aME8hJg+1EESH6O7Xmk4k1gJfBKOolpy9gdg8vCyR8dMeJlp5GQZOYnvxsu8v5TA==",
"hasInstallScript": true,
"dependencies": {
"node-bin-setup": "^1.0.0"
},
"bin": {
"node": "bin/node"
},
"engines": {
"npm": ">=5.0.0"
}
},
"node_modules/node-bin-setup": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/node-bin-setup/-/node-bin-setup-1.1.3.tgz",
"integrity": "sha512-opgw9iSCAzT2+6wJOETCpeRYAQxSopqQ2z+N6BXwIMsQQ7Zj5M8MaafQY8JMlolRR6R1UXg2WmhKp0p9lSOivg=="
},
"node_modules/node-releases": {
"version": "2.0.13",
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.13.tgz",
@ -3884,6 +3914,11 @@
"node": ">=14.17"
}
},
"node_modules/undici-types": {
"version": "5.25.3",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.25.3.tgz",
"integrity": "sha512-Ga1jfYwRn7+cP9v8auvEXN1rX3sWqlayd4HP7OKk4mZWylEmu3KzXDUGrQUN6Ol7qo1gPvB2e5gX6udnyEPgdA=="
},
"node_modules/update-browserslist-db": {
"version": "1.0.11",
"resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.11.tgz",

View File

@ -1,7 +1,16 @@
{
"name": "q-utils",
"private": true,
"version": "0.0.0",
"name": "qortal-app-utils",
"version": "1.0.0",
"description": "A series of convenience functions that perform common tasks, especially those that interact with the Qortal blockchain",
"keywords": ["Qortal", "QortalDataNetwork"],
"author": "Qortal Dev Team",
"repository": {
"type": "git",
"url": "https://github.com/Qortal/Q-Apps-Utils"
},
"private": false,
"main": "index.js",
"types": "index.d.ts",
"type": "module",
"scripts": {
"dev": "vite",
@ -15,7 +24,9 @@
"@mui/icons-material": "^5.11.11",
"@mui/material": "^5.11.13",
"@mui/system": "^5.14.5",
"@types/node": "^20.8.4",
"colorsys": "github:netbeast/colorsys",
"node": "^20.7.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-dropzone": "^14.2.3",

View File

@ -1,17 +1,5 @@
import {
GetRequestData,
SearchTransactionResponse,
TransactionSearchParams,
} from "./Interfaces";
import { stringIsEmpty } from "../Numbers/StringNumbers";
export const searchTransactions = async (params: TransactionSearchParams) => {
return (await qortalRequest({
action: "SEARCH_TRANSACTIONS",
...params,
})) as SearchTransactionResponse[];
};
import { stringIsEmpty } from "../../Numbers/StringNumbers";
import { GetRequestData } from "../Interfaces";
type AccountName = { name: string; owner: string };
export const getAccountNames = async (

View File

View File

@ -0,0 +1,11 @@
import {
SearchTransactionResponse,
TransactionSearchParams,
} from "../Interfaces";
export const searchTransactions = async (params: TransactionSearchParams) => {
return (await qortalRequest({
action: "SEARCH_TRANSACTIONS",
...params,
})) as SearchTransactionResponse[];
};

View File

@ -1,4 +1,4 @@
import { ConfirmationStatus, TransactionType } from "./Types";
import { ConfirmationStatus, TransactionType } from ".//Types";
export interface GetRequestData {
limit?: number;

View File

View File

@ -1,12 +1,13 @@
{
"compilerOptions": {
"target": "ESNext",
"lib": ["DOM", "DOM.Iterable", "ESNext"],
"module": "ESNext",
"lib": ["DOM", "DOM.Iterable", "ESNext"],
"skipLibCheck": true,
"declaration": true,
"sourceMap": true,
/* Bundler mode */
"moduleResolution": "Node",
"moduleResolution": "node",
"esModuleInterop": true,
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
@ -21,6 +22,6 @@
"noFallthroughCasesInSwitch": true,
"allowSyntheticDefaultImports": true
},
"include": ["**/*"],
"include": ["src/**/*"],
"references": [{ "path": "./tsconfig.node.json" }]
}

9
tsconfig.node.json Normal file
View File

@ -0,0 +1,9 @@
{
"compilerOptions": {
"composite": true,
"skipLibCheck": true,
"module": "ESNext",
"allowSyntheticDefaultImports": true
},
"include": ["vite.config.ts"]
}

14
vite.config.ts Normal file
View File

@ -0,0 +1,14 @@
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import { resolve } from "path";
// https://vitejs.dev/config/
export default defineConfig({
build: {
lib: {
entry: resolve(__dirname, "index.js"),
name: "QortalUtils",
},
},
plugins: [react()],
base: "",
});