Skip to content

docs: add comprehensive JSDoc documentation for @autonomys/auto-utils package #434

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jun 26, 2025

Conversation

cursor[bot]
Copy link

@cursor cursor bot commented Jun 26, 2025

📚 Add Comprehensive JSDoc Documentation for @autonomys/auto-utils

This PR adds comprehensive JSDoc documentation to the @autonomys/auto-utils package, following the same high-quality documentation standard established in PR #432.

🎯 What Changed

Added complete JSDoc documentation for all exported functions in the auto-utils package, organized into focused atomic commits:

Core Utility Functions

  • Address utilities: address(), decode() - SS58 address conversion and decoding
  • Crypto functions: blake2b_256(), stringToUint8Array(), concatenateUint8Arrays() - Cryptographic operations
  • String utilities: stringify(), shortString(), capitalizeFirstLetter(), fixLengthEntryId() - String manipulation
  • Number utilities: parseTokenAmount(), formatTokenAmount(), formatSpacePledged() - Token and space formatting

API and Network Functions

  • API management: createConnection(), activate(), activateDomain(), disconnect() - Network connections
  • Network operations: getNetworkDetails(), getNetworkRpcUrls(), getNetworkDomainDetails(), getNetworkDomainRpcUrls() - Network configuration

Wallet Functions

  • Wallet management: setupWallet(), generateWallet(), activateWallet() - Wallet creation and activation
  • Development utilities: mockWallets(), getMockWallet() - Testing and development helpers

Transaction and Event Utilities

  • Transaction handling: signAndSendTx() - Comprehensive transaction lifecycle management
  • Signing operations: signMessage(), signingKey(), signatureVerify() - Message signing and verification
  • Event validation: validateEvents(), eventName(), expectSuccessfulTxEvent() - Event monitoring

Additional Utilities

  • Transaction success detection: detectTxSuccess()
  • Format, verify, and crypto initialization utilities

Documentation Features

  • 🎯 TypeScript Integration: Fully typed documentation with excellent IDE support
  • 📋 Copy-Paste Examples: Ready-to-use code examples for every function
  • ⚠️ Error Handling: Comprehensive @throws tags documenting common error scenarios
  • 🌐 Real-World Usage: Examples using current network IDs (taurus, gemini-3h, localhost)
  • 🔗 Cross-References: Related functions and consistent patterns throughout
  • 🏆 Best Practices: Examples follow TypeScript preferences and immutability patterns

🔍 Quality Assurance

  • ✅ All TypeScript compilation checks passed
  • ✅ Consistent formatting across all documentation
  • ✅ Examples tested and verified to work
  • ✅ Proper JSDoc syntax for optimal IDE integration
  • ✅ 5 focused, atomic commits telling the story of the changes

🚀 Impact

This significantly improves the developer experience by providing the same high-quality documentation standard established in PR #432, making the @autonomys/auto-utils package much more accessible and easier to use for developers building on the Autonomys Network.

Complete the necessary changes to complete this task. Make sure the commits are atomic and descriptive. They should tell a story of the changes made. Implement the changes in the most simple way possible, each change should be well thought out. Adhere strictly to the code style and structure of the project.

- Add comprehensive documentation for address utility functions (address, decode)
- Add documentation for crypto functions (blake2b_256, stringToUint8Array, concatenateUint8Arrays)
- Add documentation for string utility functions (stringify, shortString, capitalizeFirstLetter, fixLengthEntryId)
- Add documentation for number utility functions (parseTokenAmount, formatTokenAmount, formatSpacePledged)
- Include parameter descriptions, return types, examples, and error handling
- Add documentation for API functions (createConnection, activate, activateDomain, disconnect)
- Add documentation for network functions (getNetworkDetails, getNetworkRpcUrls, getNetworkDomainDetails, getNetworkDomainRpcUrls)
- Include comprehensive examples showing network connections and domain usage
- Document error handling for connection failures and invalid network/domain IDs
- Provide examples for mainnet, testnet, and localhost environments
- Add documentation for setupWallet function for creating wallets from mnemonic/URI
- Add documentation for generateWallet function for creating new random wallets
- Add documentation for activateWallet function for comprehensive wallet activation
- Add documentation for mockWallets function for creating development test wallets
- Add documentation for getMockWallet function for retrieving specific mock wallets
- Include examples for Node.js and browser environments, different key types
- Document support for mainnet, testnet, domain connections, and mock development accounts
…ions

- Add comprehensive documentation for signAndSendTx function with transaction lifecycle handling
- Add documentation for sign utility functions (signMessage, signingKey, signatureVerify)
- Add documentation for events utility functions (eventName, eventsGroup, expectSuccessfulTxEvent)
- Add documentation for validateEvents function with event validation patterns
- Include examples for transaction signing, event validation, and error handling
- Document support for custom error mapping and complex event patterns
- Add documentation for detectTxSuccess function for transaction success detection
- Add documentation for format utility re-exports (stringToU8a, u8aToHex)
- Add documentation for verify utility re-exports (isAddress, isHex)
- Add documentation for ready utility re-export (cryptoWaitReady)
- Include examples for transaction monitoring, data conversion, validation, and crypto initialization
- Complete JSDoc coverage for all major utility functions in auto-utils package
@cursor cursor bot requested review from jfrank-summit and Xm0onh as code owners June 26, 2025 02:09
- Simplify JSDoc for re-exported Polkadot.js utilities (format, verify, ready, sign)
- Remove verbose examples that duplicate upstream documentation
- Add clear references to official Polkadot.js documentation
- Focus on Autonomys-specific context and convenience rationale
- Maintain essential function descriptions while reducing maintenance overhead
@jfrank-summit jfrank-summit force-pushed the cursor/add-documentation-for-auto-utils-04a4 branch from 91e19ce to 4a8c186 Compare June 26, 2025 14:06
@jfrank-summit jfrank-summit merged commit 9041b7d into main Jun 26, 2025
2 checks passed
@jfrank-summit jfrank-summit deleted the cursor/add-documentation-for-auto-utils-04a4 branch June 26, 2025 21:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants