Skip to content

Instantly share code, notes, and snippets.

@huhn511
Created June 30, 2018 09:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save huhn511/a34162559ce802f7a0f9a0899c0ae4cd to your computer and use it in GitHub Desktop.
Save huhn511/a34162559ce802f7a0f9a0899c0ae4cd to your computer and use it in GitHub Desktop.
import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
import SendButton from './components/SendButton'
import IOTA from 'iota.lib.js'
class App extends Component {
constructor(props) {
super(props)
// Create IOTA instance directly with provider
var iota = new IOTA({
'provider': 'https://nodes.devnet.thetangle.org:443'
});
console.log("iota", iota)
this.state = {iota: iota}
iota.api.getNodeInfo(function(error, success) {
if (error) {
console.error(error);
} else {
console.log(success);
}
});
}
render() {
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<h1 className="App-title">Welcome to React</h1>
</header>
<SendButton iota={this.state.iota}/>
</div>
);
}
}
export default App;
import React, { Component } from 'react';
class SendButton extends Component {
constructor(props){
super(props);
console.log("iota from SendButton Component", this.props.iota);
}
send() {
console.log("Send!");
console.log("Send", this.props.iota);
}
render() {
return (
<button onClick={this.send.bind(this)}>Send Transaction</button>
);
}
}
export default SendButton;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment