(ctx contractapi.TransactionContextInterface, counterKey string)
| 375 | } |
| 376 | |
| 377 | func currentID(ctx contractapi.TransactionContextInterface, counterKey string) (int, error) { |
| 378 | data, err := ctx.GetStub().GetState(counterKey) |
| 379 | if err != nil { |
| 380 | return 0, fmt.Errorf("failed to read counter %s: %w", counterKey, err) |
| 381 | } |
| 382 | if data == nil { |
| 383 | return 0, nil |
| 384 | } |
| 385 | return strconv.Atoi(string(data)) |
| 386 | } |
| 387 | |
| 388 | func readJSON(ctx contractapi.TransactionContextInterface, key string, target interface{}) error { |
| 389 | data, err := ctx.GetStub().GetState(key) |
no outgoing calls
no test coverage detected