Skip to content
This repository has been archived by the owner on Jan 3, 2021. It is now read-only.

Commit

Permalink
Code style changes
Browse files Browse the repository at this point in the history
  • Loading branch information
dizer committed Oct 3, 2017
1 parent a5afb52 commit 68d2b4b
Show file tree
Hide file tree
Showing 18 changed files with 1,539 additions and 1,511 deletions.
22 changes: 22 additions & 0 deletions .editorconfig
@@ -0,0 +1,22 @@
# EditorConfig is awesome: http://EditorConfig.org

root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true

# https://github.com/Microsoft/TypeScript/blob/master/.editorconfig
[*.{ts,json,js}]
end_of_line = crlf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 4

# https://github.com/paritytech/contracts/blob/master/.editorconfig
[*.sol]
indent_style = tabs
indent_size = 4
27 changes: 19 additions & 8 deletions .gitignore
@@ -1,8 +1,19 @@
node_modules
build
dist
package-lock.json
src/artifacts
src/lib/W3/*.js
soltsice.js
contracts/zeppelin
/node_modules
/build
/dist
/tmp
/package-lock.json
/src/artifacts
/src/lib/W3/*.js
/soltsice.js
/contracts/zeppelin

/nbproject
/.idea

*~
*.swp
*.swap

.DS_Store

16 changes: 15 additions & 1 deletion Readme.md
Expand Up @@ -6,6 +6,20 @@

> npm install soltsice --save
## Quick Start Guide

You need to have Node and Typescript compilers installed.

> npm install
> npm run build:contracts
> npm run soltsice
> npm run testrpc
> truffle migrate
## Usage

Soltsice allows to generate TypeScript files for Ethereum contracts with the command:
Expand Down Expand Up @@ -68,4 +82,4 @@ Some functionality such as Solidity libraries is not supported yet. Contributors

## License

MIT
MIT
28 changes: 0 additions & 28 deletions contracts/SortedList.sol_

This file was deleted.

7 changes: 6 additions & 1 deletion package.json
Expand Up @@ -24,12 +24,17 @@
"homepage": "https://github.com/dbrainio/Soltsice#readme",
"devDependencies": {
"@types/node": "^8.0.28",
"ethereumjs-testrpc": "^4.1.3",
"tslint": "^5.7.0",
"tslint-react": "^3.2.0",
"zeppelin-solidity": "^1.3.0"
},
"dependencies": {
"@types/underscore": "^1.8.2",
"bignumber.js": "^4.0.0",
"truffle": "^3.4.11",
"truffle-contract": "^3.0.0",
"typescript": "^2.5.3",
"web3": "^0.20.1"
},
"peerDependencies": {
Expand All @@ -39,7 +44,7 @@
"web3": "^0.20.1"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"test": "truffle test",
"build:contracts": "truffle compile",
"testrpc": "testrpc -v -m dbrainio -i 314 --account=\"0x1ce01934dbcd6fd84e68faca8c6aebca346162823d20f0562135fe3e4f275bce,1000000000000000000000000\" --account=\"0x058f98c376f9bf8e3bf167821ceabfdb15202408bc9a288c30a2339152341a27,1000000000000000000000000\" --account=\"0x98295a1bbe25893261d962e56419da5064a45af2864052612498ef01346a5cd2,1000000000000000000000000\" --account=\"0xb11ca488b6881322b141510bc2568a9434b74c25b5a315ac3699bcb6d4677eac,1000000000000000000000000\" --account=\"0xcebd6eb5764cb4dbaa42ddf62db0834bc58a9fb93f5776bff32d2f97544bc500,1000000000000000000000000\" ",
"soltsice": "tsc && cp -R build/contracts/. src/artifacts && cp -R build/contracts/. dist/src/artifacts && npm run soltsice:gen && tsc",
Expand Down
70 changes: 34 additions & 36 deletions src/CustomContract.ts
@@ -1,36 +1,34 @@
import { BigNumber } from 'bignumber.js';
import { W3 } from './W3';
import { SoltsiceContract } from './SoltsiceContract'

/**
* CustomContract API
*/
export class CustomContract extends SoltsiceContract {
constructor(
deploymentParams: string | W3.TC.TxParams | object,
web3?: W3,
ctorParams?: {str: string}
) {
super(
web3,
require(`../../contracts/CustomContract.json`),
ctorParams ? [ctorParams!.str] : [],
deploymentParams
)
}

/*
Contract methods
*/

totalSupply(): Promise<BigNumber> {
return new Promise((resolve, reject) => {
this._instance.then((inst) => {
inst.totalSupply
.call()
.then((res) => resolve(res))
.catch((err) => reject(err));
});
});
}
}
import { BigNumber } from 'bignumber.js';
import { W3 } from './W3';
import { SoltsiceContract } from './SoltsiceContract'

/**
* CustomContract API
*/
export class CustomContract extends SoltsiceContract {
constructor(deploymentParams: string | W3.TC.TxParams | object,
web3?: W3,
ctorParams?: { str: string }) {
super(
web3,
require(`../../contracts/CustomContract.json`),
ctorParams ? [ctorParams!.str] : [],
deploymentParams
)
}

/*
Contract methods
*/

totalSupply(): Promise<BigNumber> {
return new Promise((resolve, reject) => {
this._instance.then((inst) => {
inst.totalSupply
.call()
.then((res) => resolve(res))
.catch((err) => reject(err));
});
});
}
}

0 comments on commit 68d2b4b

Please sign in to comment.