soless v0.0.5
Soless - solidity files to express api converter
Installation
npm install -g soless
(type soless --help
to see commands and options)
Usage
Initialize
soless init
will create server directories: cotracts
and compiled
Compile
copy your contracts to contracts
folder and run
soless compile
it will create ContractName.json
files in compiled folder
use --local
flag to create addresses.json
file and type in addresses of contracts manually
addresses.json
will not be created if it's already exists
if value of contract key isn't empty, than address field of this contract in http request will be ignored
Run server
soless run
it will takes json files from compiled
folder and setup express server for each function
use --verbose
to show logs of server calls
use --port {NUMBER}
to change server port, default is 3000
use --rpc {NETWORK}
to change network, you can use:
- main
- ropsten
- rinkeby - default
- kovan
- custom httpProvider url
FrontEnd Usage
Better test with postman
app
To view
functions use syntax:
http://server.com:3000/ContarctName/FunctionName/?address=ContractAddress
in response will be the return of function
To set
functions use syntax:
http://server.com:3000/ContractName/FunctionName/?arg1="String"&arg2=Number&address=ContractAddress
in response will be javascript code to execute with eval()
function.
Required connected web3.js
library and Metamask
or geth server
to execute code.
Example:
var request = require('request');
var Web3 = require('web3');
var web3 = Web3.currentProvider()
request('http://server.com:3000/ContractName/FunctionName/?arg="String"&address=ContractAddress', function (error, response, body) {
eval(body)
});
TODO
- Catch errors