sails-hook-truffle

1.0.35 • Public • Published

sails-hook-truffle

A hook for sails.js which handles parsing and instantiation of contracts on Ethereum based consensus networks via truffle.

Installing the Hook

On existing Sails & Truffle projects:

  1. Copy contracts folder and truffle.js (or truffle-config.js depending on which your project is using) from your truffle project into the sails project.
  2. In your sails project, run npm install -s sails-hook-truffle

Usage:

If your contract's filename is ContractName.sol:

on the server side you can interact with your contract using:

sails.ContractName.deployed().then((contractName)=>{
    // include method calls here, or return instance for
    // functionality outside of callback
})

on the clientSide:

io.socket.get('/contracts/ContractName', (ContractName) =>{
  contractName = web3.eth.contract(ContractName.abi).at(ContractName.address);
 
  // include method calls here, or return instance for
  // functionality outside of callback
 
 
  }

Package Sidebar

Install

npm i sails-hook-truffle

Weekly Downloads

0

Version

1.0.35

License

BSD-2-Clause

Unpacked Size

7.6 kB

Total Files

4

Last publish

Collaborators

  • digital_intaglio