Skip to content

Conversation

@Beroni
Copy link
Member

@Beroni Beroni commented Jan 27, 2026

Description

Fix encoding of arrayN<T> types in the ABI encoder to properly handle hex strings and Uint8Array inputs for u8 arrays. This is particularly important for encoding hash values (e.g., array32<u8>) which are commonly passed as hex strings.

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📝 Documentation update
  • 🔨 Refactoring (no functional changes)
  • ✅ Test improvements
  • 🔧 Chore (dependencies, build, etc.)

Related Issues

Closes #KLC-2101

Changes Made

  • Add hex string input support for arrayN<u8> types (with and without 0x prefix)
  • Add Uint8Array input support for arrayN<u8> types
  • Add proper validation and error messages for incorrect input lengths
  • Add comprehensive test coverage for fixed-size array encoding

Testing

Test Coverage

  • Unit tests added/updated
  • Integration tests added/updated
  • Manual testing performed

Test Instructions

pnpm test
pnpm build
Changeset
 Changeset created (pnpm changeset)
 Not applicable (documentation, tests, internal changes only)
Checklist
 Code follows project style guidelines
 Self-review of code completed
 Comments added for complex code
 Documentation updated (if needed)
 No new warnings generated
 Tests added/updated and passing
 Type checking passes (pnpm typecheck)
 Linting passes (pnpm lint)
 Build succeeds (pnpm build)

Copilot AI review requested due to automatic review settings January 27, 2026 19:24
@github-actions
Copy link

github-actions bot commented Jan 27, 2026

Dependency Review

The following issues were found:
  • ✅ 0 vulnerable package(s)
  • ✅ 0 package(s) with incompatible licenses
  • ✅ 0 package(s) with invalid SPDX license definitions
  • ⚠️ 1 package(s) with unknown licenses.
See the Details below.

License Issues

pnpm-lock.yaml

PackageVersionLicenseIssue Type
lodash4.17.23NullUnknown License

OpenSSF Scorecard

PackageVersionScoreDetails
npm/lodash 4.17.23 🟢 6.8
Details
CheckScoreReason
Binary-Artifacts🟢 10no binaries found in the repo
Branch-Protection⚠️ -1internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration
CI-Tests🟢 715 out of 21 merged PRs checked by a CI test -- score normalized to 7
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Code-Review🟢 6Found 20/30 approved changesets -- score normalized to 6
Contributors🟢 10project has 88 contributing companies or organizations
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Dependency-Update-Tool🟢 10update tool detected
Fuzzing🟢 10project is fuzzed
License🟢 9license file detected
Maintained🟢 1011 commit(s) and 19 issue activity found in the last 90 days -- score normalized to 10
Packaging⚠️ -1packaging workflow not detected
Pinned-Dependencies⚠️ 1dependency not pinned by hash detected -- score normalized to 1
SAST🟢 8SAST tool detected but not run on all commits
Security-Policy🟢 10security policy file detected
Signed-Releases⚠️ -1no releases found
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
Vulnerabilities⚠️ 078 existing vulnerabilities detected
npm/undici 7.19.1 🟢 8.3
Details
CheckScoreReason
Dependency-Update-Tool🟢 10update tool detected
Code-Review🟢 10all changesets reviewed
Security-Policy🟢 9security policy file detected
Maintained🟢 1030 commit(s) and 18 issue activity found in the last 90 days -- score normalized to 10
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Binary-Artifacts🟢 8binaries present in source code
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
Pinned-Dependencies🟢 4dependency not pinned by hash detected -- score normalized to 4
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Vulnerabilities🟢 100 existing vulnerabilities detected
SAST🟢 9SAST tool detected but not run on all commits
License🟢 10license file detected
Branch-Protection⚠️ -1internal error: error during branchesHandler.setup: internal error: some github tokens can't read classic branch protection rules: https://github.com/ossf/scorecard-action/blob/main/docs/authentication/fine-grained-auth-token.md
Fuzzing🟢 10project is fuzzed
Packaging🟢 10packaging workflow detected
Signed-Releases⚠️ -1no releases found
CI-Tests🟢 1030 out of 30 merged PRs checked by a CI test -- score normalized to 10
Contributors🟢 10project has 80 contributing companies or organizations

Scanned Files

  • pnpm-lock.yaml

@Beroni Beroni changed the base branch from develop to master January 27, 2026 19:25
@github-actions
Copy link

📦 Bundle Size Report

Package Size Gzipped
connect-contracts 87KB 17KB
connect-core 26KB 6KB
connect-crypto 29KB 7KB
connect-encoding 214KB 26KB
connect-provider 48KB 10KB
connect-react 24KB 5KB
connect-transactions 48KB 10KB
connect-wallet 59KB 10KB
connect 8KB 1KB

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a bug in the ABI encoder's handling of fixed-size arrays and adds comprehensive HD wallet and keystore functionality to the SDK.

Changes:

  • Fixes encoding of arrayN<u8> types to accept hex strings and Uint8Array inputs, particularly important for encoding hash values (e.g., array32<u8>)
  • Adds BIP39/BIP44 HD wallet support with mnemonic generation and key derivation using SLIP-10 Ed25519
  • Adds Web3 Secret Storage (keystore) encryption/decryption with AES-256-GCM and scrypt KDF
  • Extends WalletFactory with methods to create wallets from mnemonics, keystores, and random generation
  • Adds encrypt() methods to NodeWallet and BrowserWallet for keystore creation

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/connect-contracts/src/encoder/abi-encoder.ts Adds hex string and Uint8Array input support for arrayN types with validation
packages/connect-contracts/src/tests/encoder.test.ts Comprehensive test coverage for fixed-size array encoding with various input formats
packages/connect-crypto/src/slip10-ed25519.ts New SLIP-10 Ed25519 key derivation implementation for BIP44 paths
packages/connect-crypto/src/hd-wallet.ts New HD wallet functions for mnemonic generation, validation, and key derivation
packages/connect-crypto/src/keystore.ts New Web3 Secret Storage keystore encryption/decryption with AES-256-GCM
packages/connect-crypto/src/tests/keystore.test.ts Comprehensive keystore encryption/decryption tests
packages/connect-crypto/src/tests/hd-wallet.test.ts Comprehensive HD wallet tests covering all mnemonic and derivation functions
packages/connect-crypto/src/tests/index.test.ts Integration tests for new crypto exports
packages/connect-crypto/src/index.ts Exports for new HD wallet and keystore functionality
packages/connect-crypto/package.json Adds @scure/bip32 dependency for BIP32 derivation
packages/connect-wallet/src/wallet-factory.ts Adds createRandom(), fromMnemonic(), fromEncryptedJson(), and mnemonicToPrivateKey() methods
packages/connect-wallet/src/types/wallet.ts Adds optional encrypt() method to Wallet interface
packages/connect-wallet/src/node/index.ts Adds encrypt() method and protected getPrivateKey()
packages/connect-wallet/src/browser/index.ts Adds encrypt() method with extension mode check
packages/connect-wallet/src/index.ts Minor comment removal
tsconfig.base.json Adds "DOM" lib for crypto.subtle API support
pnpm-lock.yaml Dependency updates including glob, js-yaml, and @scure/bip32
package.json Adds overrides for glob and js-yaml

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link

📦 Bundle Size Report

Package Size Gzipped
connect-contracts 87KB 17KB
connect-core 26KB 6KB
connect-crypto 29KB 7KB
connect-encoding 214KB 26KB
connect-provider 48KB 10KB
connect-react 24KB 5KB
connect-transactions 48KB 10KB
connect-wallet 59KB 10KB
connect 8KB 1KB

Copilot AI review requested due to automatic review settings January 27, 2026 19:29
@github-actions
Copy link

📦 Bundle Size Report

Package Size Gzipped
connect-contracts 87KB 17KB
connect-core 26KB 6KB
connect-crypto 29KB 7KB
connect-encoding 214KB 26KB
connect-provider 48KB 10KB
connect-react 24KB 5KB
connect-transactions 48KB 10KB
connect-wallet 59KB 10KB
connect 8KB 1KB

@Beroni
Copy link
Member Author

Beroni commented Jan 27, 2026

FYI: the new array32<u8> encoding implementation was tested locally in the certification project and works as expected.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 4 changed files in this pull request and generated 5 comments.

Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link

📦 Bundle Size Report

Package Size Gzipped
connect-contracts 87KB 17KB
connect-core 26KB 6KB
connect-crypto 29KB 7KB
connect-encoding 214KB 26KB
connect-provider 48KB 10KB
connect-react 24KB 5KB
connect-transactions 48KB 10KB
connect-wallet 59KB 10KB
connect 8KB 1KB

@fbsobreira fbsobreira merged commit 5887b2b into master Feb 2, 2026
9 checks passed
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.

3 participants