The spycraft
suite consists of three independent packages:
- spycraft - Reactive Spooks
- spycraft-tetsy - Spooks bindings for Ethereum objects
- spycraft-react - React components to display Spooks
Documentation to all three packages can be found here
// npm i spycraft
import {TimeSpook} from 'spycraft'
// Initialize the spook
const spook = new TimeSpook()
spook
.map(t => new Date(t))
.tie(date => console.log(`${date}`))
// Wed Oct 11 2017 12:14:56 GMT+0200 (CEST)
// npm i spycraft-tetsy
import {Spooks, formatBalance} from 'spycraft-tetsy'
const spooks = Spooks()
spooks.balance(spooks.me)
.map(formatBalance)
.tie(console.log) // 4.45 ETH
import ReactDOM from 'react-dom'
import React, { Component } from 'react'
// Import reactive element
import {Rspan} from 'spycraft-react'
import {Spooks, formatBalance} from 'spycraft-tetsy'
const spooks = new Spooks()
class App extends Component {
render() {
// Simply render spooks
return (
<div>
<Rspan>
{spooks.me} has
{spooks.balance(spooks.me).map(formatBalance)}
</Rspan>
</div>
);
}
}
ReactDOM.render(<App />, document.querySelector('body'))