Skip to content

Instantly share code, notes, and snippets.

@sogoiii
Created February 15, 2018 02:11
Show Gist options
  • Save sogoiii/f03773742a0cd2a9d8fdf4f4fdaa1903 to your computer and use it in GitHub Desktop.
Save sogoiii/f03773742a0cd2a9d8fdf4f4fdaa1903 to your computer and use it in GitHub Desktop.
Truffle contract interaction example
import contract from 'truffle-contract'
const contractArtifact = require('./build/contracts/TutorialToken.json')
const web3 = new Web3()
const providerUrl = 'http://localhost:8545'
const provider = new Web3.providers.HttpProvider(providerUrl)
web3.setProvider(provider)
const TutorialToken = contract(contractArtifact)
TutorialToken.sendCoin(0x013, 10, {from: account_one})
.then(console.log)
.catch(consle.error)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment