From 67a48ff8f3dd6ec87c296429f89f41c448129c28 Mon Sep 17 00:00:00 2001 From: erhant Date: Mon, 18 Dec 2023 10:23:55 +0300 Subject: [PATCH 1/3] more explicit build settings --- .vscode/settings.json | 14 -------------- package.json | 14 ++++++++++---- src/base/admin.ts | 3 --- 3 files changed, 10 insertions(+), 21 deletions(-) delete mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 1d2e039..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - // https://raw.githubusercontent.com/PKief/vscode-material-icon-theme/main/images/fileIcons.png - "material-icon-theme.files.associations": { - "*.contract.ts": "tsconfig", - "*.state.ts": "tsconfig" - }, - // https://raw.githubusercontent.com/PKief/vscode-material-icon-theme/main/images/folderIcons.png - "material-icon-theme.folders.associations": { - "states": "Json", - "modifiers": "Middleware", - "wallets": "Secure", - "circuits": "App" - } -} diff --git a/package.json b/package.json index 8841380..1f328a1 100644 --- a/package.json +++ b/package.json @@ -23,13 +23,19 @@ "targets": { "cjs": { "outputFormat": "commonjs", - "isLibrary": true, - "context": "node" + "isLibrary": false, + "context": "node", + "scopeHoist": false, + "includeNodeModules": false, + "optimize": false }, "mjs": { "outputFormat": "esmodule", - "isLibrary": true, - "context": "node" + "isLibrary": false, + "context": "node", + "scopeHoist": false, + "includeNodeModules": false, + "optimize": false } }, "engines": { diff --git a/src/base/admin.ts b/src/base/admin.ts index 80c4a71..94e6b47 100644 --- a/src/base/admin.ts +++ b/src/base/admin.ts @@ -25,9 +25,6 @@ export class Admin { }); } - // TODO: transfer ownership - // remove yourself from whitelists and such - /** * Changes the whitelist for the selected list. * @param users an array of user addresses From 81d2301a6f461967bf4bac38ab229909fa60d374 Mon Sep 17 00:00:00 2001 From: erhant Date: Mon, 18 Dec 2023 10:24:31 +0300 Subject: [PATCH 2/3] ignore .vscode --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 8c3d9c3..6dee5e2 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,5 @@ tmp.ts # Test stuff coverage + +.vscode From fdf1ef17e305fa33dc56e804bf1ad8cacf4a6146 Mon Sep 17 00:00:00 2001 From: erhant Date: Wed, 20 Dec 2023 17:49:58 +0300 Subject: [PATCH 3/3] parcel refactor, explicit type imports --- src/base/admin.ts | 2 +- src/base/base.ts | 2 +- src/bin/evolve.ts | 2 +- src/bin/utils.ts | 3 ++- tests/README.md | 1 + tests/hooks/index.ts | 2 +- tests/utils/index.ts | 4 ++-- 7 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/base/admin.ts b/src/base/admin.ts index 94e6b47..c1b5ed1 100644 --- a/src/base/admin.ts +++ b/src/base/admin.ts @@ -7,7 +7,7 @@ import type { UpdateWhitelistInput, OpitonalArray, } from '../contracts/types'; -import {Base} from './base'; +import type {Base} from './base'; export class Admin { constructor(private readonly base: Base) {} diff --git a/src/base/base.ts b/src/base/base.ts index 582079f..adb5455 100644 --- a/src/base/base.ts +++ b/src/base/base.ts @@ -1,4 +1,4 @@ -import {Warp, Contract, ArWallet, CustomSignature} from 'warp-contracts'; +import {Warp, Contract, ArWallet, type CustomSignature} from 'warp-contracts'; import {SnarkjsExtension} from 'warp-contracts-plugin-snarkjs'; import {EthersExtension} from 'warp-contracts-plugin-ethers'; import type {ContractInputGeneric, ContractMode, ContractState} from '../contracts/types/contract'; diff --git a/src/bin/evolve.ts b/src/bin/evolve.ts index c00e85f..2b718bd 100644 --- a/src/bin/evolve.ts +++ b/src/bin/evolve.ts @@ -1,4 +1,4 @@ -import {JWKInterface, Warp} from 'warp-contracts'; +import type {JWKInterface, Warp} from 'warp-contracts'; import {ArweaveSigner} from 'warp-contracts-plugin-deploy'; /** Evolve an existing contract with a new source code. */ diff --git a/src/bin/utils.ts b/src/bin/utils.ts index cd2bf27..6d4e01e 100644 --- a/src/bin/utils.ts +++ b/src/bin/utils.ts @@ -1,5 +1,6 @@ import {readFileSync} from 'fs'; -import {JWKInterface, Warp, WarpFactory} from 'warp-contracts'; +import type {JWKInterface, Warp} from 'warp-contracts'; +import {WarpFactory} from 'warp-contracts'; import {DeployPlugin} from 'warp-contracts-plugin-deploy'; import {prepareState as prepareStateWithWarp} from './deploy'; import {ContractState} from '../contracts/types'; diff --git a/tests/README.md b/tests/README.md index 4127613..f6eb0bc 100644 --- a/tests/README.md +++ b/tests/README.md @@ -8,3 +8,4 @@ The tests are as follows: - `crud` tests for basic CRUD functionality, such as checking for existing keys, not removing an already removed key and such. - `htx` tests use a custom contract where assume Bundlr usage and instead of values themselves, we store `valueHash.txid` as values. - `multi` tests using a single Warp instance with multiple contracts, and multiple HollowDB instances. +- `null` tests null values, which are not allowed due to ambiguity between a null value and non-existent value. diff --git a/tests/hooks/index.ts b/tests/hooks/index.ts index 5767999..39efff9 100644 --- a/tests/hooks/index.ts +++ b/tests/hooks/index.ts @@ -3,7 +3,7 @@ import {LoggerFactory, Warp, WarpFactory} from 'warp-contracts'; import {DeployPlugin} from 'warp-contracts-plugin-deploy'; import {Redis} from 'ioredis'; import {overrideCache} from '../utils/cache'; -import {Wallet} from 'warp-contracts/lib/types/contract/testing/Testing'; +import type {Wallet} from 'warp-contracts/lib/types/contract/testing/Testing'; /** * Setup Warp instance for a test, connected to Arlocal at the provided port. diff --git a/tests/utils/index.ts b/tests/utils/index.ts index f8ca64a..880ce85 100644 --- a/tests/utils/index.ts +++ b/tests/utils/index.ts @@ -1,8 +1,8 @@ +import type {Warp, JWKInterface} from 'warp-contracts'; import {randomBytes} from 'crypto'; -import {Warp, JWKInterface} from 'warp-contracts'; import {readFileSync} from 'fs'; -import {deploy} from '../../src/bin/deploy'; import {computeKey} from 'hollowdb-prover'; +import {deploy} from '../../src/bin/deploy'; import {ContractState} from '../../src/contracts/types'; /** Add funds to any wallet. */