Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wangpin34/pet-shop-vue
pet shop, web3, vuejs
https://github.com/wangpin34/pet-shop-vue
Last synced: 5 days ago
JSON representation
pet shop, web3, vuejs
- Host: GitHub
- URL: https://github.com/wangpin34/pet-shop-vue
- Owner: wangpin34
- Created: 2023-11-23T09:58:14.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2023-12-29T06:46:27.000Z (11 months ago)
- Last Synced: 2023-12-29T07:39:21.347Z (11 months ago)
- Language: Vue
- Size: 195 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Pet Shop
The sample project https://trufflesuite.com/guides/pet-shop/ makes a great job, however, there are still several points could be improved. e.g. small app.js, typescript, etc.
I rewrite the sample for me and others who like to try the development of dapp. This app shows out the following features:
1. connect to blockchain
2. maintain a smart contract
3. interact with smart contractNote: Please follow the guides of https://trufflesuite.com/guides/pet-shop/ to setup Ganache and MetaMask firstly before you running this project.
Note: It assumes you have the basic knowledge of web app development, and have NodeJS/PNPM/Makefile(optional) installed.
## Getting Started
```bash
pnpm i # install depends packages
pnpm dev # start the dev server
```Please make sure the `contract address` and the provider are configured property in `.env` file like below:
```ini
VITE_PROVIDER_URL=http://127.0.0.1:7545
VITE_CONTRACT_ADDR=0xaa54911eab841B73c6580631a0bD38FAD79e9b14
```ps: replace the url and address with yours.
## Commands
`deploy`(`migrate` actually, but for me, a web app developer, `deploy` make more sense to understand) contracts.
```bash
make deploy_contracts
```After `deploy` contracts, you can get the `contract address` from `src/contract-address.json`.
```
"networks": {
"5777": {
"events": {},
"links": {},
"address": "0xaa54911eab841B73c6580631a0bD38FAD79e9b14",
"transactionHash": "0x665ffe12a03fc8c9318158f25eb81ff7412fec6af8377b5af9c2e14d1aed54a4"
}
},
```And the console output.
```
Deploying 'Adoption'
--------------------
> transaction hash: 0x665ffe12a03fc8c9318158f25eb81ff7412fec6af8377b5af9c2e14d1aed54a4
- Blocks: 0 Seconds: 0
> Blocks: 0 Seconds: 0
> contract address: 0xaa54911eab841B73c6580631a0bD38FAD79e9b14
```Generate `Type`. Read more on [Infer Contract Types from JSON Artifact](https://docs.web3js.org/guides/smart_contracts/infer_contract_types_guide/).
```bash
make gen-contract-types
```The generated types
## LICENSE
MIT