I expect the modules from the @celo/identity library to be imported without errors, allowing for successful execution of the code. Specifically, I expect the following imports to work correctly:
import { OdisUtils } from "@celo/identity";
import {
AuthSigner,
OdisContextName,
ServiceContext,
} from "@celo/identity/lib/odis/query";
Current Behavior
The current behavior results in an Error [ERR_MODULE_NOT_FOUND] during the importation of specific modules from the @celo/identity library. The error message is as follows:
node:internal/process/esm_loader:97
internalBinding('errors').triggerUncaughtException(
^
Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/Users/jovan/dev/bwc-celo-hackathon/social-connect/node_modules/@celo/identity/lib/odis/query' imported from /Users/jovan/dev/bwc-celo-hackathon/social-connect/index.js
Did you mean to import @celo+identity@5.1.2/node_modules/@celo/identity/lib/odis/query.js?
at new NodeError (node:internal/errors:405:5)
at finalizeResolution (node:internal/modules/esm/resolve:324:11)
at moduleResolve (node:internal/modules/esm/resolve:943:10)
at defaultResolve (node:internal/modules/esm/resolve:1129:11)
at nextResolve (node:internal/modules/esm/loader:163:28)
at ESMLoader.resolve (node:internal/modules/esm/loader:835:30)
at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18)
at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:77:40)
at link (node:internal/modules/esm/module_job:76:36) {
code: 'ERR_MODULE_NOT_FOUND'
}
Additional Information
Here is the relevant code snippet causing the issue:
import { newKit } from "@celo/contractkit";
import { OdisUtils } from "@celo/identity";
import {
AuthSigner,
OdisContextName,
ServiceContext,
} from "@celo/identity/lib/odis/query";
import { config } from "dotenv";
config();
// Replace this with your actual private key
let ISSUER_PRIVATE_KEY = process.env.ISSUER_PRIVATE_KEY;
const kit = new newKit("https://alfajores-forno.celo-testnet.org");
kit.addAccount(ISSUER_PRIVATE_KEY);
const issuerAddress =
kit.web3.eth.accounts.privateKeyToAccount(ISSUER_PRIVATE_KEY).address;
kit.defaultAccount = issuerAddress;
console.log(`Issuer Address: ${issuerAddress}`);
const userPlainIdentifier = process.env.USER_PHONE;
const userAddress = process.env.USER_ADDRESS;
const authSigner = {
authenticationMethod: OdisUtils.Query.AuthenticationMethod.WALLET_KEY,
contractKit: kit,
};
// Record the time when the verification is completed
const attestationVerifiedTime = Date.now();
// Register the user's phone number
const registerPhone = async () => {};
const checkQuota = async () => {
// serviceContext provides the ODIS endpoint and public key
const serviceContext = OdisUtils.Query.getServiceContext(
OdisContextName.ALFAJORES
);
const { remainingQuota } = await OdisUtils.Quota.getPnpQuotaStatus(
issuerAddress,
authSigner,
serviceContext
);
console.log("====================================");
console.log("Remaining Quota: ", remainingQuota);
console.log("====================================");
};
checkQuota();
Environment
Node.js version: v18.17.0
Library version: @celo/identity@5.1.2
OS: macOS
I have followed the documentation precisely, but the issue persists. Any guidance or fix for this problem would be greatly appreciated.
Expected Behavior
I expect the modules from the @celo/identity library to be imported without errors, allowing for successful execution of the code. Specifically, I expect the following imports to work correctly:
Current Behavior
The current behavior results in an Error [ERR_MODULE_NOT_FOUND] during the importation of specific modules from the @celo/identity library. The error message is as follows:
Additional Information
Here is the relevant code snippet causing the issue:
Environment
I have followed the documentation precisely, but the issue persists. Any guidance or fix for this problem would be greatly appreciated.