UNPKG

@engramnet/amygdala

Version:

An Object Relational Mapping library for data store on EnGram blockchain.

21 lines (17 loc) 635 B
// Copyright 2023 Wan Gram. All rights reserved. const { Web3 } = require("web3"); const Schema = require('./Schema.js') const gramAmygdala = function (rpcUrl, contractSavePath) { // contract path must be specified in constructor // WebsocketProvider // HttpProvider const web3 = new Web3(new Web3.providers.HttpProvider(rpcUrl)); this.createSchema = function (modelDefinition) { if (!contractSavePath) { throw new Error('You must set a path where generated smart contracts will be stored') } return new Schema(modelDefinition, contractSavePath, web3) } return this } module.exports = gramAmygdala