Principal Issues when Update NFT count is called

  1. The issue appears to be with how we’re handling the Principal type in the tests, specifically for the updateNFTCount function.

  2. We’ve tried several approaches:

  • Using Principal.fromText() directly

  • Converting Principal to raw bytes using toUint8Array()

  • Using the IDL Principal type (which didn’t work due to type issues)

  1. Key observations:
  • The Rust code correctly uses the Principal type from ic_cdk::export::Principal

  • The Candid interface expects IDL.Principal type

  • The test file that works (wallet.test.ts) uses a different approach with principalArray

  1. Current state:
  • getNFTCountWithProgress works correctly

  • updateNFTCount fails with “Invalid principal argument” error

  • The error occurs in the Candid encoding layer