@tianhr/hedera-document-store
v0.0.3-development
Published
This repository contains both the smart contract code for document store (in `/contracts`) as well as the node package for using this library (in `/src`).
Downloads
2
Readme
Document Store
This repository contains both the smart contract code for document store (in /contracts
) as well as the node package for using this library (in /src
).
Installing Package
npm i @tianhr/hedera-document-store
Package Usage
To use the package, you will need to provide your own Hedera account (if you are writing to the blockchain).
Generate hedera Client
import { deployAndWait } from "@tianhr/hedera-document-store";
const hederaClient = await generateHederaClient(AccountId,Privatekey);
Deploying new document store
import { deployAndWait } from "@tianhr/hedera-document-store";
const documentStore = await deployAndWait("My Document Store", hederaClient);
console.log(documentStore);
Connecting to existing document store on Hedera
import { connect } from "@tianhr/hedera-document-store";
const documentStore = await connect("0.0.0000000", hederaClient);
Interacting with the document store (example)
const issueMerkleRoot = async () => {
const documentStore = await connect("0.0.2803637", hederaClient);
const tx = await documentStore.issue("0x7fe0b58ed760804eb7118988637693c4351613be327b56527e55bcd0a8d170d7");
console.log(tx[1].receipt);
const isIssued = await documentStore.isIssued("0x7fe0b58ed760804eb7118988637693c4351613be327b56527e55bcd0a8d170d7");
console.log(isIssued);
};
List of available functions on contract
documentIssued
documentRevoked
name
owner
renounceOwnership
transferOwnership
version
issue
bulkIssue
isIssued
revoke
bulkRevoke
isRevoked
Setup
npm install
npm lint
npm test
npm truffle <command>
Contract Benchmark
A benchmark is provided to show the different transaction cost of the different variants of the document store.
npm run benchmark
Notes
If you are using vscode, you may need to link the openzeppelin libraries. See https://github.com/juanfranblanco/vscode-solidity#openzeppelin