Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gipsh/basic-contract-interaction
https://github.com/gipsh/basic-contract-interaction
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/gipsh/basic-contract-interaction
- Owner: gipsh
- Created: 2022-01-20T15:58:08.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-01-23T19:20:06.000Z (almost 3 years ago)
- Last Synced: 2024-06-20T22:45:48.304Z (6 months ago)
- Language: Go
- Size: 105 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# basic-contract-interaction
API example for talking with a smart-contract deployed on polygon
## Config
Copy `example.env` to `app.env` and config the private key
```bash
cp example.env app.env
```## Run
First compile
```bash
go build
```Then run
```bash
./basic-contract-interaction
```## Test
#### Get product by id
```bash
curl http://localhost:8080/product/17
``````json
{
"Name": "newprod",
"Status": 1,
"Owner": "0x08f5f9a336aae6a72c795ddf307864b13d13f0aa",
"NewOwner": "0x08f5f9a336aae6a72c795ddf307864b13d13f0aa"
}
```#### Get delegated products from a wallet
```bash
curl http://localhost:8080/products/0xCF6380c9B128941d20d9F812dA406A79424b4B7B
``````json
{
"address": "0xCF6380c9B128941d20d9F812dA406A79424b4B7B",
"products": [
"34",
"35",
"37"
]
}
```