(ctx contractapi.TransactionContextInterface, counterKey string)
| 276 | } |
| 277 | |
| 278 | func currentID(ctx contractapi.TransactionContextInterface, counterKey string) (int, error) { |
| 279 | data, err := ctx.GetStub().GetState(counterKey) |
| 280 | if err != nil { |
| 281 | return 0, fmt.Errorf("failed to read counter %s: %w", counterKey, err) |
| 282 | } |
| 283 | if data == nil { |
| 284 | return 0, nil |
| 285 | } |
| 286 | return strconv.Atoi(string(data)) |
| 287 | } |
| 288 | |
| 289 | func readJSON(ctx contractapi.TransactionContextInterface, key string, target interface{}) error { |
| 290 | data, err := ctx.GetStub().GetState(key) |
no outgoing calls
no test coverage detected