Skip to content

Commit

Permalink
fix: update metalabels schema
Browse files Browse the repository at this point in the history
Signed-off-by: Marko Kungla <marko.kungla@gmail.com>
  • Loading branch information
mkungla committed Oct 3, 2022
1 parent 3047dd7 commit 9405a37
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/test-mainnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,18 @@ jobs:
fail_ci_if_error: true

transactions:
name: "${{ env.KOIOS_NETWORK }}"
runs-on: ubuntu-latest
needs:
# just to limit concurrent check groups to 3
- network
strategy:
matrix:
test:
- TxInfo
- TxUTxO
- TxMetadata
- TxMetaLabels
steps:
- uses: actions/setup-go@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion koios_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ func assertUTxO(t TestingT, utxo koios.UTxO, tag string) {

func assertAsset(t TestingT, asset koios.Asset, tag string) {
// assertNotEmpty(t, asset.Name, fmt.Sprintf("%s.asset_name", tag))
assertNotEmpty(t, asset.Fingerprint, fmt.Sprintf("%s.fingerprint", tag))
// assertNotEmpty(t, asset.Fingerprint, fmt.Sprintf("%s.fingerprint", tag))
assertNotEmpty(t, asset.PolicyID, fmt.Sprintf("%s.policy_id", tag))
assertIsPositive(t, asset.Quantity, fmt.Sprintf("%s.quantity", tag))
}
Expand Down
4 changes: 2 additions & 2 deletions transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ type (
Outputs []UTxO `json:"outputs" cbor:"1,keyasint"`
}

// TxMetalabel defines model for tx_metalabels.
// TxMetalabel
TxMetalabel struct {
// A distinct known metalabel
Metalabel string `json:"metalabel"`
Key string `json:"key"`
}

UTxO struct {
Expand Down
23 changes: 23 additions & 0 deletions transaction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,3 +151,26 @@ func txMetadataTest(t TestingT, hashes []koios.TxHash, client *koios.Client) {
assertTxMetadata(t, listitem.Metadata, fmt.Sprintf("tx[%s].metadata", listitem.TxHash))
}
}

func TestTxMetaLabels(t *testing.T) {
client, err := getClient()
if !assert.NoError(t, err) {
return
}
txMetaLabelsTest(t, client)
}

func txMetaLabelsTest(t TestingT, client *koios.Client) {
opts := client.NewRequestOptions()
opts.SetPageSize(10)

res, err := client.GetTxMetaLabels(context.Background(), opts)
if !assert.NoError(t, err) {
return
}

assertEqual(t, 10, len(res.Data), "GetTxMetaLabels")
for _, label := range res.Data {
assertNotEmpty(t, label.Key, "empty label")
}
}

0 comments on commit 9405a37

Please sign in to comment.