-
Fork the Repository: Click the "Fork" button at the top-right corner of this repository to create your own copy.
-
Or Clone the Repository: Clone this repository to your local machine using
git clone https://github.com/mickymultani/OCR-Service.git
. -
Install Dependencies:
cd OCR-Service
and thennpm install
to install the required dependencies. -
Testing:
- Run
npx hardhat test
to run the tests - If all tests pass, follow the steps outlined below to test various functions of the OnchainID contract on the hardhat local network
- Run
npx hardhat node
npx hardhat run scripts/deploy.js --network localhost
npx hardhat console --network localhost
Attach contract instance:
const [signer] = await ethers.getSigners();
const OnchainID = await ethers.getContractFactory("OnchainID");
const onchainID = await OnchainID.attach("deployed_contract_address_here");
Declare the variables:
let email;
let userkyc;
Register new user:
await onchainID.registerUser();
Retrieve user info:
const userInfo = await onchainID.getUserInfo(signer.address);
console.log(userInfo);
Adding a new email attribute:
await onchainID.addOrUpdateAttribute("email", "[email protected]");
Retrieve the email attribute and store it in the 'email' variable:
email = await onchainID.getAttribute("email");
console.log("Email attribute:", email);
Updating the email attribute:
await onchainID.addOrUpdateAttribute("email", "[email protected]");
Retrieve the updated email attribute using the same 'email' variable:
email = await onchainID.getAttribute("email");
console.log("Updated email attribute:", email);
Set KYC status:
await onchainID.updateKYCStatus("KYC Approved");
Retrieve and print the KYC status:
userkyc = await onchainID.getKYCStatus(signer.address);
console.log("KYC Status:", userkyc);
Update KYC status:
await onchainID.updateKYCStatus("KYC Not Approved");
Retrieve and print the updated KYC status:
userkyc = await onchainID.getKYCStatus(signer.address);
console.log("Updated KYC Status:", userkyc);
If you'd like to contribute to this project, please fork the repository, make your changes, and submit a pull request. Contributions are welcome!
This project is licensed under the MIT License.