https://github.com/worldsibu/convector-example-token
https://github.com/worldsibu/convector-example-token
convector
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/worldsibu/convector-example-token
- Owner: worldsibu
- Created: 2018-06-30T20:39:39.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2019-04-01T01:16:01.000Z (about 7 years ago)
- Last Synced: 2025-01-05T06:22:08.892Z (over 1 year ago)
- Topics: convector
- Language: TypeScript
- Size: 87.9 KB
- Stars: 0
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Convector Token Test
## Usage
```bash
node ./update-paths.js
```
To start the dev environment and install the chaincodes run: `npm start`.
To init the token with all the funds on "user1" run: `hurl invoke token token_init '{"id":"TKN","balances":{},"totalSupply":100,"name":"token","symbol":"tkn"}' -u user1`
To make a transfer to "user2" from "user1" run: `hurl invoke token token_transfer TKN $(npm run user:fingerprint --silent -- user2) 50 -u user1`
* To find out the account fingerprint (necessary to make the transfers, as it works as an unique ID for each wallet) run: `npm run user:fingerprint -- user2`
You can see all balances here: http://localhost:5084/_utils/#database/ch1_token/TKN
## More transactions!
### Expect an error
Let's try to transfer more than available funds, getting an error.
```bash
# Second transfer will move all the funds from user1 into user2
hurl invoke token token_transfer TKN $(npm run user:fingerprint --silent -- user2) 51
# Third transfer will throw an error
hurl invoke token token_transfer TKN $(npm run user:fingerprint --silent -- user2) 51
# Should get a "The sender does not have enough founds"
# Find some funds from user2 to user3
hurl invoke token token_transfer TKN $(npm run user:fingerprint --silent -- user3) 51 -u user2
```