Browse Source

Initial Commit

pull/1/head
Qortal Dev 11 months ago
parent
commit
7fe7c9da14
  1. 12
      README.md
  2. 2
      index.js
  3. 43
      package-lock.json
  4. 17
      package.json
  5. 16
      src/Core/API/Names.ts
  6. 0
      src/Core/API/QortalRequest.ts
  7. 11
      src/Core/API/Transactions.ts
  8. 0
      src/Core/Fetch.ts
  9. 2
      src/Core/Interfaces.ts
  10. 0
      src/Core/SendCoin.ts
  11. 0
      src/Core/Types.ts
  12. 0
      src/Numbers/Colors.ts
  13. 0
      src/Numbers/NumberConversion.ts
  14. 0
      src/Numbers/Numbers.ts
  15. 0
      src/Numbers/StringNumbers.ts
  16. 0
      src/Strings/printFunctions.ts
  17. 0
      src/global.d.ts
  18. 9
      tsconfig.json
  19. 9
      tsconfig.node.json
  20. 14
      vite.config.ts

12
README.md

@ -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

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

43
package-lock.json generated

@ -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",

17
package.json

@ -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",

16
QortalCore/QortalRequest.ts → src/Core/API/Names.ts

@ -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 (

0
src/Core/API/QortalRequest.ts

11
src/Core/API/Transactions.ts

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

0
QortalCore/Fetch.ts → src/Core/Fetch.ts

2
QortalCore/Interfaces.ts → src/Core/Interfaces.ts

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

0
QortalCore/SendCoin.ts → src/Core/SendCoin.ts

0
QortalCore/Types.ts → src/Core/Types.ts

0
Numbers/Colors.ts → src/Numbers/Colors.ts

0
Numbers/NumberConversion.ts → src/Numbers/NumberConversion.ts

0
Numbers/Numbers.ts → src/Numbers/Numbers.ts

0
Numbers/StringNumbers.ts → src/Numbers/StringNumbers.ts

0
Strings/printFunctions.ts → src/Strings/printFunctions.ts

0
global.d.ts → src/global.d.ts vendored

9
tsconfig.json

@ -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

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

14
vite.config.ts

@ -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: "",
});
Loading…
Cancel
Save