Skip to content

Commit d55bfd2

Browse files
committed
Add tronweb, add test cases, update README
1 parent 98f521e commit d55bfd2

File tree

5 files changed

+272
-3
lines changed

5 files changed

+272
-3
lines changed

assets/docker.png

358 KB
Loading

contracts/README.md

+10-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,15 @@ npm i -g tronbox
1919

2020
## Local testing
2121

22+
Start docker
23+
24+
```
25+
docker run -it --rm -p 9090:9090 --name tron trontools/quickstart
26+
```
27+
28+
![Docker image](../assets/docker.png)
29+
30+
Run test
2231
```
2332
tronbox test
24-
```
33+
```

contracts/package-lock.json

+243-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

contracts/package.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,8 @@
1111
"test": "source .env && tronbox test"
1212
},
1313
"author": "Portal Network",
14-
"license": "MIT"
14+
"license": "MIT",
15+
"dependencies": {
16+
"tronweb": "^2.6.4"
17+
}
1518
}

contracts/test/tronweb.test.js

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
const TronWeb = require('tronweb');
2+
const tronWeb = new TronWeb({
3+
fullHost: 'https://api.trongrid.io',
4+
privateKey: process.env.PRIVATE_KEY_SHASTA
5+
})
6+
7+
contract('TRXNS', function(accounts) {
8+
it("should verify that there are at least three available accounts", async function () {
9+
console.log(accounts.length);
10+
if(accounts.length < 3) {
11+
//console.log(chalk.blue('\nYOUR ATTENTION, PLEASE.]\nTo test MetaCoin you should use Tron Quickstart (https://github.com/tronprotocol/docker-tron-quickstart) as your private network.\nAlternatively, you must set your own accounts in the "before" statement in "test/metacoin.js".\n'))
12+
}
13+
assert.isTrue(accounts.length >= 3)
14+
})
15+
})

0 commit comments

Comments
 (0)