Skip to content

Commit

Permalink
Merge pull request #16 from qubic/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
LINCKODE authored Jul 29, 2024
2 parents f03ad1b + 5ff4711 commit 0b14462
Show file tree
Hide file tree
Showing 9 changed files with 2,188 additions and 64 deletions.
294 changes: 292 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Some of its features include:
## Building from source

```shell
go build -o "server" "./app/server"
go build -o "server" "./app/grpc_server"
```

## Running the service
Expand Down Expand Up @@ -104,7 +104,7 @@ curl http://localhost:8000/block-height
}
```

#### /balances/{id}
#### /balances/{identity}

```shell
curl http://localhost:8000/balances/PKXGRCNOEEDLEGTLAZOSXMEYZIEDLGMSPNTJJJBHIBJISHFFYBBFDVGHRJQF
Expand Down Expand Up @@ -134,4 +134,294 @@ curl -X POST http://localhost:8000/broadcast-transaction -d '{"encodedTransactio
"encodedTransaction": "...",
"transactionId": "oxmqdbynwbisqcjgphyaexhlknmaanipiyxpulatkdjxpdqsqtiovjhcxqkd"
}
```

### Asset related endpoints

#### /assets/{identity}/issued

```shell
curl localhost:8000/assets/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFXIB/issued
```
```json
{
"issuedAssets": [
{
"data": {
"issuerIdentity": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFXIB",
"type": 1,
"name": "RANDOM",
"numberOfDecimalPlaces": 0,
"unitOfMeasurement": [0, 0, 0, 0, 0, 0, 0]
},
"info": {
"tick": 14057739,
"universeIndex": 0
}
},
{
"data": {
"issuerIdentity": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFXIB",
"type": 1,
"name": "QX",
"numberOfDecimalPlaces": 0,
"unitOfMeasurement": [0, 0, 0, 0, 0, 0, 0]
},
"info": {
"tick": 14057739,
"universeIndex": 0
}
},
{
"data": {
"issuerIdentity": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFXIB",
"type": 1,
"name": "QTRY",
"numberOfDecimalPlaces": 0,
"unitOfMeasurement": [0, 0, 0, 0, 0, 0, 0]
},
"info": {
"tick": 14057739,
"universeIndex": 0
}
},
{
"data": {
"issuerIdentity": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFXIB",
"type": 1,
"name": "QUTIL",
"numberOfDecimalPlaces": 0,
"unitOfMeasurement": [0, 0, 0, 0, 0, 0, 0]
},
"info": {
"tick": 14057739,
"universeIndex": 0
}
}
]
}
```

#### /assets/{identity}/owned

```shell
curl localhost:8000/assets/IGJQYTMFLVNIMEAKLANHKGNGZPFCFJGSMVOWMNGLWCZWKFHANHGCBYODMKBC/owned
```
```json
{
"ownedAssets": [
{
"data": {
"ownerIdentity": "IGJQYTMFLVNIMEAKLANHKGNGZPFCFJGSMVOWMNGLWCZWKFHANHGCBYODMKBC",
"type": 2,
"padding": 0,
"managingContractIndex": 1,
"issuanceIndex": 0,
"numberOfUnits": "2",
"issuedAsset": {
"issuerIdentity": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFXIB",
"type": 1,
"name": "RANDOM",
"numberOfDecimalPlaces": 0,
"unitOfMeasurement": [0, 0, 0, 0, 0, 0, 0]
}
},
"info": {
"tick": 14057652,
"universeIndex": 0
}
},
{
"data": {
"ownerIdentity": "IGJQYTMFLVNIMEAKLANHKGNGZPFCFJGSMVOWMNGLWCZWKFHANHGCBYODMKBC",
"type": 2,
"padding": 0,
"managingContractIndex": 1,
"issuanceIndex": 1,
"numberOfUnits": "1",
"issuedAsset": {
"issuerIdentity": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFXIB",
"type": 1,
"name": "QX",
"numberOfDecimalPlaces": 0,
"unitOfMeasurement": [0, 0, 0, 0, 0, 0, 0]
}
},
"info": {
"tick": 14057652,
"universeIndex": 0
}
},
{
"data": {
"ownerIdentity": "IGJQYTMFLVNIMEAKLANHKGNGZPFCFJGSMVOWMNGLWCZWKFHANHGCBYODMKBC",
"type": 2,
"padding": 0,
"managingContractIndex": 1,
"issuanceIndex": 9284980,
"numberOfUnits": "186685601",
"issuedAsset": {
"issuerIdentity": "QWALLETSGQVAGBHUCVVXWZXMBKQBPQQSHRYKZGEJWFVNUFCEDDPRMKTAUVHA",
"type": 1,
"name": "QWALLET",
"numberOfDecimalPlaces": 0,
"unitOfMeasurement": [0, -48, 0, -48, 35, 24, 21]
}
},
"info": {
"tick": 14057652,
"universeIndex": 0
}
},
{
"data": {
"ownerIdentity": "IGJQYTMFLVNIMEAKLANHKGNGZPFCFJGSMVOWMNGLWCZWKFHANHGCBYODMKBC",
"type": 2,
"padding": 0,
"managingContractIndex": 1,
"issuanceIndex": 2741973,
"numberOfUnits": "10",
"issuedAsset": {
"issuerIdentity": "TFUYVBXYIYBVTEMJHAJGEJOOZHJBQFVQLTBBKMEHPEVIZFXZRPEYFUWGTIWG",
"type": 1,
"name": "QFT",
"numberOfDecimalPlaces": 0,
"unitOfMeasurement": [84, 79, 75, 69, 78, 0, 0]
}
},
"info": {
"tick": 14057652,
"universeIndex": 0
}
}
]
}
```

#### /assets/{identity}/possessed

```shell
curl localhost:8000/assets/IGJQYTMFLVNIMEAKLANHKGNGZPFCFJGSMVOWMNGLWCZWKFHANHGCBYODMKBC/possessed
```
```json
{
"possessedAssets": [
{
"data": {
"possessorIdentity": "IGJQYTMFLVNIMEAKLANHKGNGZPFCFJGSMVOWMNGLWCZWKFHANHGCBYODMKBC",
"type": 3,
"padding": 0,
"managingContractIndex": 1,
"issuanceIndex": 9707976,
"numberOfUnits": "2",
"ownedAsset": {
"ownerIdentity": "IGJQYTMFLVNIMEAKLANHKGNGZPFCFJGSMVOWMNGLWCZWKFHANHGCBYODMKBC",
"type": 3,
"padding": 0,
"managingContractIndex": 1,
"issuanceIndex": 9707976,
"numberOfUnits": "2",
"issuedAsset": {
"issuerIdentity": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFXIB",
"type": 1,
"name": "RANDOM",
"numberOfDecimalPlaces": 0,
"unitOfMeasurement": [0, 0, 0, 0, 0, 0, 0]
}
}
},
"info": {
"tick": 14057759,
"universeIndex": 0
}
},
{
"data": {
"possessorIdentity": "IGJQYTMFLVNIMEAKLANHKGNGZPFCFJGSMVOWMNGLWCZWKFHANHGCBYODMKBC",
"type": 3,
"padding": 0,
"managingContractIndex": 1,
"issuanceIndex": 9707978,
"numberOfUnits": "1",
"ownedAsset": {
"ownerIdentity": "IGJQYTMFLVNIMEAKLANHKGNGZPFCFJGSMVOWMNGLWCZWKFHANHGCBYODMKBC",
"type": 3,
"padding": 0,
"managingContractIndex": 1,
"issuanceIndex": 9707978,
"numberOfUnits": "1",
"issuedAsset": {
"issuerIdentity": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFXIB",
"type": 1,
"name": "QX",
"numberOfDecimalPlaces": 0,
"unitOfMeasurement": [0, 0, 0, 0, 0, 0, 0]
}
}
},
"info": {
"tick": 14057759,
"universeIndex": 0
}
},
{
"data": {
"possessorIdentity": "IGJQYTMFLVNIMEAKLANHKGNGZPFCFJGSMVOWMNGLWCZWKFHANHGCBYODMKBC",
"type": 3,
"padding": 0,
"managingContractIndex": 1,
"issuanceIndex": 9707980,
"numberOfUnits": "186685601",
"ownedAsset": {
"ownerIdentity": "IGJQYTMFLVNIMEAKLANHKGNGZPFCFJGSMVOWMNGLWCZWKFHANHGCBYODMKBC",
"type": 3,
"padding": 0,
"managingContractIndex": 1,
"issuanceIndex": 9707980,
"numberOfUnits": "186685601",
"issuedAsset": {
"issuerIdentity": "QWALLETSGQVAGBHUCVVXWZXMBKQBPQQSHRYKZGEJWFVNUFCEDDPRMKTAUVHA",
"type": 1,
"name": "QWALLET",
"numberOfDecimalPlaces": 0,
"unitOfMeasurement": [0, -48, 0, -48, 35, 24, 21]
}
}
},
"info": {
"tick": 14057759,
"universeIndex": 0
}
},
{
"data": {
"possessorIdentity": "IGJQYTMFLVNIMEAKLANHKGNGZPFCFJGSMVOWMNGLWCZWKFHANHGCBYODMKBC",
"type": 3,
"padding": 0,
"managingContractIndex": 1,
"issuanceIndex": 9707982,
"numberOfUnits": "10",
"ownedAsset": {
"ownerIdentity": "IGJQYTMFLVNIMEAKLANHKGNGZPFCFJGSMVOWMNGLWCZWKFHANHGCBYODMKBC",
"type": 3,
"padding": 0,
"managingContractIndex": 1,
"issuanceIndex": 9707982,
"numberOfUnits": "10",
"issuedAsset": {
"issuerIdentity": "TFUYVBXYIYBVTEMJHAJGEJOOZHJBQFVQLTBBKMEHPEVIZFXZRPEYFUWGTIWG",
"type": 1,
"name": "QFT",
"numberOfDecimalPlaces": 0,
"unitOfMeasurement": [84, 79, 75, 69, 78, 0, 0]
}
}
},
"info": {
"tick": 14057759,
"universeIndex": 0
}
}
]
}
```
3 changes: 2 additions & 1 deletion app/grpc_server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ func run(log *log.Logger) error {
Pool struct {
NodeFetcherUrl string `conf:"default:http://127.0.0.1:8080/status"`
NodeFetcherTimeout time.Duration `conf:"default:2s"`
NodePort string `conf:"default:21841"`
InitialCap int `conf:"default:5"`
MaxIdle int `conf:"default:20"`
MaxCap int `conf:"default:30"`
Expand Down Expand Up @@ -76,7 +77,7 @@ func run(log *log.Logger) error {
IdleTimeout: cfg.Pool.IdleTimeout,
NodeFetcherUrl: cfg.Pool.NodeFetcherUrl,
NodeFetcherTimeout: cfg.Pool.NodeFetcherTimeout,
NodePort: "21841",
NodePort: cfg.Pool.NodePort,
})
if err != nil {
return errors.Wrap(err, "creating qubic pool")
Expand Down
Loading

0 comments on commit 0b14462

Please sign in to comment.