fix: cleanup chain-sdk migration (addresses PR #14 review)#16
Merged
zJuuu merged 11 commits intoMar 30, 2026
Conversation
BREAKING CHANGE: Migrates from deprecated @akashnetwork/akashjs and @akashnetwork/akash-api packages to the new @akashnetwork/chain-sdk package. Key changes: - Update dependencies to use @akashnetwork/chain-sdk@1.0.0-alpha.18 - Require Node.js >= 22.0.0 - Update all tools to use new chain SDK API: - deployment v1beta4 (was v1beta3) - market v1beta5 (was v1beta4) - escrow v1 - provider v1beta4 (was v1beta3) - cert v1 - Update type definitions for new SDK interfaces - Use createChainNodeSDK for queries and transactions - Use createStargateClient for signing operations - Update field names: version -> hash for deployments - Add bseq field to BidID and LeaseID - Update Lease.id (was Lease.leaseId) and Bid.id (was Bid.bidId) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Set up vitest testing framework with coverage support - Add unit tests for create-output utility function - Add tests for tool handlers: - get-account-addr: metadata and handler tests - get-bids: parameter validation and handler tests - get-balances: parameter validation and handler tests - create-deployment: parameter validation and error handling tests - create-lease: parameter validation and handler tests - close-deployment: parameter validation and handler tests - All 65 tests passing 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add exec-command tool for running shell commands in containers - Add get-logs tool for retrieving container logs via WebSocket - Add certificate management tools (revoke, revoke-all, regenerate) - Add deployment audit scripts and documentation - Improve send-manifest with better mTLS handling - Add reloadCertificate method for dynamic cert refresh 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- New MCP tool to check if a provider is safe for a deployment - Prevents NAT hairpin issues by blocking proxy's provider for backend services - Parameters: provider (address), serviceType (proxy|backend|standalone) - Returns safety status with detailed reason Usage: mcp__akash__check-provider-safety with provider and serviceType 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Increased gasMultiplier from default 1.3 to 2.0 - Resolves transaction code 11 (out of gas) errors when updating deployments - The default multiplier was insufficient for deployment update transactions Fixes alternatefutures/infrastructure-proxy proxy update issue Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- get-deployment now includes: - Resource totals (CPU, memory, storage, GPU) calculated from groups - Lease information with provider details (hostUri, attributes, info) - Lease pricing information - Created height for timeline tracking - get-bids now includes: - Provider information (hostUri, attributes, info) for each bid - Helps users make better decisions when selecting bids These changes align with the context displayed in the Akash Console, providing more visibility into deployments and provider capabilities. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Added comprehensive documentation of the context field enhancements made to get-deployment and get-bids tools. This includes resource totals, lease information, provider details, and timeline tracking. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Addresses all 7 cleanup items from maintainer (zJuuu) review on PR akash-network#14: 1. Remove org-specific code: delete check-provider-safety.ts (hardcoded provider addresses), AUDIT_REPORT.md, SECRETS.md, IMPROVEMENTS.md, and 10 fork-specific debug scripts in scripts/ 2. Remove unused client parameter from loadCertificate() signature and all call sites 3. Fix certificate fallback: throw error when chainSDK is unavailable instead of silently saving cert locally (providers won't recognize unbroadcast certificates) 4. Move @types/ws from dependencies to devDependencies 5. Deduplicate pemToUint8Array: extract to shared util in load-certificate.ts, import in regenerate-certificate.ts 6. Replace all `any` types with proper types: CertificatePem for certificate params, local interfaces for chain SDK responses, `error: unknown` with instanceof guards for catch blocks 7. Move tests from src/ to tests/ directory mirroring src/ structure, update import paths and vitest config Build passes, all 65 tests pass. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add validateMnemonic() that fails fast with a clear error if AKASH_MNEMONIC is missing or not 12/24 words - Validation runs at wallet creation (not module import) so tests that mock the wallet aren't broken - Add null guard in getToolContext(): throw explicit error if no certificate is available (disk or memory) instead of passing stale/null cert that causes silent 401s from providers Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
zJuuu
approved these changes
Mar 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR builds on top of PR #14 (rebased on latest
main) and addresses all 7 cleanup items identified by maintainer @zJuuu in the review:check-provider-safety.ts(hardcoded AlternateFutures provider addresses),AUDIT_REPORT.md,SECRETS.md,IMPROVEMENTS.md, and all 10 fork-specific debug scripts inscripts/clientparameter — Removed fromloadCertificate()signature and all call siteschainSDKis unavailable instead of silently saving locally (providers reject unbroadcast certificates)@types/wsto devDependencies — Type packages are build-time onlypemToUint8Array— Extracted to shared util inload-certificate.ts, imported inregenerate-certificate.tsanytypes —CertificatePemfor certificate params, local interfaces for chain SDK responses,error: unknownwithinstanceofguards across all catch blockssrc/totests/directory mirroringsrc/structure, updated import paths and vitest configAlso fixed: unused
ResourceDefinitionimport inget-sdl.ts, unusedextraparameter in all tool registrations, explicit WebSocket event handler types.Relationship to PR #14
This PR includes all commits from PR #14 (by @wonderwomancode), rebased on latest
mainto resolve merge conflicts, plus the cleanup commit. If merged, PR #14 can be closed.Test plan
npm run build— passes (zero TypeScript errors)npm test— 65/65 tests passanytypes insrc/(verified with grep)🤖 Generated with Claude Code