From 7eeb62a4f3b0d75ea8409f52b7652ef0d5a2aa31 Mon Sep 17 00:00:00 2001 From: PSkinnerTech Date: Mon, 30 Dec 2024 15:28:25 -0500 Subject: [PATCH 1/3] fix:findable keyfile variations --- docs/QA_CHECKLIST.md | 10 +++++----- src/utils/wallet.ts | 7 ++++++- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/docs/QA_CHECKLIST.md b/docs/QA_CHECKLIST.md index 560030e8..7a78491d 100644 --- a/docs/QA_CHECKLIST.md +++ b/docs/QA_CHECKLIST.md @@ -4,11 +4,11 @@ This document outlines the manual testing steps to be performed before each rele ## Core Commands - [ ] `--help` displays comprehensive CLI documentation -- [ ] `--init` command - - [ ] Detects existing wallet.json - - [ ] Creates .env file with proper permissions - - [ ] Validates wallet configuration - - [ ] Handles errors gracefully (missing files, invalid wallet) +- [x] `init` command + - [x] Detects existing wallet.json + - [x] Creates .env file with proper permissions + - [x] Validates wallet configuration + - [x] Handles errors gracefully (missing files, invalid wallet) ## Check Commands - [ ] `--check-wallet` diff --git a/src/utils/wallet.ts b/src/utils/wallet.ts index f23c6fc1..719a1270 100644 --- a/src/utils/wallet.ts +++ b/src/utils/wallet.ts @@ -8,7 +8,12 @@ import inquirer from 'inquirer'; import { formatSuccess, formatError, formatWarning } from './display.js'; export function checkWalletExists(): boolean { - return fs.existsSync(path.join(process.cwd(), 'wallet.json')); + const dir = process.cwd(); + const files = fs.readdirSync(dir); + + return files.some(file => + file === 'wallet.json' || /^keyfile.*\.json$/.test(file) + ); } export function checkWalletEncoded(): boolean { From 403adaecabefc96e2203d1e0ab9fcf3b9df09e74 Mon Sep 17 00:00:00 2001 From: PSkinnerTech Date: Thu, 2 Jan 2025 20:19:35 -0500 Subject: [PATCH 2/3] fix: ant check output --- docs/ROADMAP.md | 40 +++++---- package-lock.json | 149 +++++++++++++++++++------------- src/commands/checks/antCheck.ts | 14 ++- 3 files changed, 122 insertions(+), 81 deletions(-) diff --git a/docs/ROADMAP.md b/docs/ROADMAP.md index 2563e138..fb1758f4 100644 --- a/docs/ROADMAP.md +++ b/docs/ROADMAP.md @@ -5,6 +5,7 @@ - [x] `--prelaunch-checklist` comprehensive deployment readiness check (2024-12-19) - [x] Individual check commands: - [x] `--check-wallet` (2024-12-19) + - [x] Enhanced wallet detection for keyfile*.json (2024-12-26) - [x] `--check-balances` (2024-12-19) - [x] `--check-build` (2024-12-19) - [x] `--check-ant` (2024-12-19) @@ -14,6 +15,7 @@ - [x] Secure .env file creation - [x] File permission handling - [x] Comprehensive validation + - [x] Improved UX for wallet encoding (2024-12-26) - [x] Optimize `--launch` command: - [x] Make GIT HASH optional (2024-12-19) - [x] Make ANT PROCESS optional (2024-12-19) @@ -30,25 +32,25 @@ - [ ] Complete test coverage (moved to Short-term Goals) ## Short-term Goals -- [ ] Complete security test implementation - - [ ] Fix Jest mock type issues - - [ ] Add proper fs mocking setup - - [ ] Complete test coverage for security utils -- [ ] Complete balance check test implementation - - [ ] Fix TypeScript mock issues - - [ ] Add edge case coverage - - [ ] Improve error scenario testing -- [ ] Add automated code quality checks - - [ ] ESLint configuration - - [ ] Prettier setup - - [ ] Breaking change detection -- [ ] Implement security best practices - - [ ] API key management - - [ ] Wallet operation patterns - - [ ] ANT security guidelines -- [ ] Add comprehensive test suite -- [ ] Upload to npm -- [ ] Add CI/CD pipeline +- [x] Complete security test implementation + - [x] Fix Jest mock type issues + - [x] Add proper fs mocking setup + - [x] Complete test coverage for security utils +- [x] Complete balance check test implementation + - [x] Fix TypeScript mock issues + - [x] Add edge case coverage + - [x] Improve error scenario testing +- [x] Add automated code quality checks + - [x] ESLint configuration + - [x] Prettier setup + - [x] Breaking change detection +- [x] Implement security best practices + - [x] API key management + - [x] Wallet operation patterns + - [x] ANT security guidelines +- [x] Add comprehensive test suite +- [x] Upload to npm +- [x] Add CI/CD pipeline - [ ] Develop a `--configure-ant` wizard for easily selecting ARNS domains - [ ] Add support for custom manifest configurations - [ ] Implement deployment progress bar diff --git a/package-lock.json b/package-lock.json index 4542bff1..13d52901 100644 --- a/package-lock.json +++ b/package-lock.json @@ -71,15 +71,15 @@ } }, "node_modules/@ar.io/sdk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@ar.io/sdk/-/sdk-3.0.0.tgz", - "integrity": "sha512-EIplLoLrMnCSqRX5Z3cruGwe41b3TCfwAM0YmEC4yxFmin3hYhjvx8aNhf3jn/c0HEdGpRcESYYHvfPLUpvHpg==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@ar.io/sdk/-/sdk-3.1.0.tgz", + "integrity": "sha512-ePtvVcffzJcU+LoHqjL0RwJeS/3dCgEolWw7/ywIWwXvzYbbhASdNdBEb6/Liz8baMO/GYsaUGVSpnjmVKC0aw==", "license": "Apache-2.0", "dependencies": { "@dha-team/arbundles": "^1.0.1", "@permaweb/aoconnect": "^0.0.57", "arweave": "1.14.4", - "axios": "1.7.8", + "axios": "1.7.9", "axios-retry": "^4.3.0", "commander": "^12.1.0", "eventemitter3": "^5.0.1", @@ -2692,25 +2692,13 @@ "license": "MIT" }, "node_modules/@noble/curves": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.7.0.tgz", - "integrity": "sha512-UTMhXK9SeDhFJVrHeUJ5uZlI6ajXg10O6Ddocf9S6GjbSBVZsJo88HzKwXznNfGpMTRDyJkqMjNDPYgf0qFWnw==", + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.8.0.tgz", + "integrity": "sha512-j84kjAbzEnQHaSIhRPUmB3/eVXu2k3dKPl2LOrR8fSOIL+89U+7lV117EWHtq/GHM3ReGHM46iRBdZfpc4HRUQ==", "license": "MIT", "dependencies": { - "@noble/hashes": "1.6.0" - }, - "engines": { - "node": "^14.21.3 || >=16" + "@noble/hashes": "1.7.0" }, - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, - "node_modules/@noble/curves/node_modules/@noble/hashes": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.6.0.tgz", - "integrity": "sha512-YUULf0Uk4/mAA89w+k3+yUYh6NrEvxZa5T6SY3wlMvE2chHkxFUUIDI8/XW1QSC357iA5pSnqt7XEhvFOqmDyQ==", - "license": "MIT", "engines": { "node": "^14.21.3 || >=16" }, @@ -2731,9 +2719,9 @@ "license": "MIT" }, "node_modules/@noble/hashes": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.6.1.tgz", - "integrity": "sha512-pq5D8h10hHBjyqX+cfBm0i8JUXJ0UhczFc4r74zbuT9XgewFo2E3J1cOaGtdZynILNmQ685YWGzGE1Zv6io50w==", + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.7.0.tgz", + "integrity": "sha512-HXydb0DgzTpDPwbVeDGCG1gIu7X6+AuU6Zl6av/E/KG8LMsvPntvq+w17CHRpKBmN6Ybdrt1eP3k4cj8DJa78w==", "license": "MIT", "engines": { "node": "^14.21.3 || >=16" @@ -3243,9 +3231,9 @@ } }, "node_modules/@types/node": { - "version": "22.10.2", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.10.2.tgz", - "integrity": "sha512-Xxr6BBRCAOQixvonOye19wnzyDiUtTeqldOOmj3CkeblonbccA12PFwlufvRdrpjXxqnmUaeiU5EOA+7s5diUQ==", + "version": "22.10.4", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.10.4.tgz", + "integrity": "sha512-99l6wv4HEzBQhvaU/UGoeBoCK61SCROQaCCGyQSgX2tEQ3rKkNZ2S7CEWnS/4s1LV+8ODdK21UeyR1fHP2mXug==", "license": "MIT", "dependencies": { "undici-types": "~6.20.0" @@ -5472,9 +5460,9 @@ } }, "node_modules/es-abstract": { - "version": "1.23.8", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.23.8.tgz", - "integrity": "sha512-lfab8IzDn6EpI1ibZakcgS6WsfEBiB+43cuJo+wgylx1xKXf+Sp+YR3vFuQwC/u3sxYwV8Cxe3B0DpVUu/WiJQ==", + "version": "1.23.9", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.23.9.tgz", + "integrity": "sha512-py07lI0wjxAC/DcfK1S6G7iANonniZwTISvdPzk9hzeH0IZIshbuuFxLIU96OyF89Yb9hiqWn8M/bY83KY5vzA==", "dev": true, "license": "MIT", "dependencies": { @@ -5489,10 +5477,11 @@ "es-define-property": "^1.0.1", "es-errors": "^1.3.0", "es-object-atoms": "^1.0.0", - "es-set-tostringtag": "^2.0.3", + "es-set-tostringtag": "^2.1.0", "es-to-primitive": "^1.3.0", "function.prototype.name": "^1.1.8", - "get-intrinsic": "^1.2.6", + "get-intrinsic": "^1.2.7", + "get-proto": "^1.0.0", "get-symbol-description": "^1.1.0", "globalthis": "^1.0.4", "gopd": "^1.2.0", @@ -5513,11 +5502,12 @@ "object-inspect": "^1.13.3", "object-keys": "^1.1.1", "object.assign": "^4.1.7", - "own-keys": "^1.0.0", + "own-keys": "^1.0.1", "regexp.prototype.flags": "^1.5.3", "safe-array-concat": "^1.1.3", "safe-push-apply": "^1.0.0", "safe-regex-test": "^1.1.0", + "set-proto": "^1.0.0", "string.prototype.trim": "^1.2.10", "string.prototype.trimend": "^1.0.9", "string.prototype.trimstart": "^1.0.8", @@ -5566,15 +5556,16 @@ } }, "node_modules/es-set-tostringtag": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.0.3.tgz", - "integrity": "sha512-3T8uNMC3OQTHkFUsFq8r/BwAXLHvU/9O9mE0fBc/MY5iq/8H7ncvO947LmYA6ldWw9Uh8Yhf25zu6n7nML5QWQ==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz", + "integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==", "dev": true, "license": "MIT", "dependencies": { - "get-intrinsic": "^1.2.4", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6", "has-tostringtag": "^1.0.2", - "hasown": "^2.0.1" + "hasown": "^2.0.2" }, "engines": { "node": ">= 0.4" @@ -6583,21 +6574,21 @@ } }, "node_modules/get-intrinsic": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.6.tgz", - "integrity": "sha512-qxsEs+9A+u85HhllWJJFicJfPDhRmjzoYdl64aMWW9yRIJmSyxdn8IEkuIM530/7T+lv0TIHd8L6Q/ra0tEoeA==", + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.7.tgz", + "integrity": "sha512-VW6Pxhsrk0KAOqs3WEd0klDiF/+V7gQOpAvY1jVU/LHmaD/kQO4523aiJuikX/QAKYiW6x8Jh+RJej1almdtCA==", "license": "MIT", "dependencies": { "call-bind-apply-helpers": "^1.0.1", - "dunder-proto": "^1.0.0", "es-define-property": "^1.0.1", "es-errors": "^1.3.0", "es-object-atoms": "^1.0.0", "function-bind": "^1.1.2", + "get-proto": "^1.0.0", "gopd": "^1.2.0", "has-symbols": "^1.1.0", "hasown": "^2.0.2", - "math-intrinsics": "^1.0.0" + "math-intrinsics": "^1.1.0" }, "engines": { "node": ">= 0.4" @@ -6616,6 +6607,19 @@ "node": ">=8.0.0" } }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/get-starknet-core": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/get-starknet-core/-/get-starknet-core-4.0.0.tgz", @@ -7170,13 +7174,16 @@ "license": "MIT" }, "node_modules/is-async-function": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-async-function/-/is-async-function-2.0.0.tgz", - "integrity": "sha512-Y1JXKrfykRJGdlDwdKlLpLyMIiWqWvuSd17TvZk68PLAOGOoF4Xyav1z0Xhoi+gCYjZVeC5SI+hYFOfvXmGRCA==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-async-function/-/is-async-function-2.1.0.tgz", + "integrity": "sha512-GExz9MtyhlZyXYLxzlJRj5WUCE661zhDa1Yna52CN57AJsymh+DvXXjyveSioqSRdxvUrdKdvqB1b5cVKsNpWQ==", "dev": true, "license": "MIT", "dependencies": { - "has-tostringtag": "^1.0.0" + "call-bound": "^1.0.3", + "get-proto": "^1.0.1", + "has-tostringtag": "^1.0.2", + "safe-regex-test": "^1.1.0" }, "engines": { "node": ">= 0.4" @@ -7338,13 +7345,16 @@ } }, "node_modules/is-generator-function": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.10.tgz", - "integrity": "sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.1.0.tgz", + "integrity": "sha512-nPUB5km40q9e8UfN/Zc24eLlzdSf9OfKByBw9CIdw4H1giPMeA0OIJvbchsCu4npfI2QcMVBsGEBHKZ7wLTWmQ==", "dev": true, "license": "MIT", "dependencies": { - "has-tostringtag": "^1.0.0" + "call-bound": "^1.0.3", + "get-proto": "^1.0.0", + "has-tostringtag": "^1.0.2", + "safe-regex-test": "^1.1.0" }, "engines": { "node": ">= 0.4" @@ -9942,19 +9952,19 @@ } }, "node_modules/reflect.getprototypeof": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/reflect.getprototypeof/-/reflect.getprototypeof-1.0.9.tgz", - "integrity": "sha512-r0Ay04Snci87djAsI4U+WNRcSw5S4pOH7qFjd/veA5gC7TbqESR3tcj28ia95L/fYUDw11JKP7uqUKUAfVvV5Q==", + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/reflect.getprototypeof/-/reflect.getprototypeof-1.0.10.tgz", + "integrity": "sha512-00o4I+DVrefhv+nX0ulyi3biSHCPDe+yLv5o/p6d/UVlirijB8E16FtfwSAi4g3tcqrQ4lRAqQSoFEZJehYEcw==", "dev": true, "license": "MIT", "dependencies": { "call-bind": "^1.0.8", "define-properties": "^1.2.1", - "dunder-proto": "^1.0.1", - "es-abstract": "^1.23.6", + "es-abstract": "^1.23.9", "es-errors": "^1.3.0", - "get-intrinsic": "^1.2.6", - "gopd": "^1.2.0", + "es-object-atoms": "^1.0.0", + "get-intrinsic": "^1.2.7", + "get-proto": "^1.0.1", "which-builtin-type": "^1.2.1" }, "engines": { @@ -9971,15 +9981,17 @@ "license": "MIT" }, "node_modules/regexp.prototype.flags": { - "version": "1.5.3", - "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.3.tgz", - "integrity": "sha512-vqlC04+RQoFalODCbCumG2xIOvapzVMHwsyIGM/SIE8fRhFFsXeH8/QQ+s0T0kDAhKc4k30s73/0ydkHQz6HlQ==", + "version": "1.5.4", + "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.4.tgz", + "integrity": "sha512-dYqgNSZbDwkaJ2ceRd9ojCGjBq+mOm9LmtXnAnEGyHhN/5R7iDW2TRw3h+o/jCFxus3P2LfWIIiwowAjANm7IA==", "dev": true, "license": "MIT", "dependencies": { - "call-bind": "^1.0.7", + "call-bind": "^1.0.8", "define-properties": "^1.2.1", "es-errors": "^1.3.0", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", "set-function-name": "^2.0.2" }, "engines": { @@ -10354,6 +10366,21 @@ "node": ">= 0.4" } }, + "node_modules/set-proto": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/set-proto/-/set-proto-1.0.0.tgz", + "integrity": "sha512-RJRdvCo6IAnPdsvP/7m6bsQqNnn1FCBX5ZNtFL98MmFF/4xAIJTIg1YbHW5DC2W5SKZanrC6i4HsJqlajw/dZw==", + "dev": true, + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/sha.js": { "version": "2.4.11", "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", diff --git a/src/commands/checks/antCheck.ts b/src/commands/checks/antCheck.ts index 4f13d02b..3bc083a4 100644 --- a/src/commands/checks/antCheck.ts +++ b/src/commands/checks/antCheck.ts @@ -5,13 +5,25 @@ import { formatSuccess, formatError, formatWarning, + formatHighlight, delay } from '../../utils/index.js'; import { CheckResult } from './index.js'; export async function runAntCheck(antProcess?: string, undername: string = '@'): Promise { - // Only run if ANT process is provided + console.log('\n\x1b[35mCHECK ANT:\x1b[0m'); + + // If no ANT process provided, show the informative message if (!antProcess) { + console.log(formatWarning('[ ] No ANT Process configured')); + console.log(formatWarning('\nThe ANT isn\'t required to deploy your app onto Arweave, but you should understand')); + console.log(formatWarning('that your app\'s url will look something like:')); + console.log(formatError('https://arweave.net/[very-long-hash]')); + console.log(formatWarning('rather than something like:')); + console.log(formatHighlight('https://your-app.ar.io')); + console.log(formatWarning('\nTo learn more about ANTs and get your own domain, visit:')); + console.log(formatHighlight('https://ar.io/docs\n')); + return { success: true, message: 'ANT check skipped - no ANT process provided' From e6cf88ed1f7766397a7c48c4ea136507ac7a2d69 Mon Sep 17 00:00:00 2001 From: PSkinnerTech Date: Sat, 4 Jan 2025 21:44:11 -0500 Subject: [PATCH 3/3] fix: switch getARNSRecords for ANGRegistry --- package-lock.json | 6 +- src/commands/checks/antCheck.ts | 94 +++-------------------- src/commands/checks/prelaunchChecklist.ts | 2 +- src/commands/index.ts | 2 +- 4 files changed, 17 insertions(+), 87 deletions(-) diff --git a/package-lock.json b/package-lock.json index 13d52901..2c4d19ab 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3231,9 +3231,9 @@ } }, "node_modules/@types/node": { - "version": "22.10.4", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.10.4.tgz", - "integrity": "sha512-99l6wv4HEzBQhvaU/UGoeBoCK61SCROQaCCGyQSgX2tEQ3rKkNZ2S7CEWnS/4s1LV+8ODdK21UeyR1fHP2mXug==", + "version": "22.10.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.10.5.tgz", + "integrity": "sha512-F8Q+SeGimwOo86fiovQh8qiXfFEh2/ocYv7tU5pJ3EXMSSxk1Joj5wefpFK2fHTf/N6HKGSxIDBT9f3gCxXPkQ==", "license": "MIT", "dependencies": { "undici-types": "~6.20.0" diff --git a/src/commands/checks/antCheck.ts b/src/commands/checks/antCheck.ts index 3bc083a4..df1c7241 100644 --- a/src/commands/checks/antCheck.ts +++ b/src/commands/checks/antCheck.ts @@ -1,96 +1,26 @@ -import { - checkAntProcess, - validateAntConfig, - getAntUrl, - formatSuccess, - formatError, - formatWarning, - formatHighlight, - delay -} from '../../utils/index.js'; +import { ANTRegistry } from '@ar.io/sdk'; +import { formatSuccess, formatError } from '../../utils/index.js'; +import { getWalletAddress } from '../../utils/wallet.js'; import { CheckResult } from './index.js'; -export async function runAntCheck(antProcess?: string, undername: string = '@'): Promise { - console.log('\n\x1b[35mCHECK ANT:\x1b[0m'); - - // If no ANT process provided, show the informative message - if (!antProcess) { - console.log(formatWarning('[ ] No ANT Process configured')); - console.log(formatWarning('\nThe ANT isn\'t required to deploy your app onto Arweave, but you should understand')); - console.log(formatWarning('that your app\'s url will look something like:')); - console.log(formatError('https://arweave.net/[very-long-hash]')); - console.log(formatWarning('rather than something like:')); - console.log(formatHighlight('https://your-app.ar.io')); - console.log(formatWarning('\nTo learn more about ANTs and get your own domain, visit:')); - console.log(formatHighlight('https://ar.io/docs\n')); - - return { - success: true, - message: 'ANT check skipped - no ANT process provided' - }; - } - - process.stdout.write('\n\x1b[33mCHECKING ANT CONFIG...\x1b[0m'); - await delay(2000); - - // Clear the "CHECKING ANT CONFIG..." line - process.stdout.clearLine(0); - process.stdout.cursorTo(0); - - console.log('\n\x1b[35mCHECK ANT:\x1b[0m'); - +export async function runAntCheck(): Promise { try { - // Check if ANT process is valid - const isValidProcess = checkAntProcess(antProcess); - if (!isValidProcess) { - console.log(formatError('[ ] Invalid ANT process')); - return { - success: false, - message: 'Invalid ANT process' - }; - } - - console.log(formatSuccess(`[ x ] ANT process: ${antProcess}`)); - - // Check if DEPLOY_KEY is configured - if (!process.env.DEPLOY_KEY) { - console.log(formatError('[ ] No DEPLOY_KEY configured')); - return { - success: false, - message: 'DEPLOY_KEY environment variable not found' - }; - } - - // Validate ANT configuration - const isValid = await validateAntConfig(antProcess, undername); - - if (!isValid) { - console.log(formatError('[ ] ANT validation failed')); - console.log(formatWarning('\nPossible issues:')); - console.log(formatWarning('1. The ANT process ID might be incorrect')); - console.log(formatWarning('2. Your wallet might not have permission to update this ANT')); - console.log(formatWarning('3. The undername might not be available')); - return { - success: false, - message: 'ANT validation failed' - }; - } - - console.log(formatSuccess('[ x ] ANT validation passed')); + const address = await getWalletAddress(); + const registry = ANTRegistry.init(); + const { Owned } = await registry.accessControlList({ address }); - // Display the future URL - const antUrl = getAntUrl(antProcess, undername); - console.log(formatSuccess(`[ x ] Future URL: ${antUrl}`)); + console.log(`\nANTs for wallet ${address}:`); + Owned.forEach((ant: string) => console.log(formatSuccess(ant))); return { success: true, - message: 'ANT check passed' + message: `Found ${Owned.length} ANTs` }; } catch (error) { - console.error(formatError('\nError during ANT check:'), error); + console.error(formatError('Error:'), error); return { success: false, message: error instanceof Error ? error.message : 'Unknown error during ANT check' }; } -} +} \ No newline at end of file diff --git a/src/commands/checks/prelaunchChecklist.ts b/src/commands/checks/prelaunchChecklist.ts index 74d77f3d..0741120e 100644 --- a/src/commands/checks/prelaunchChecklist.ts +++ b/src/commands/checks/prelaunchChecklist.ts @@ -58,7 +58,7 @@ export async function runPrelaunchChecklist(argv: DeployArgs): Promise { } if (argv['check-ant']) { - const result = await runAntCheck(argv.antProcess, argv.undername); + const result = await runAntCheck(); console.log(result); return; }