sdk-blockchain-circuits-ts 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CIRCUITS_MANAGER_USAGE.md +222 -0
- package/LICENSE +15 -0
- package/README.md +386 -0
- package/build/index.d.ts +60 -0
- package/build/index.js +92 -0
- package/build/src/CircuitsManager.d.ts +171 -0
- package/build/src/CircuitsManager.js +303 -0
- package/build/src/index.d.ts +1 -0
- package/build/src/index.js +5 -0
- package/build/tsconfig.tsbuildinfo +1 -0
- package/build/typechain/@openzeppelin/contracts/access/AccessControl.d.ts +161 -0
- package/build/typechain/@openzeppelin/contracts/access/AccessControl.js +2 -0
- package/build/typechain/@openzeppelin/contracts/access/IAccessControl.d.ts +145 -0
- package/build/typechain/@openzeppelin/contracts/access/IAccessControl.js +2 -0
- package/build/typechain/@openzeppelin/contracts/access/index.d.ts +2 -0
- package/build/typechain/@openzeppelin/contracts/access/index.js +2 -0
- package/build/typechain/@openzeppelin/contracts/index.d.ts +4 -0
- package/build/typechain/@openzeppelin/contracts/index.js +2 -0
- package/build/typechain/@openzeppelin/contracts/utils/index.d.ts +2 -0
- package/build/typechain/@openzeppelin/contracts/utils/index.js +2 -0
- package/build/typechain/@openzeppelin/contracts/utils/introspection/ERC165.d.ts +42 -0
- package/build/typechain/@openzeppelin/contracts/utils/introspection/ERC165.js +2 -0
- package/build/typechain/@openzeppelin/contracts/utils/introspection/IERC165.d.ts +42 -0
- package/build/typechain/@openzeppelin/contracts/utils/introspection/IERC165.js +2 -0
- package/build/typechain/@openzeppelin/contracts/utils/introspection/index.d.ts +2 -0
- package/build/typechain/@openzeppelin/contracts/utils/introspection/index.js +2 -0
- package/build/typechain/@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.d.ts +98 -0
- package/build/typechain/@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.js +2 -0
- package/build/typechain/@openzeppelin/contracts-upgradeable/access/index.d.ts +1 -0
- package/build/typechain/@openzeppelin/contracts-upgradeable/access/index.js +2 -0
- package/build/typechain/@openzeppelin/contracts-upgradeable/index.d.ts +6 -0
- package/build/typechain/@openzeppelin/contracts-upgradeable/index.js +2 -0
- package/build/typechain/@openzeppelin/contracts-upgradeable/proxy/index.d.ts +2 -0
- package/build/typechain/@openzeppelin/contracts-upgradeable/proxy/index.js +2 -0
- package/build/typechain/@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.d.ts +39 -0
- package/build/typechain/@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.js +2 -0
- package/build/typechain/@openzeppelin/contracts-upgradeable/proxy/utils/index.d.ts +1 -0
- package/build/typechain/@openzeppelin/contracts-upgradeable/proxy/utils/index.js +2 -0
- package/build/typechain/@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.d.ts +39 -0
- package/build/typechain/@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.js +2 -0
- package/build/typechain/@openzeppelin/contracts-upgradeable/utils/index.d.ts +1 -0
- package/build/typechain/@openzeppelin/contracts-upgradeable/utils/index.js +2 -0
- package/build/typechain/@openzeppelin/index.d.ts +4 -0
- package/build/typechain/@openzeppelin/index.js +2 -0
- package/build/typechain/common.d.ts +22 -0
- package/build/typechain/common.js +2 -0
- package/build/typechain/contracts/CircuitConnector.d.ts +66 -0
- package/build/typechain/contracts/CircuitConnector.js +2 -0
- package/build/typechain/contracts/CircuitGovernance.d.ts +314 -0
- package/build/typechain/contracts/CircuitGovernance.js +2 -0
- package/build/typechain/contracts/Circuits.d.ts +783 -0
- package/build/typechain/contracts/Circuits.js +2 -0
- package/build/typechain/contracts/ICircuitGovernance.d.ts +290 -0
- package/build/typechain/contracts/ICircuitGovernance.js +2 -0
- package/build/typechain/contracts/ICircuits.d.ts +263 -0
- package/build/typechain/contracts/ICircuits.js +2 -0
- package/build/typechain/contracts/UserManagement.d.ts +58 -0
- package/build/typechain/contracts/UserManagement.js +2 -0
- package/build/typechain/contracts/index.d.ts +6 -0
- package/build/typechain/contracts/index.js +2 -0
- package/build/typechain/factories/@openzeppelin/contracts/access/AccessControl__factory.d.ts +182 -0
- package/build/typechain/factories/@openzeppelin/contracts/access/AccessControl__factory.js +244 -0
- package/build/typechain/factories/@openzeppelin/contracts/access/IAccessControl__factory.d.ts +158 -0
- package/build/typechain/factories/@openzeppelin/contracts/access/IAccessControl__factory.js +212 -0
- package/build/typechain/factories/@openzeppelin/contracts/access/index.d.ts +2 -0
- package/build/typechain/factories/@openzeppelin/contracts/access/index.js +10 -0
- package/build/typechain/factories/@openzeppelin/contracts/index.d.ts +2 -0
- package/build/typechain/factories/@openzeppelin/contracts/index.js +41 -0
- package/build/typechain/factories/@openzeppelin/contracts/utils/index.d.ts +1 -0
- package/build/typechain/factories/@openzeppelin/contracts/utils/index.js +40 -0
- package/build/typechain/factories/@openzeppelin/contracts/utils/introspection/ERC165__factory.d.ts +22 -0
- package/build/typechain/factories/@openzeppelin/contracts/utils/introspection/ERC165__factory.js +38 -0
- package/build/typechain/factories/@openzeppelin/contracts/utils/introspection/IERC165__factory.d.ts +22 -0
- package/build/typechain/factories/@openzeppelin/contracts/utils/introspection/IERC165__factory.js +38 -0
- package/build/typechain/factories/@openzeppelin/contracts/utils/introspection/index.d.ts +2 -0
- package/build/typechain/factories/@openzeppelin/contracts/utils/introspection/index.js +10 -0
- package/build/typechain/factories/@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable__factory.d.ts +83 -0
- package/build/typechain/factories/@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable__factory.js +116 -0
- package/build/typechain/factories/@openzeppelin/contracts-upgradeable/access/index.d.ts +1 -0
- package/build/typechain/factories/@openzeppelin/contracts-upgradeable/access/index.js +8 -0
- package/build/typechain/factories/@openzeppelin/contracts-upgradeable/index.d.ts +3 -0
- package/build/typechain/factories/@openzeppelin/contracts-upgradeable/index.js +42 -0
- package/build/typechain/factories/@openzeppelin/contracts-upgradeable/proxy/index.d.ts +1 -0
- package/build/typechain/factories/@openzeppelin/contracts-upgradeable/proxy/index.js +40 -0
- package/build/typechain/factories/@openzeppelin/contracts-upgradeable/proxy/utils/Initializable__factory.d.ts +26 -0
- package/build/typechain/factories/@openzeppelin/contracts-upgradeable/proxy/utils/Initializable__factory.js +42 -0
- package/build/typechain/factories/@openzeppelin/contracts-upgradeable/proxy/utils/index.d.ts +1 -0
- package/build/typechain/factories/@openzeppelin/contracts-upgradeable/proxy/utils/index.js +8 -0
- package/build/typechain/factories/@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable__factory.d.ts +26 -0
- package/build/typechain/factories/@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable__factory.js +42 -0
- package/build/typechain/factories/@openzeppelin/contracts-upgradeable/utils/index.d.ts +1 -0
- package/build/typechain/factories/@openzeppelin/contracts-upgradeable/utils/index.js +8 -0
- package/build/typechain/factories/@openzeppelin/index.d.ts +2 -0
- package/build/typechain/factories/@openzeppelin/index.js +41 -0
- package/build/typechain/factories/contracts/CircuitConnector__factory.d.ts +85 -0
- package/build/typechain/factories/contracts/CircuitConnector__factory.js +128 -0
- package/build/typechain/factories/contracts/CircuitGovernance__factory.d.ts +369 -0
- package/build/typechain/factories/contracts/CircuitGovernance__factory.js +482 -0
- package/build/typechain/factories/contracts/Circuits__factory.d.ts +1068 -0
- package/build/typechain/factories/contracts/Circuits__factory.js +1405 -0
- package/build/typechain/factories/contracts/ICircuitGovernance__factory.d.ts +339 -0
- package/build/typechain/factories/contracts/ICircuitGovernance__factory.js +443 -0
- package/build/typechain/factories/contracts/ICircuits__factory.d.ts +344 -0
- package/build/typechain/factories/contracts/ICircuits__factory.js +461 -0
- package/build/typechain/factories/contracts/UserManagement__factory.d.ts +50 -0
- package/build/typechain/factories/contracts/UserManagement__factory.js +76 -0
- package/build/typechain/factories/contracts/index.d.ts +6 -0
- package/build/typechain/factories/contracts/index.js +18 -0
- package/build/typechain/factories/index.d.ts +3 -0
- package/build/typechain/factories/index.js +42 -0
- package/build/typechain/factories/linkedlist-solidity/contracts/Constant/ListConst__factory.d.ts +31 -0
- package/build/typechain/factories/linkedlist-solidity/contracts/Constant/ListConst__factory.js +55 -0
- package/build/typechain/factories/linkedlist-solidity/contracts/Constant/index.d.ts +1 -0
- package/build/typechain/factories/linkedlist-solidity/contracts/Constant/index.js +8 -0
- package/build/typechain/factories/linkedlist-solidity/contracts/DoublyLinked/CheapLinkedList/CheapLinkedList__factory.d.ts +97 -0
- package/build/typechain/factories/linkedlist-solidity/contracts/DoublyLinked/CheapLinkedList/CheapLinkedList__factory.js +144 -0
- package/build/typechain/factories/linkedlist-solidity/contracts/DoublyLinked/CheapLinkedList/index.d.ts +1 -0
- package/build/typechain/factories/linkedlist-solidity/contracts/DoublyLinked/CheapLinkedList/index.js +8 -0
- package/build/typechain/factories/linkedlist-solidity/contracts/DoublyLinked/LinkedList/LinkedListClass__factory.d.ts +226 -0
- package/build/typechain/factories/linkedlist-solidity/contracts/DoublyLinked/LinkedList/LinkedListClass__factory.js +311 -0
- package/build/typechain/factories/linkedlist-solidity/contracts/DoublyLinked/LinkedList/LinkedList__factory.d.ts +125 -0
- package/build/typechain/factories/linkedlist-solidity/contracts/DoublyLinked/LinkedList/LinkedList__factory.js +181 -0
- package/build/typechain/factories/linkedlist-solidity/contracts/DoublyLinked/LinkedList/index.d.ts +2 -0
- package/build/typechain/factories/linkedlist-solidity/contracts/DoublyLinked/LinkedList/index.js +10 -0
- package/build/typechain/factories/linkedlist-solidity/contracts/DoublyLinked/ListHandler/DoublyListHandler__factory.d.ts +69 -0
- package/build/typechain/factories/linkedlist-solidity/contracts/DoublyLinked/ListHandler/DoublyListHandler__factory.js +106 -0
- package/build/typechain/factories/linkedlist-solidity/contracts/DoublyLinked/ListHandler/index.d.ts +1 -0
- package/build/typechain/factories/linkedlist-solidity/contracts/DoublyLinked/ListHandler/index.js +8 -0
- package/build/typechain/factories/linkedlist-solidity/contracts/DoublyLinked/ListOfLinkedList/ListOfLinkedList__factory.d.ts +71 -0
- package/build/typechain/factories/linkedlist-solidity/contracts/DoublyLinked/ListOfLinkedList/ListOfLinkedList__factory.js +108 -0
- package/build/typechain/factories/linkedlist-solidity/contracts/DoublyLinked/ListOfLinkedList/index.d.ts +1 -0
- package/build/typechain/factories/linkedlist-solidity/contracts/DoublyLinked/ListOfLinkedList/index.js +8 -0
- package/build/typechain/factories/linkedlist-solidity/contracts/DoublyLinked/MapOfLinkedList/MapOfLinkedList__factory.d.ts +35 -0
- package/build/typechain/factories/linkedlist-solidity/contracts/DoublyLinked/MapOfLinkedList/MapOfLinkedList__factory.js +61 -0
- package/build/typechain/factories/linkedlist-solidity/contracts/DoublyLinked/MapOfLinkedList/index.d.ts +1 -0
- package/build/typechain/factories/linkedlist-solidity/contracts/DoublyLinked/MapOfLinkedList/index.js +8 -0
- package/build/typechain/factories/linkedlist-solidity/contracts/DoublyLinked/index.d.ts +5 -0
- package/build/typechain/factories/linkedlist-solidity/contracts/DoublyLinked/index.js +44 -0
- package/build/typechain/factories/linkedlist-solidity/contracts/Interfaces/Classes/ILinkedListClass__factory.d.ts +34 -0
- package/build/typechain/factories/linkedlist-solidity/contracts/Interfaces/Classes/ILinkedListClass__factory.js +52 -0
- package/build/typechain/factories/linkedlist-solidity/contracts/Interfaces/Classes/index.d.ts +1 -0
- package/build/typechain/factories/linkedlist-solidity/contracts/Interfaces/Classes/index.js +8 -0
- package/build/typechain/factories/linkedlist-solidity/contracts/Interfaces/ICheapLinkedList__factory.d.ts +36 -0
- package/build/typechain/factories/linkedlist-solidity/contracts/Interfaces/ICheapLinkedList__factory.js +57 -0
- package/build/typechain/factories/linkedlist-solidity/contracts/Interfaces/ILinkedList__factory.d.ts +54 -0
- package/build/typechain/factories/linkedlist-solidity/contracts/Interfaces/ILinkedList__factory.js +81 -0
- package/build/typechain/factories/linkedlist-solidity/contracts/Interfaces/IListOfLinkedList__factory.d.ts +34 -0
- package/build/typechain/factories/linkedlist-solidity/contracts/Interfaces/IListOfLinkedList__factory.js +53 -0
- package/build/typechain/factories/linkedlist-solidity/contracts/Interfaces/index.d.ts +4 -0
- package/build/typechain/factories/linkedlist-solidity/contracts/Interfaces/index.js +46 -0
- package/build/typechain/factories/linkedlist-solidity/contracts/SinglyLinked/ListHandler/SinglyListHandler__factory.d.ts +55 -0
- package/build/typechain/factories/linkedlist-solidity/contracts/SinglyLinked/ListHandler/SinglyListHandler__factory.js +87 -0
- package/build/typechain/factories/linkedlist-solidity/contracts/SinglyLinked/ListHandler/index.d.ts +1 -0
- package/build/typechain/factories/linkedlist-solidity/contracts/SinglyLinked/ListHandler/index.js +8 -0
- package/build/typechain/factories/linkedlist-solidity/contracts/SinglyLinked/index.d.ts +1 -0
- package/build/typechain/factories/linkedlist-solidity/contracts/SinglyLinked/index.js +40 -0
- package/build/typechain/factories/linkedlist-solidity/contracts/Utility/LinkedListUtility__factory.d.ts +31 -0
- package/build/typechain/factories/linkedlist-solidity/contracts/Utility/LinkedListUtility__factory.js +55 -0
- package/build/typechain/factories/linkedlist-solidity/contracts/Utility/index.d.ts +1 -0
- package/build/typechain/factories/linkedlist-solidity/contracts/Utility/index.js +8 -0
- package/build/typechain/factories/linkedlist-solidity/contracts/index.d.ts +5 -0
- package/build/typechain/factories/linkedlist-solidity/contracts/index.js +44 -0
- package/build/typechain/factories/linkedlist-solidity/index.d.ts +1 -0
- package/build/typechain/factories/linkedlist-solidity/index.js +40 -0
- package/build/typechain/index.d.ts +59 -0
- package/build/typechain/index.js +89 -0
- package/build/typechain/linkedlist-solidity/contracts/Constant/ListConst.d.ts +42 -0
- package/build/typechain/linkedlist-solidity/contracts/Constant/ListConst.js +2 -0
- package/build/typechain/linkedlist-solidity/contracts/Constant/index.d.ts +1 -0
- package/build/typechain/linkedlist-solidity/contracts/Constant/index.js +2 -0
- package/build/typechain/linkedlist-solidity/contracts/DoublyLinked/CheapLinkedList/CheapLinkedList.d.ts +84 -0
- package/build/typechain/linkedlist-solidity/contracts/DoublyLinked/CheapLinkedList/CheapLinkedList.js +2 -0
- package/build/typechain/linkedlist-solidity/contracts/DoublyLinked/CheapLinkedList/index.d.ts +1 -0
- package/build/typechain/linkedlist-solidity/contracts/DoublyLinked/CheapLinkedList/index.js +2 -0
- package/build/typechain/linkedlist-solidity/contracts/DoublyLinked/LinkedList/LinkedList.d.ts +100 -0
- package/build/typechain/linkedlist-solidity/contracts/DoublyLinked/LinkedList/LinkedList.js +2 -0
- package/build/typechain/linkedlist-solidity/contracts/DoublyLinked/LinkedList/LinkedListClass.d.ts +212 -0
- package/build/typechain/linkedlist-solidity/contracts/DoublyLinked/LinkedList/LinkedListClass.js +2 -0
- package/build/typechain/linkedlist-solidity/contracts/DoublyLinked/LinkedList/index.d.ts +2 -0
- package/build/typechain/linkedlist-solidity/contracts/DoublyLinked/LinkedList/index.js +2 -0
- package/build/typechain/linkedlist-solidity/contracts/DoublyLinked/ListHandler/DoublyListHandler.d.ts +66 -0
- package/build/typechain/linkedlist-solidity/contracts/DoublyLinked/ListHandler/DoublyListHandler.js +2 -0
- package/build/typechain/linkedlist-solidity/contracts/DoublyLinked/ListHandler/index.d.ts +1 -0
- package/build/typechain/linkedlist-solidity/contracts/DoublyLinked/ListHandler/index.js +2 -0
- package/build/typechain/linkedlist-solidity/contracts/DoublyLinked/ListOfLinkedList/ListOfLinkedList.d.ts +63 -0
- package/build/typechain/linkedlist-solidity/contracts/DoublyLinked/ListOfLinkedList/ListOfLinkedList.js +2 -0
- package/build/typechain/linkedlist-solidity/contracts/DoublyLinked/ListOfLinkedList/index.d.ts +1 -0
- package/build/typechain/linkedlist-solidity/contracts/DoublyLinked/ListOfLinkedList/index.js +2 -0
- package/build/typechain/linkedlist-solidity/contracts/DoublyLinked/MapOfLinkedList/MapOfLinkedList.d.ts +42 -0
- package/build/typechain/linkedlist-solidity/contracts/DoublyLinked/MapOfLinkedList/MapOfLinkedList.js +2 -0
- package/build/typechain/linkedlist-solidity/contracts/DoublyLinked/MapOfLinkedList/index.d.ts +1 -0
- package/build/typechain/linkedlist-solidity/contracts/DoublyLinked/MapOfLinkedList/index.js +2 -0
- package/build/typechain/linkedlist-solidity/contracts/DoublyLinked/index.d.ts +10 -0
- package/build/typechain/linkedlist-solidity/contracts/DoublyLinked/index.js +2 -0
- package/build/typechain/linkedlist-solidity/contracts/Interfaces/Classes/ILinkedListClass.d.ts +82 -0
- package/build/typechain/linkedlist-solidity/contracts/Interfaces/Classes/ILinkedListClass.js +2 -0
- package/build/typechain/linkedlist-solidity/contracts/Interfaces/Classes/index.d.ts +1 -0
- package/build/typechain/linkedlist-solidity/contracts/Interfaces/Classes/index.js +2 -0
- package/build/typechain/linkedlist-solidity/contracts/Interfaces/ICheapLinkedList.d.ts +52 -0
- package/build/typechain/linkedlist-solidity/contracts/Interfaces/ICheapLinkedList.js +2 -0
- package/build/typechain/linkedlist-solidity/contracts/Interfaces/ILinkedList.d.ts +68 -0
- package/build/typechain/linkedlist-solidity/contracts/Interfaces/ILinkedList.js +2 -0
- package/build/typechain/linkedlist-solidity/contracts/Interfaces/IListOfLinkedList.d.ts +47 -0
- package/build/typechain/linkedlist-solidity/contracts/Interfaces/IListOfLinkedList.js +2 -0
- package/build/typechain/linkedlist-solidity/contracts/Interfaces/index.d.ts +5 -0
- package/build/typechain/linkedlist-solidity/contracts/Interfaces/index.js +2 -0
- package/build/typechain/linkedlist-solidity/contracts/SinglyLinked/ListHandler/SinglyListHandler.d.ts +58 -0
- package/build/typechain/linkedlist-solidity/contracts/SinglyLinked/ListHandler/SinglyListHandler.js +2 -0
- package/build/typechain/linkedlist-solidity/contracts/SinglyLinked/ListHandler/index.d.ts +1 -0
- package/build/typechain/linkedlist-solidity/contracts/SinglyLinked/ListHandler/index.js +2 -0
- package/build/typechain/linkedlist-solidity/contracts/SinglyLinked/index.d.ts +2 -0
- package/build/typechain/linkedlist-solidity/contracts/SinglyLinked/index.js +2 -0
- package/build/typechain/linkedlist-solidity/contracts/Utility/LinkedListUtility.d.ts +42 -0
- package/build/typechain/linkedlist-solidity/contracts/Utility/LinkedListUtility.js +2 -0
- package/build/typechain/linkedlist-solidity/contracts/Utility/index.d.ts +1 -0
- package/build/typechain/linkedlist-solidity/contracts/Utility/index.js +2 -0
- package/build/typechain/linkedlist-solidity/contracts/index.d.ts +10 -0
- package/build/typechain/linkedlist-solidity/contracts/index.js +2 -0
- package/build/typechain/linkedlist-solidity/index.d.ts +2 -0
- package/build/typechain/linkedlist-solidity/index.js +2 -0
- package/package.json +66 -0
- package/typechain/@openzeppelin/contracts/access/AccessControl.ts +398 -0
- package/typechain/@openzeppelin/contracts/access/IAccessControl.ts +341 -0
- package/typechain/@openzeppelin/contracts/access/index.ts +5 -0
- package/typechain/@openzeppelin/contracts/index.ts +7 -0
- package/typechain/@openzeppelin/contracts/utils/index.ts +5 -0
- package/typechain/@openzeppelin/contracts/utils/introspection/ERC165.ts +103 -0
- package/typechain/@openzeppelin/contracts/utils/introspection/IERC165.ts +103 -0
- package/typechain/@openzeppelin/contracts/utils/introspection/index.ts +5 -0
- package/typechain/@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.ts +188 -0
- package/typechain/@openzeppelin/contracts-upgradeable/access/index.ts +4 -0
- package/typechain/@openzeppelin/contracts-upgradeable/index.ts +9 -0
- package/typechain/@openzeppelin/contracts-upgradeable/proxy/index.ts +5 -0
- package/typechain/@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.ts +69 -0
- package/typechain/@openzeppelin/contracts-upgradeable/proxy/utils/index.ts +4 -0
- package/typechain/@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.ts +69 -0
- package/typechain/@openzeppelin/contracts-upgradeable/utils/index.ts +4 -0
- package/typechain/@openzeppelin/index.ts +7 -0
- package/typechain/common.ts +46 -0
- package/typechain/contracts/CircuitConnector.ts +222 -0
- package/typechain/contracts/CircuitGovernance.ts +731 -0
- package/typechain/contracts/Circuits.ts +2115 -0
- package/typechain/contracts/ICircuitGovernance.ts +665 -0
- package/typechain/contracts/ICircuits.ts +764 -0
- package/typechain/contracts/UserManagement.ts +171 -0
- package/typechain/contracts/index.ts +9 -0
- package/typechain/factories/@openzeppelin/contracts/access/AccessControl__factory.ts +251 -0
- package/typechain/factories/@openzeppelin/contracts/access/IAccessControl__factory.ts +219 -0
- package/typechain/factories/@openzeppelin/contracts/access/index.ts +5 -0
- package/typechain/factories/@openzeppelin/contracts/index.ts +5 -0
- package/typechain/factories/@openzeppelin/contracts/utils/index.ts +4 -0
- package/typechain/factories/@openzeppelin/contracts/utils/introspection/ERC165__factory.ts +42 -0
- package/typechain/factories/@openzeppelin/contracts/utils/introspection/IERC165__factory.ts +45 -0
- package/typechain/factories/@openzeppelin/contracts/utils/introspection/index.ts +5 -0
- package/typechain/factories/@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable__factory.ts +123 -0
- package/typechain/factories/@openzeppelin/contracts-upgradeable/access/index.ts +4 -0
- package/typechain/factories/@openzeppelin/contracts-upgradeable/index.ts +6 -0
- package/typechain/factories/@openzeppelin/contracts-upgradeable/proxy/index.ts +4 -0
- package/typechain/factories/@openzeppelin/contracts-upgradeable/proxy/utils/Initializable__factory.ts +49 -0
- package/typechain/factories/@openzeppelin/contracts-upgradeable/proxy/utils/index.ts +4 -0
- package/typechain/factories/@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable__factory.ts +49 -0
- package/typechain/factories/@openzeppelin/contracts-upgradeable/utils/index.ts +4 -0
- package/typechain/factories/@openzeppelin/index.ts +5 -0
- package/typechain/factories/contracts/CircuitConnector__factory.ts +149 -0
- package/typechain/factories/contracts/CircuitGovernance__factory.ts +489 -0
- package/typechain/factories/contracts/Circuits__factory.ts +1439 -0
- package/typechain/factories/contracts/ICircuitGovernance__factory.ts +450 -0
- package/typechain/factories/contracts/ICircuits__factory.ts +465 -0
- package/typechain/factories/contracts/UserManagement__factory.ts +83 -0
- package/typechain/factories/contracts/index.ts +9 -0
- package/typechain/factories/index.ts +6 -0
- package/typechain/factories/linkedlist-solidity/contracts/Constant/ListConst__factory.ts +76 -0
- package/typechain/factories/linkedlist-solidity/contracts/Constant/index.ts +4 -0
- package/typechain/factories/linkedlist-solidity/contracts/DoublyLinked/CheapLinkedList/CheapLinkedList__factory.ts +165 -0
- package/typechain/factories/linkedlist-solidity/contracts/DoublyLinked/CheapLinkedList/index.ts +4 -0
- package/typechain/factories/linkedlist-solidity/contracts/DoublyLinked/LinkedList/LinkedListClass__factory.ts +332 -0
- package/typechain/factories/linkedlist-solidity/contracts/DoublyLinked/LinkedList/LinkedList__factory.ts +202 -0
- package/typechain/factories/linkedlist-solidity/contracts/DoublyLinked/LinkedList/index.ts +5 -0
- package/typechain/factories/linkedlist-solidity/contracts/DoublyLinked/ListHandler/DoublyListHandler__factory.ts +127 -0
- package/typechain/factories/linkedlist-solidity/contracts/DoublyLinked/ListHandler/index.ts +4 -0
- package/typechain/factories/linkedlist-solidity/contracts/DoublyLinked/ListOfLinkedList/ListOfLinkedList__factory.ts +129 -0
- package/typechain/factories/linkedlist-solidity/contracts/DoublyLinked/ListOfLinkedList/index.ts +4 -0
- package/typechain/factories/linkedlist-solidity/contracts/DoublyLinked/MapOfLinkedList/MapOfLinkedList__factory.ts +82 -0
- package/typechain/factories/linkedlist-solidity/contracts/DoublyLinked/MapOfLinkedList/index.ts +4 -0
- package/typechain/factories/linkedlist-solidity/contracts/DoublyLinked/index.ts +8 -0
- package/typechain/factories/linkedlist-solidity/contracts/Interfaces/Classes/ILinkedListClass__factory.ts +59 -0
- package/typechain/factories/linkedlist-solidity/contracts/Interfaces/Classes/index.ts +4 -0
- package/typechain/factories/linkedlist-solidity/contracts/Interfaces/ICheapLinkedList__factory.ts +64 -0
- package/typechain/factories/linkedlist-solidity/contracts/Interfaces/ILinkedList__factory.ts +88 -0
- package/typechain/factories/linkedlist-solidity/contracts/Interfaces/IListOfLinkedList__factory.ts +60 -0
- package/typechain/factories/linkedlist-solidity/contracts/Interfaces/index.ts +7 -0
- package/typechain/factories/linkedlist-solidity/contracts/SinglyLinked/ListHandler/SinglyListHandler__factory.ts +108 -0
- package/typechain/factories/linkedlist-solidity/contracts/SinglyLinked/ListHandler/index.ts +4 -0
- package/typechain/factories/linkedlist-solidity/contracts/SinglyLinked/index.ts +4 -0
- package/typechain/factories/linkedlist-solidity/contracts/Utility/LinkedListUtility__factory.ts +76 -0
- package/typechain/factories/linkedlist-solidity/contracts/Utility/index.ts +4 -0
- package/typechain/factories/linkedlist-solidity/contracts/index.ts +8 -0
- package/typechain/factories/linkedlist-solidity/index.ts +4 -0
- package/typechain/hardhat.d.ts +267 -0
- package/typechain/index.ts +62 -0
- package/typechain/linkedlist-solidity/contracts/Constant/ListConst.ts +87 -0
- package/typechain/linkedlist-solidity/contracts/Constant/index.ts +4 -0
- package/typechain/linkedlist-solidity/contracts/DoublyLinked/CheapLinkedList/CheapLinkedList.ts +239 -0
- package/typechain/linkedlist-solidity/contracts/DoublyLinked/CheapLinkedList/index.ts +4 -0
- package/typechain/linkedlist-solidity/contracts/DoublyLinked/LinkedList/LinkedList.ts +300 -0
- package/typechain/linkedlist-solidity/contracts/DoublyLinked/LinkedList/LinkedListClass.ts +512 -0
- package/typechain/linkedlist-solidity/contracts/DoublyLinked/LinkedList/index.ts +5 -0
- package/typechain/linkedlist-solidity/contracts/DoublyLinked/ListHandler/DoublyListHandler.ts +168 -0
- package/typechain/linkedlist-solidity/contracts/DoublyLinked/ListHandler/index.ts +4 -0
- package/typechain/linkedlist-solidity/contracts/DoublyLinked/ListOfLinkedList/ListOfLinkedList.ts +176 -0
- package/typechain/linkedlist-solidity/contracts/DoublyLinked/ListOfLinkedList/index.ts +4 -0
- package/typechain/linkedlist-solidity/contracts/DoublyLinked/MapOfLinkedList/MapOfLinkedList.ts +100 -0
- package/typechain/linkedlist-solidity/contracts/DoublyLinked/MapOfLinkedList/index.ts +4 -0
- package/typechain/linkedlist-solidity/contracts/DoublyLinked/index.ts +13 -0
- package/typechain/linkedlist-solidity/contracts/Interfaces/Classes/ILinkedListClass.ts +162 -0
- package/typechain/linkedlist-solidity/contracts/Interfaces/Classes/index.ts +4 -0
- package/typechain/linkedlist-solidity/contracts/Interfaces/ICheapLinkedList.ts +136 -0
- package/typechain/linkedlist-solidity/contracts/Interfaces/ILinkedList.ts +178 -0
- package/typechain/linkedlist-solidity/contracts/Interfaces/IListOfLinkedList.ts +124 -0
- package/typechain/linkedlist-solidity/contracts/Interfaces/index.ts +8 -0
- package/typechain/linkedlist-solidity/contracts/SinglyLinked/ListHandler/SinglyListHandler.ts +134 -0
- package/typechain/linkedlist-solidity/contracts/SinglyLinked/ListHandler/index.ts +4 -0
- package/typechain/linkedlist-solidity/contracts/SinglyLinked/index.ts +5 -0
- package/typechain/linkedlist-solidity/contracts/Utility/LinkedListUtility.ts +87 -0
- package/typechain/linkedlist-solidity/contracts/Utility/index.ts +4 -0
- package/typechain/linkedlist-solidity/contracts/index.ts +13 -0
- package/typechain/linkedlist-solidity/index.ts +5 -0
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
# CircuitsManager Usage Guide
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
`CircuitsManager` is a TypeScript class that provides a convenient wrapper around the Circuits smart contract. It simplifies interactions with the contract by providing type-safe methods for all contract operations.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
The `CircuitsManager` is automatically exported from the fidelity-sdk package:
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
import { CircuitsManager } from "sdk-blockchain-fidelity-ts";
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Basic Setup
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
import { ethers } from "ethers";
|
|
19
|
+
import { CircuitsManager } from "sdk-blockchain-fidelity-ts";
|
|
20
|
+
|
|
21
|
+
// Get your provider and signer
|
|
22
|
+
const provider = new ethers.providers.JsonRpcProvider("http://localhost:8545");
|
|
23
|
+
const wallet = new ethers.Wallet("0x...", provider);
|
|
24
|
+
|
|
25
|
+
// Create a CircuitsManager instance
|
|
26
|
+
const circuitsAddress = "0x..."; // Your deployed Circuits contract address
|
|
27
|
+
const manager = new CircuitsManager(circuitsAddress, wallet);
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Common Operations
|
|
31
|
+
|
|
32
|
+
### Circuit Management
|
|
33
|
+
|
|
34
|
+
```typescript
|
|
35
|
+
// Create a new circuit (requires CIRCUIT_ADMIN_ROLE)
|
|
36
|
+
const createTx = await manager.createCircuit();
|
|
37
|
+
await createTx.wait();
|
|
38
|
+
|
|
39
|
+
// Change circuit status
|
|
40
|
+
await manager.changeCircuitStatus(1, 0); // circuitId=1, status=0
|
|
41
|
+
|
|
42
|
+
// Check if a circuit is active
|
|
43
|
+
const isActive = await manager.isCircuitActive(1);
|
|
44
|
+
console.log("Circuit 1 is active:", isActive);
|
|
45
|
+
|
|
46
|
+
// Get total number of circuits
|
|
47
|
+
const count = await manager.getNumberOfCircuits();
|
|
48
|
+
console.log("Total circuits:", count.toNumber());
|
|
49
|
+
|
|
50
|
+
// Get all circuit IDs
|
|
51
|
+
const circuitIds = await manager.getCircuits();
|
|
52
|
+
console.log("Circuit IDs:", circuitIds.map(id => id.toNumber()));
|
|
53
|
+
|
|
54
|
+
// Get circuit size (number of participants)
|
|
55
|
+
const size = await manager.getCircuitSize(1);
|
|
56
|
+
console.log("Circuit 1 size:", size.toNumber());
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### User Management
|
|
60
|
+
|
|
61
|
+
```typescript
|
|
62
|
+
// Register a user (requires CIRCUIT_ADMIN_ROLE)
|
|
63
|
+
const userAddress = "0x...";
|
|
64
|
+
await manager.registerUser(1, userAddress);
|
|
65
|
+
|
|
66
|
+
// Deactivate a user (requires CIRCUIT_ADMIN_ROLE)
|
|
67
|
+
await manager.deactivateUser(1);
|
|
68
|
+
|
|
69
|
+
// Check if user is registered
|
|
70
|
+
const isRegistered = await manager.isRegistered(1);
|
|
71
|
+
console.log("User 1 is registered:", isRegistered);
|
|
72
|
+
|
|
73
|
+
// Get user's current circuit
|
|
74
|
+
const userCircuit = await manager.getUserCircuit(1);
|
|
75
|
+
console.log("User 1's circuit:", userCircuit.toNumber());
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Circuit Participation
|
|
79
|
+
|
|
80
|
+
```typescript
|
|
81
|
+
// Join a circuit
|
|
82
|
+
const joinTx = await manager.joinCircuit(1, 1); // userId=1, circuitId=1
|
|
83
|
+
await joinTx.wait();
|
|
84
|
+
|
|
85
|
+
// Leave circuit
|
|
86
|
+
const leaveTx = await manager.leaveCircuit(1); // userId=1
|
|
87
|
+
await leaveTx.wait();
|
|
88
|
+
|
|
89
|
+
// Check if user is in a specific circuit
|
|
90
|
+
const isInCircuit = await manager.isRegisteredToCircuit(1, 1);
|
|
91
|
+
console.log("User 1 is in circuit 1:", isInCircuit);
|
|
92
|
+
|
|
93
|
+
// Get participants of a circuit
|
|
94
|
+
const participants = await manager.getCircuitPartecipants(1);
|
|
95
|
+
console.log("Circuit 1 participants:", participants.map(id => id.toNumber()));
|
|
96
|
+
|
|
97
|
+
// Get participants with status
|
|
98
|
+
const participantsWithStatus = await manager.getCircuitPartecipantsAndStatus(1);
|
|
99
|
+
console.log("Participants with status:", participantsWithStatus);
|
|
100
|
+
|
|
101
|
+
// Get single participant details
|
|
102
|
+
const participant = await manager.getPartecipant(1);
|
|
103
|
+
console.log("Participant 1:", participant);
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Governance
|
|
107
|
+
|
|
108
|
+
```typescript
|
|
109
|
+
// Create a proposal
|
|
110
|
+
const proposeTx = await manager.propose(
|
|
111
|
+
2, // userAffected
|
|
112
|
+
1, // proposerId
|
|
113
|
+
1, // circuitId
|
|
114
|
+
0 // proposalType (0=remove, 1=ban, etc.)
|
|
115
|
+
);
|
|
116
|
+
await proposeTx.wait();
|
|
117
|
+
|
|
118
|
+
// Cast a vote
|
|
119
|
+
const voteTx = await manager.castVote(1, 0); // userId=1, proposalId=0
|
|
120
|
+
await voteTx.wait();
|
|
121
|
+
|
|
122
|
+
// Remove a vote
|
|
123
|
+
const removeVoteTx = await manager.removeVote(1, 0);
|
|
124
|
+
await removeVoteTx.wait();
|
|
125
|
+
|
|
126
|
+
// Close a proposal
|
|
127
|
+
const closeTx = await manager.closePropose(1, 0); // userId=1, proposalId=0
|
|
128
|
+
await closeTx.wait();
|
|
129
|
+
|
|
130
|
+
// Check if proposal passed
|
|
131
|
+
const passed = await manager.isVotationPassed(0); // proposalId=0
|
|
132
|
+
console.log("Proposal 0 passed:", passed);
|
|
133
|
+
|
|
134
|
+
// Get all participants and proposals for all circuits
|
|
135
|
+
const allParticipants = await manager.getAllCircuitPartecipantsAndStatus();
|
|
136
|
+
console.log("All participants:", allParticipants);
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### Advanced Operations
|
|
140
|
+
|
|
141
|
+
```typescript
|
|
142
|
+
// Get the underlying contract instance (for advanced operations)
|
|
143
|
+
const contract = manager.getContract();
|
|
144
|
+
|
|
145
|
+
// Get the contract address
|
|
146
|
+
const address = manager.getContractAddress();
|
|
147
|
+
|
|
148
|
+
// Get current signer
|
|
149
|
+
const signer = manager.getSigner();
|
|
150
|
+
|
|
151
|
+
// Switch to a different signer (useful for multi-user scenarios)
|
|
152
|
+
const newSigner = new ethers.Wallet("0x...", provider);
|
|
153
|
+
manager.setSigner(newSigner);
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## Transaction Handling
|
|
157
|
+
|
|
158
|
+
All write operations return transaction objects. Use them with:
|
|
159
|
+
|
|
160
|
+
```typescript
|
|
161
|
+
const tx = await manager.joinCircuit(1, 1);
|
|
162
|
+
|
|
163
|
+
// Wait for confirmation
|
|
164
|
+
const receipt = await tx.wait();
|
|
165
|
+
console.log("Transaction confirmed:", receipt.transactionHash);
|
|
166
|
+
|
|
167
|
+
// Or access tx details directly
|
|
168
|
+
console.log("Tx hash:", tx.hash);
|
|
169
|
+
console.log("Tx from:", tx.from);
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
## Error Handling
|
|
173
|
+
|
|
174
|
+
```typescript
|
|
175
|
+
try {
|
|
176
|
+
await manager.joinCircuit(1, 1);
|
|
177
|
+
} catch (error) {
|
|
178
|
+
if (error.code === "CALL_EXCEPTION") {
|
|
179
|
+
console.log("Contract execution failed:", error.reason);
|
|
180
|
+
} else if (error.code === "INSUFFICIENT_FUNDS") {
|
|
181
|
+
console.log("Not enough funds for transaction");
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
## Roles and Permissions
|
|
187
|
+
|
|
188
|
+
The Circuits contract uses role-based access control (RBAC):
|
|
189
|
+
|
|
190
|
+
- **DEFAULT_ADMIN_ROLE**: Can grant/revoke roles
|
|
191
|
+
- **DEVELOPER_ROLE**: For developers
|
|
192
|
+
- **CIRCUIT_ADMIN_ROLE**: Can create circuits, register/deactivate users
|
|
193
|
+
|
|
194
|
+
Most write operations require specific roles. Check contract requirements before calling.
|
|
195
|
+
|
|
196
|
+
## TypeScript Support
|
|
197
|
+
|
|
198
|
+
All methods are fully typed:
|
|
199
|
+
|
|
200
|
+
```typescript
|
|
201
|
+
// Type hints are automatically available
|
|
202
|
+
const circuitSize: BigNumber = await manager.getCircuitSize(1);
|
|
203
|
+
const participants: BigNumber[] = await manager.getCircuitPartecipants(1);
|
|
204
|
+
const participant: ICircuits.PartecipantStruct = await manager.getPartecipant(1);
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
## Integration with Hardhat
|
|
208
|
+
|
|
209
|
+
If using with Hardhat:
|
|
210
|
+
|
|
211
|
+
```typescript
|
|
212
|
+
import { ethers } from "hardhat";
|
|
213
|
+
import { CircuitsManager } from "sdk-blockchain-fidelity-ts";
|
|
214
|
+
|
|
215
|
+
export async function main() {
|
|
216
|
+
const [deployer] = await ethers.getSigners();
|
|
217
|
+
const circuits = "0x...";
|
|
218
|
+
|
|
219
|
+
const manager = new CircuitsManager(circuits, deployer);
|
|
220
|
+
await manager.createCircuit();
|
|
221
|
+
}
|
|
222
|
+
```
|
package/LICENSE
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
ISC License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 OmniaGroup
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
+
purpose with or without fee is hereby granted, provided that the above
|
|
7
|
+
copyright notice and this permission notice appear in all copies.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
10
|
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
11
|
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
12
|
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
13
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
14
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
15
|
+
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
# sdk-blockchain-circuits-ts
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/sdk-blockchain-circuits-ts)
|
|
4
|
+
[](https://www.typescriptlang.org/)
|
|
5
|
+
[](LICENSE)
|
|
6
|
+
|
|
7
|
+
> TypeScript SDK for interacting with the Fidelity Project smart contracts. Provides a type-safe interface for managing circuits, users, and decentralized governance on Ethereum-compatible blockchains.
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
✅ **Circuit Management** - Create, activate, and manage circuits with full lifecycle control
|
|
12
|
+
✅ **User Management** - Activate, deactivate, and manage users in the system
|
|
13
|
+
✅ **Circuit Participation** - Join and leave circuits with comprehensive tracking
|
|
14
|
+
✅ **Governance System** - Propose, vote on, and execute governance actions
|
|
15
|
+
✅ **Role-Based Access Control** - RBAC for administrative operations
|
|
16
|
+
✅ **Type Safety** - Full TypeScript support with generated contract bindings
|
|
17
|
+
✅ **Comprehensive Testing** - 58+ test cases across 6 test suites
|
|
18
|
+
✅ **Well Documented** - Complete API documentation and usage examples
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Table of Contents
|
|
23
|
+
|
|
24
|
+
- [Installation](#installation)
|
|
25
|
+
- [Quick Start](#quick-start)
|
|
26
|
+
- [API Reference](#api-reference)
|
|
27
|
+
- [Usage Examples](#usage-examples)
|
|
28
|
+
- [Error Handling](#error-handling)
|
|
29
|
+
- [Testing](#testing)
|
|
30
|
+
- [Documentation](#documentation)
|
|
31
|
+
- [Contributing](#contributing)
|
|
32
|
+
- [License](#license)
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Installation
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npm install sdk-blockchain-circuits-ts
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Prerequisites
|
|
43
|
+
|
|
44
|
+
- Node.js 14.0.0 or higher
|
|
45
|
+
- npm 6.0.0 or higher
|
|
46
|
+
- TypeScript 5.0+
|
|
47
|
+
- Access to an Ethereum-compatible blockchain (local node, testnet, or mainnet)
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Quick Start
|
|
52
|
+
|
|
53
|
+
```typescript
|
|
54
|
+
import { ethers } from "ethers";
|
|
55
|
+
import { CircuitsManager } from "sdk-blockchain-circuits-ts";
|
|
56
|
+
|
|
57
|
+
// Setup provider and wallet
|
|
58
|
+
const provider = new ethers.providers.JsonRpcProvider("http://localhost:8545");
|
|
59
|
+
const wallet = new ethers.Wallet("0x...", provider);
|
|
60
|
+
|
|
61
|
+
// Initialize CircuitsManager
|
|
62
|
+
const circuitsAddress = "0x..."; // Your deployed Circuits contract address
|
|
63
|
+
const manager = new CircuitsManager(circuitsAddress, wallet);
|
|
64
|
+
|
|
65
|
+
// Get circuit information
|
|
66
|
+
const count = await manager.getNumberOfCircuits();
|
|
67
|
+
console.log(`Total circuits: ${count.toNumber()}`);
|
|
68
|
+
|
|
69
|
+
// Check if a circuit is active
|
|
70
|
+
const isActive = await manager.isCircuitActive(1);
|
|
71
|
+
console.log(`Circuit 1 is active: ${isActive}`);
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## API Reference
|
|
77
|
+
|
|
78
|
+
### CircuitsManager
|
|
79
|
+
|
|
80
|
+
The primary class for interacting with the Circuits smart contract.
|
|
81
|
+
|
|
82
|
+
#### Constructor
|
|
83
|
+
|
|
84
|
+
```typescript
|
|
85
|
+
constructor(contractAddress: string, signer: Signer)
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
#### Circuit Management
|
|
89
|
+
|
|
90
|
+
| Method | Parameters | Returns | Description |
|
|
91
|
+
|--------|-----------|---------|-------------|
|
|
92
|
+
| `createCircuit()` | - | Transaction | Create a new circuit (requires CIRCUIT_ADMIN_ROLE) |
|
|
93
|
+
| `changeCircuitStatus(circuitId, status)` | `number, number` | Transaction | Change circuit status |
|
|
94
|
+
| `isCircuitActive(circuitId)` | `number` | `boolean` | Check if circuit is active |
|
|
95
|
+
| `getNumberOfCircuits()` | - | `BigNumber` | Get total number of circuits |
|
|
96
|
+
| `getCircuits()` | - | `BigNumber[]` | Get all circuit IDs |
|
|
97
|
+
| `getCircuitSize(circuitId)` | `number` | `BigNumber` | Get number of participants |
|
|
98
|
+
|
|
99
|
+
#### User Management
|
|
100
|
+
|
|
101
|
+
| Method | Parameters | Returns | Description |
|
|
102
|
+
|--------|-----------|---------|-------------|
|
|
103
|
+
| `activateUser(userId, userAddress)` | `number, string` | Transaction | Activate a user (requires CIRCUIT_ADMIN_ROLE) |
|
|
104
|
+
| `deactivateUser(userId)` | `number` | Transaction | Deactivate a user |
|
|
105
|
+
| `isRegistered(userId)` | `number` | `boolean` | Check if user is registered |
|
|
106
|
+
| `getUserCircuit(userId)` | `number` | `BigNumber` | Get user's current circuit |
|
|
107
|
+
|
|
108
|
+
#### Circuit Participation
|
|
109
|
+
|
|
110
|
+
| Method | Parameters | Returns | Description |
|
|
111
|
+
|--------|-----------|---------|-------------|
|
|
112
|
+
| `joinCircuit(userId, circuitId)` | `number, number` | Transaction | Join a circuit |
|
|
113
|
+
| `leaveCircuit(userId)` | `number` | Transaction | Leave current circuit |
|
|
114
|
+
| `isRegisteredToCircuit(userId, circuitId)` | `number, number` | `boolean` | Check circuit membership |
|
|
115
|
+
| `getCircuitPartecipants(circuitId)` | `number` | `BigNumber[]` | Get all participants |
|
|
116
|
+
| `getCircuitPartecipantsAndStatus(circuitId)` | `number` | `object[]` | Get participants with status |
|
|
117
|
+
| `getPartecipant(userId)` | `number` | `ICircuits.PartecipantStruct` | Get participant details |
|
|
118
|
+
|
|
119
|
+
#### Governance
|
|
120
|
+
|
|
121
|
+
| Method | Parameters | Returns | Description |
|
|
122
|
+
|--------|-----------|---------|-------------|
|
|
123
|
+
| `propose(userAffected, proposerId, circuitId, proposalType)` | `number, number, number, number` | Transaction | Create a proposal |
|
|
124
|
+
| `castVote(userId, proposalId)` | `number, number` | Transaction | Cast a vote |
|
|
125
|
+
| `removeVote(userId, proposalId)` | `number, number` | Transaction | Remove a vote |
|
|
126
|
+
| `closePropose(userId, proposalId)` | `number, number` | Transaction | Close a proposal |
|
|
127
|
+
| `isVotationPassed(proposalId)` | `number` | `boolean` | Check if proposal passed |
|
|
128
|
+
| `getAllCircuitPartecipantsAndStatus()` | - | `object[]` | Get all participants across circuits |
|
|
129
|
+
|
|
130
|
+
#### Utility Methods
|
|
131
|
+
|
|
132
|
+
| Method | Parameters | Returns | Description |
|
|
133
|
+
|--------|-----------|---------|-------------|
|
|
134
|
+
| `getContract()` | - | `Circuits` | Get underlying contract instance |
|
|
135
|
+
| `getContractAddress()` | - | `string` | Get contract address |
|
|
136
|
+
| `getSigner()` | - | `Signer` | Get current signer |
|
|
137
|
+
| `setSigner(newSigner)` | `Signer` | `void` | Switch to different signer |
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## Usage Examples
|
|
142
|
+
|
|
143
|
+
### Circuit Management
|
|
144
|
+
|
|
145
|
+
```typescript
|
|
146
|
+
// Create a new circuit (requires CIRCUIT_ADMIN_ROLE)
|
|
147
|
+
const createTx = await manager.createCircuit();
|
|
148
|
+
await createTx.wait();
|
|
149
|
+
|
|
150
|
+
// Change circuit status
|
|
151
|
+
await manager.changeCircuitStatus(1, 0); // circuitId=1, status=0
|
|
152
|
+
|
|
153
|
+
// Get all circuit IDs
|
|
154
|
+
const circuitIds = await manager.getCircuits();
|
|
155
|
+
console.log("Circuit IDs:", circuitIds.map(id => id.toNumber()));
|
|
156
|
+
|
|
157
|
+
// Check circuit size
|
|
158
|
+
const size = await manager.getCircuitSize(1);
|
|
159
|
+
console.log("Circuit 1 has", size.toNumber(), "participants");
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### User Management
|
|
163
|
+
|
|
164
|
+
```typescript
|
|
165
|
+
// Activate a new user
|
|
166
|
+
const userAddress = "0x1234567890123456789012345678901234567890";
|
|
167
|
+
const activateTx = await manager.activateUser(1, userAddress);
|
|
168
|
+
await activateTx.wait();
|
|
169
|
+
|
|
170
|
+
// Check user registration status
|
|
171
|
+
const userId = 1;
|
|
172
|
+
const isRegistered = await manager.isRegistered(userId);
|
|
173
|
+
console.log(`User ${userId} is registered:`, isRegistered);
|
|
174
|
+
|
|
175
|
+
// Get user information
|
|
176
|
+
const participant = await manager.getPartecipant(userId);
|
|
177
|
+
console.log("Participant info:", participant);
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### Circuit Participation
|
|
181
|
+
|
|
182
|
+
```typescript
|
|
183
|
+
// Join a circuit
|
|
184
|
+
const joinTx = await manager.joinCircuit(1, 1); // userId=1, circuitId=1
|
|
185
|
+
await joinTx.wait();
|
|
186
|
+
|
|
187
|
+
// Check if user is in circuit
|
|
188
|
+
const isInCircuit = await manager.isRegisteredToCircuit(1, 1);
|
|
189
|
+
console.log("User is in circuit:", isInCircuit);
|
|
190
|
+
|
|
191
|
+
// Get all participants
|
|
192
|
+
const participants = await manager.getCircuitPartecipants(1);
|
|
193
|
+
console.log("Participants:", participants.map(id => id.toNumber()));
|
|
194
|
+
|
|
195
|
+
// Leave circuit
|
|
196
|
+
const leaveTx = await manager.leaveCircuit(1);
|
|
197
|
+
await leaveTx.wait();
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### Governance
|
|
201
|
+
|
|
202
|
+
```typescript
|
|
203
|
+
// Create a proposal
|
|
204
|
+
const proposeTx = await manager.propose(
|
|
205
|
+
2, // userAffected
|
|
206
|
+
1, // proposerId
|
|
207
|
+
1, // circuitId
|
|
208
|
+
0 // proposalType (0=remove, 1=ban, etc.)
|
|
209
|
+
);
|
|
210
|
+
await proposeTx.wait();
|
|
211
|
+
|
|
212
|
+
// Cast a vote
|
|
213
|
+
const voteTx = await manager.castVote(1, 0); // userId=1, proposalId=0
|
|
214
|
+
await voteTx.wait();
|
|
215
|
+
|
|
216
|
+
// Check if proposal passed
|
|
217
|
+
const passed = await manager.isVotationPassed(0);
|
|
218
|
+
console.log("Proposal 0 passed:", passed);
|
|
219
|
+
|
|
220
|
+
// Close a proposal
|
|
221
|
+
const closeTx = await manager.closePropose(1, 0);
|
|
222
|
+
await closeTx.wait();
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
## Error Handling
|
|
228
|
+
|
|
229
|
+
```typescript
|
|
230
|
+
try {
|
|
231
|
+
await manager.joinCircuit(1, 1);
|
|
232
|
+
} catch (error) {
|
|
233
|
+
if (error.code === "CALL_EXCEPTION") {
|
|
234
|
+
console.error("Contract execution failed:", error.reason);
|
|
235
|
+
} else if (error.code === "INSUFFICIENT_FUNDS") {
|
|
236
|
+
console.error("Insufficient funds for transaction");
|
|
237
|
+
} else if (error.message.includes("AccessControl")) {
|
|
238
|
+
console.error("Access denied: check user roles");
|
|
239
|
+
} else {
|
|
240
|
+
console.error("Unknown error:", error.message);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
---
|
|
246
|
+
|
|
247
|
+
## Role-Based Access Control
|
|
248
|
+
|
|
249
|
+
The contract uses role-based access control (RBAC):
|
|
250
|
+
|
|
251
|
+
- **DEFAULT_ADMIN_ROLE** - Can grant/revoke roles
|
|
252
|
+
- **DEVELOPER_ROLE** - For developers
|
|
253
|
+
- **CIRCUIT_ADMIN_ROLE** - Can create circuits, manage users
|
|
254
|
+
|
|
255
|
+
Check that your signer has the necessary roles before calling restricted operations.
|
|
256
|
+
|
|
257
|
+
---
|
|
258
|
+
|
|
259
|
+
## Testing
|
|
260
|
+
|
|
261
|
+
The SDK includes a comprehensive test suite:
|
|
262
|
+
|
|
263
|
+
```bash
|
|
264
|
+
# Run all tests
|
|
265
|
+
npm run test_all
|
|
266
|
+
|
|
267
|
+
# Run specific test suites
|
|
268
|
+
npm run test_circuits_manager # Basic CircuitsManager tests
|
|
269
|
+
npm run test_advanced # Advanced circuit operations
|
|
270
|
+
npm run test_governance # Governance operations
|
|
271
|
+
npm run test_governance_integration # Governance integration
|
|
272
|
+
npm run test_integration # Full integration tests
|
|
273
|
+
npm run test_edge_cases # Edge case handling
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
Test coverage includes:
|
|
277
|
+
- Circuit lifecycle management
|
|
278
|
+
- User registration and activation
|
|
279
|
+
- Circuit participation flows
|
|
280
|
+
- Governance proposal workflows
|
|
281
|
+
- Role-based access control
|
|
282
|
+
- Edge cases and error handling
|
|
283
|
+
|
|
284
|
+
---
|
|
285
|
+
|
|
286
|
+
## Documentation
|
|
287
|
+
|
|
288
|
+
For detailed documentation and advanced usage, see:
|
|
289
|
+
|
|
290
|
+
- **[CircuitsManager Usage Guide](CIRCUITS_MANAGER_USAGE.md)** - Complete API reference with examples
|
|
291
|
+
- **[Test Suite Documentation](TEST_SUITE.md)** - Overview of all test cases
|
|
292
|
+
- **[Running Tests Guide](TEST_RUNNING.md)** - Guide for running and debugging tests
|
|
293
|
+
- **[Quick Start Guide](RUN_TESTS_QUICK_START.md)** - Get started quickly
|
|
294
|
+
|
|
295
|
+
---
|
|
296
|
+
|
|
297
|
+
## Project Structure
|
|
298
|
+
|
|
299
|
+
```
|
|
300
|
+
packages/fidelity-sdk/
|
|
301
|
+
├── src/
|
|
302
|
+
│ ├── CircuitsManager.ts # Main SDK class
|
|
303
|
+
│ └── index.ts # Package exports
|
|
304
|
+
├── typechain/ # Auto-generated contract types
|
|
305
|
+
├── test/ # Test suites
|
|
306
|
+
│ ├── CircuitsManager.spec.ts
|
|
307
|
+
│ ├── CircuitsManager.Advanced.spec.ts
|
|
308
|
+
│ ├── Governance.spec.ts
|
|
309
|
+
│ ├── GovernanceIntegration.spec.ts
|
|
310
|
+
│ ├── Integration.spec.ts
|
|
311
|
+
│ └── EdgeCases.spec.ts
|
|
312
|
+
├── build/ # Compiled JavaScript (generated)
|
|
313
|
+
├── tsconfig.json # TypeScript configuration
|
|
314
|
+
├── package.json # Package metadata
|
|
315
|
+
└── README.md # This file
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
---
|
|
319
|
+
|
|
320
|
+
## Building
|
|
321
|
+
|
|
322
|
+
```bash
|
|
323
|
+
# Install dependencies
|
|
324
|
+
npm install
|
|
325
|
+
|
|
326
|
+
# Compile TypeScript to JavaScript
|
|
327
|
+
npm run compile
|
|
328
|
+
|
|
329
|
+
# Build for npm publishing
|
|
330
|
+
npm run prepublishOnly
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
---
|
|
334
|
+
|
|
335
|
+
## TypeScript Support
|
|
336
|
+
|
|
337
|
+
Full TypeScript support with auto-generated types:
|
|
338
|
+
|
|
339
|
+
```typescript
|
|
340
|
+
import { CircuitsManager } from "sdk-blockchain-circuits-ts";
|
|
341
|
+
import { BigNumber } from "ethers";
|
|
342
|
+
|
|
343
|
+
const manager = new CircuitsManager(address, signer);
|
|
344
|
+
|
|
345
|
+
// Full type inference
|
|
346
|
+
const size: BigNumber = await manager.getCircuitSize(1);
|
|
347
|
+
const ids: BigNumber[] = await manager.getCircuits();
|
|
348
|
+
const isActive: boolean = await manager.isCircuitActive(1);
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
---
|
|
352
|
+
|
|
353
|
+
## Contributing
|
|
354
|
+
|
|
355
|
+
Contributions are welcome! Please ensure:
|
|
356
|
+
|
|
357
|
+
1. All tests pass (`npm run test_all`)
|
|
358
|
+
2. Code follows the existing style
|
|
359
|
+
3. New features include tests
|
|
360
|
+
4. Documentation is updated
|
|
361
|
+
5. TypeScript types are properly maintained
|
|
362
|
+
|
|
363
|
+
---
|
|
364
|
+
|
|
365
|
+
## License
|
|
366
|
+
|
|
367
|
+
ISC License - see [LICENSE](LICENSE) file for details.
|
|
368
|
+
|
|
369
|
+
---
|
|
370
|
+
|
|
371
|
+
## Repository
|
|
372
|
+
|
|
373
|
+
- **Git**: [https://bitbucket.org/omniadev/sdk-blockchain-fidelity-ts.git](https://bitbucket.org/omniadev/sdk-blockchain-fidelity-ts.git)
|
|
374
|
+
- **Issues**: [https://bitbucket.org/omniadev/sdk-blockchain-fidelity-ts/issues](https://bitbucket.org/omniadev/sdk-blockchain-fidelity-ts/issues)
|
|
375
|
+
|
|
376
|
+
---
|
|
377
|
+
|
|
378
|
+
## Author
|
|
379
|
+
|
|
380
|
+
**OmniaGroup**
|
|
381
|
+
|
|
382
|
+
---
|
|
383
|
+
|
|
384
|
+
## Support
|
|
385
|
+
|
|
386
|
+
For questions and support, please open an issue in the repository.
|
package/build/index.d.ts
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type * as openzeppelin from "./@openzeppelin";
|
|
2
|
+
export type { openzeppelin };
|
|
3
|
+
import type * as contracts from "./contracts";
|
|
4
|
+
export type { contracts };
|
|
5
|
+
import type * as linkedlistSolidity from "./linkedlist-solidity";
|
|
6
|
+
export type { linkedlistSolidity };
|
|
7
|
+
export * as factories from "./factories";
|
|
8
|
+
export type { OwnableUpgradeable } from "./@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable";
|
|
9
|
+
export { OwnableUpgradeable__factory } from "./factories/@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable__factory";
|
|
10
|
+
export type { Initializable } from "./@openzeppelin/contracts-upgradeable/proxy/utils/Initializable";
|
|
11
|
+
export { Initializable__factory } from "./factories/@openzeppelin/contracts-upgradeable/proxy/utils/Initializable__factory";
|
|
12
|
+
export type { ContextUpgradeable } from "./@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable";
|
|
13
|
+
export { ContextUpgradeable__factory } from "./factories/@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable__factory";
|
|
14
|
+
export type { AccessControl } from "./@openzeppelin/contracts/access/AccessControl";
|
|
15
|
+
export { AccessControl__factory } from "./factories/@openzeppelin/contracts/access/AccessControl__factory";
|
|
16
|
+
export type { IAccessControl } from "./@openzeppelin/contracts/access/IAccessControl";
|
|
17
|
+
export { IAccessControl__factory } from "./factories/@openzeppelin/contracts/access/IAccessControl__factory";
|
|
18
|
+
export type { ERC165 } from "./@openzeppelin/contracts/utils/introspection/ERC165";
|
|
19
|
+
export { ERC165__factory } from "./factories/@openzeppelin/contracts/utils/introspection/ERC165__factory";
|
|
20
|
+
export type { IERC165 } from "./@openzeppelin/contracts/utils/introspection/IERC165";
|
|
21
|
+
export { IERC165__factory } from "./factories/@openzeppelin/contracts/utils/introspection/IERC165__factory";
|
|
22
|
+
export type { CircuitConnector } from "./contracts/CircuitConnector";
|
|
23
|
+
export { CircuitConnector__factory } from "./factories/contracts/CircuitConnector__factory";
|
|
24
|
+
export type { CircuitGovernance } from "./contracts/CircuitGovernance";
|
|
25
|
+
export { CircuitGovernance__factory } from "./factories/contracts/CircuitGovernance__factory";
|
|
26
|
+
export type { Circuits } from "./contracts/Circuits";
|
|
27
|
+
export { Circuits__factory } from "./factories/contracts/Circuits__factory";
|
|
28
|
+
export type { ICircuitGovernance } from "./contracts/ICircuitGovernance";
|
|
29
|
+
export { ICircuitGovernance__factory } from "./factories/contracts/ICircuitGovernance__factory";
|
|
30
|
+
export type { ICircuits } from "./contracts/ICircuits";
|
|
31
|
+
export { ICircuits__factory } from "./factories/contracts/ICircuits__factory";
|
|
32
|
+
export type { UserManagement } from "./contracts/UserManagement";
|
|
33
|
+
export { UserManagement__factory } from "./factories/contracts/UserManagement__factory";
|
|
34
|
+
export type { ListConst } from "./linkedlist-solidity/contracts/Constant/ListConst";
|
|
35
|
+
export { ListConst__factory } from "./factories/linkedlist-solidity/contracts/Constant/ListConst__factory";
|
|
36
|
+
export type { CheapLinkedList } from "./linkedlist-solidity/contracts/DoublyLinked/CheapLinkedList/CheapLinkedList";
|
|
37
|
+
export { CheapLinkedList__factory } from "./factories/linkedlist-solidity/contracts/DoublyLinked/CheapLinkedList/CheapLinkedList__factory";
|
|
38
|
+
export type { LinkedList } from "./linkedlist-solidity/contracts/DoublyLinked/LinkedList/LinkedList";
|
|
39
|
+
export { LinkedList__factory } from "./factories/linkedlist-solidity/contracts/DoublyLinked/LinkedList/LinkedList__factory";
|
|
40
|
+
export type { LinkedListClass } from "./linkedlist-solidity/contracts/DoublyLinked/LinkedList/LinkedListClass";
|
|
41
|
+
export { LinkedListClass__factory } from "./factories/linkedlist-solidity/contracts/DoublyLinked/LinkedList/LinkedListClass__factory";
|
|
42
|
+
export type { DoublyListHandler } from "./linkedlist-solidity/contracts/DoublyLinked/ListHandler/DoublyListHandler";
|
|
43
|
+
export { DoublyListHandler__factory } from "./factories/linkedlist-solidity/contracts/DoublyLinked/ListHandler/DoublyListHandler__factory";
|
|
44
|
+
export type { ListOfLinkedList } from "./linkedlist-solidity/contracts/DoublyLinked/ListOfLinkedList/ListOfLinkedList";
|
|
45
|
+
export { ListOfLinkedList__factory } from "./factories/linkedlist-solidity/contracts/DoublyLinked/ListOfLinkedList/ListOfLinkedList__factory";
|
|
46
|
+
export type { MapOfLinkedList } from "./linkedlist-solidity/contracts/DoublyLinked/MapOfLinkedList/MapOfLinkedList";
|
|
47
|
+
export { MapOfLinkedList__factory } from "./factories/linkedlist-solidity/contracts/DoublyLinked/MapOfLinkedList/MapOfLinkedList__factory";
|
|
48
|
+
export type { ILinkedListClass } from "./linkedlist-solidity/contracts/Interfaces/Classes/ILinkedListClass";
|
|
49
|
+
export { ILinkedListClass__factory } from "./factories/linkedlist-solidity/contracts/Interfaces/Classes/ILinkedListClass__factory";
|
|
50
|
+
export type { ICheapLinkedList } from "./linkedlist-solidity/contracts/Interfaces/ICheapLinkedList";
|
|
51
|
+
export { ICheapLinkedList__factory } from "./factories/linkedlist-solidity/contracts/Interfaces/ICheapLinkedList__factory";
|
|
52
|
+
export type { ILinkedList } from "./linkedlist-solidity/contracts/Interfaces/ILinkedList";
|
|
53
|
+
export { ILinkedList__factory } from "./factories/linkedlist-solidity/contracts/Interfaces/ILinkedList__factory";
|
|
54
|
+
export type { IListOfLinkedList } from "./linkedlist-solidity/contracts/Interfaces/IListOfLinkedList";
|
|
55
|
+
export { IListOfLinkedList__factory } from "./factories/linkedlist-solidity/contracts/Interfaces/IListOfLinkedList__factory";
|
|
56
|
+
export type { SinglyListHandler } from "./linkedlist-solidity/contracts/SinglyLinked/ListHandler/SinglyListHandler";
|
|
57
|
+
export { SinglyListHandler__factory } from "./factories/linkedlist-solidity/contracts/SinglyLinked/ListHandler/SinglyListHandler__factory";
|
|
58
|
+
export type { LinkedListUtility } from "./linkedlist-solidity/contracts/Utility/LinkedListUtility";
|
|
59
|
+
export { LinkedListUtility__factory } from "./factories/linkedlist-solidity/contracts/Utility/LinkedListUtility__factory";
|
|
60
|
+
export { CircuitsManager } from "./src/CircuitsManager";
|