diff --git a/package.json b/package.json index fc97169..36342a1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hollowdb", - "version": "1.2.4", + "version": "1.3.0", "description": "A decentralized privacy-preserving key-value database", "license": "MIT", "homepage": "https://github.com/firstbatchxyz/hollowdb#readme", @@ -77,6 +77,7 @@ "@types/node": "^14.11.2", "@types/yargs": "^17.0.24", "@typescript-eslint/eslint-plugin": "^6.5.0", + "@typescript-eslint/parser": "^6.11.0", "arlocal": "^1.1.60", "arweave": "^1.13.0", "copyfiles": "^2.4.1", diff --git a/src/bin/build.ts b/src/bin/build.ts index 9bd9cec..d4b968e 100644 --- a/src/bin/build.ts +++ b/src/bin/build.ts @@ -1,5 +1,4 @@ import {build as esbuild} from 'esbuild'; -import {getPath} from './utils'; import {readdirSync} from 'fs'; import replace from 'replace-in-file'; @@ -11,7 +10,7 @@ const DEST = CONTRACTS_DIR + '/build'; * If no name is provided, all contracts will be built. */ export async function build(name?: string) { - let contracts = name + const contracts = name ? [name + '.contract.ts'] : readdirSync(CONTRACTS_DIR).filter(file => file.endsWith('.contract.ts')); @@ -24,8 +23,7 @@ export async function build(name?: string) { format: 'iife', }) .catch(() => { - console.error('Build failed'); - process.exit(1); + throw new Error('Build failed.'); }) .finally(() => { const files = contracts.map(source => `${DEST}/${source}`.replace('.ts', '.js')); diff --git a/src/bin/cli.ts b/src/bin/cli.ts index de72c74..af9f84b 100644 --- a/src/bin/cli.ts +++ b/src/bin/cli.ts @@ -1,5 +1,5 @@ #!/usr/bin/env node -import {copyFileSync, existsSync, readFileSync, writeFileSync} from 'fs'; +import {copyFileSync, readFileSync, writeFileSync} from 'fs'; import yargs from 'yargs'; import {hideBin} from 'yargs/helpers'; diff --git a/src/contracts/build/hollowdb-htx.contract.js b/src/contracts/build/hollowdb-htx.contract.js index cccdf35..cf9c4a8 100644 --- a/src/contracts/build/hollowdb-htx.contract.js +++ b/src/contracts/build/hollowdb-htx.contract.js @@ -8,9 +8,9 @@ var NotWhitelistedError = new ContractError("Not whitelisted."); var InvalidProofError = new ContractError("Invalid proof."); var ExpectedProofError = new ContractError("Expected a proof."); + var NullValueError = new ContractError("Value cant be null, use remove instead."); var NotOwnerError = new ContractError("Not contract owner."); var InvalidFunctionError = new ContractError("Invalid function."); - var NullValueError = new ContractError("Value cant be null, use remove instead."); // src/contracts/utils/index.ts var verifyProof = async (proof, psignals, verificationKey) => { diff --git a/src/contracts/build/hollowdb.contract.js b/src/contracts/build/hollowdb.contract.js index a1ae401..eaeebfd 100644 --- a/src/contracts/build/hollowdb.contract.js +++ b/src/contracts/build/hollowdb.contract.js @@ -8,9 +8,9 @@ var NotWhitelistedError = new ContractError("Not whitelisted."); var InvalidProofError = new ContractError("Invalid proof."); var ExpectedProofError = new ContractError("Expected a proof."); + var NullValueError = new ContractError("Value cant be null, use remove instead."); var NotOwnerError = new ContractError("Not contract owner."); var InvalidFunctionError = new ContractError("Invalid function."); - var NullValueError = new ContractError("Value cant be null, use remove instead."); // src/contracts/utils/index.ts var verifyProof = async (proof, psignals, verificationKey) => { diff --git a/src/contracts/errors/index.ts b/src/contracts/errors/index.ts index d5ea172..501880f 100644 --- a/src/contracts/errors/index.ts +++ b/src/contracts/errors/index.ts @@ -9,4 +9,3 @@ export const ExpectedProofError = new ContractError('Expected a proof.'); export const NullValueError = new ContractError('Value cant be null, use remove instead.'); export const NotOwnerError = new ContractError('Not contract owner.'); export const InvalidFunctionError = new ContractError('Invalid function.'); -export const NullValueError = new ContractError('Value cant be null, use remove instead.'); diff --git a/yarn.lock b/yarn.lock index fe138e3..64a5dc2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3231,6 +3231,25 @@ semver "^7.5.4" ts-api-utils "^1.0.1" +"@typescript-eslint/parser@^6.11.0": + version "6.11.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-6.11.0.tgz#9640d9595d905f3be4f278bf515130e6129b202e" + integrity sha512-+whEdjk+d5do5nxfxx73oanLL9ghKO3EwM9kBCkUtWMRwWuPaFv9ScuqlYfQ6pAD6ZiJhky7TZ2ZYhrMsfMxVQ== + dependencies: + "@typescript-eslint/scope-manager" "6.11.0" + "@typescript-eslint/types" "6.11.0" + "@typescript-eslint/typescript-estree" "6.11.0" + "@typescript-eslint/visitor-keys" "6.11.0" + debug "^4.3.4" + +"@typescript-eslint/scope-manager@6.11.0": + version "6.11.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-6.11.0.tgz#621f603537c89f4d105733d949aa4d55eee5cea8" + integrity sha512-0A8KoVvIURG4uhxAdjSaxy8RdRE//HztaZdG8KiHLP8WOXSk0vlF7Pvogv+vlJA5Rnjj/wDcFENvDaHb+gKd1A== + dependencies: + "@typescript-eslint/types" "6.11.0" + "@typescript-eslint/visitor-keys" "6.11.0" + "@typescript-eslint/scope-manager@6.5.0": version "6.5.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-6.5.0.tgz#f2cb20895aaad41b3ad27cc3a338ce8598f261c5" @@ -3249,11 +3268,29 @@ debug "^4.3.4" ts-api-utils "^1.0.1" +"@typescript-eslint/types@6.11.0": + version "6.11.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-6.11.0.tgz#8ad3aa000cbf4bdc4dcceed96e9b577f15e0bf53" + integrity sha512-ZbEzuD4DwEJxwPqhv3QULlRj8KYTAnNsXxmfuUXFCxZmO6CF2gM/y+ugBSAQhrqaJL3M+oe4owdWunaHM6beqA== + "@typescript-eslint/types@6.5.0": version "6.5.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-6.5.0.tgz#f4e55cfd99ac5346ea772770bf212a3e689a8f04" integrity sha512-eqLLOEF5/lU8jW3Bw+8auf4lZSbbljHR2saKnYqON12G/WsJrGeeDHWuQePoEf9ro22+JkbPfWQwKEC5WwLQ3w== +"@typescript-eslint/typescript-estree@6.11.0": + version "6.11.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-6.11.0.tgz#7b52c12a623bf7f8ec7f8a79901b9f98eb5c7990" + integrity sha512-Aezzv1o2tWJwvZhedzvD5Yv7+Lpu1by/U1LZ5gLc4tCx8jUmuSCMioPFRjliN/6SJIvY6HpTtJIWubKuYYYesQ== + dependencies: + "@typescript-eslint/types" "6.11.0" + "@typescript-eslint/visitor-keys" "6.11.0" + debug "^4.3.4" + globby "^11.1.0" + is-glob "^4.0.3" + semver "^7.5.4" + ts-api-utils "^1.0.1" + "@typescript-eslint/typescript-estree@6.5.0": version "6.5.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-6.5.0.tgz#1cef6bc822585e9ef89d88834bc902d911d747ed" @@ -3280,6 +3317,14 @@ "@typescript-eslint/typescript-estree" "6.5.0" semver "^7.5.4" +"@typescript-eslint/visitor-keys@6.11.0": + version "6.11.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-6.11.0.tgz#d991538788923f92ec40d44389e7075b359f3458" + integrity sha512-+SUN/W7WjBr05uRxPggJPSzyB8zUpaYo2hByKasWbqr3PM8AXfZt8UHdNpBS1v9SA62qnSSMF3380SwDqqprgQ== + dependencies: + "@typescript-eslint/types" "6.11.0" + eslint-visitor-keys "^3.4.1" + "@typescript-eslint/visitor-keys@6.5.0": version "6.5.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-6.5.0.tgz#1a6f474a0170a447b76f0699ce6700110fd11436"