MCPcopy Index your code
hub / github.com/yeasy/blockchain_guide / currentID

Function currentID

11_app_dev/chaincode_example03.go:377–386  ·  view source on GitHub ↗
(ctx contractapi.TransactionContextInterface, counterKey string)

Source from the content-addressed store, hash-verified

375}
376
377func 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
388func readJSON(ctx contractapi.TransactionContextInterface, key string, target interface{}) error {
389 data, err := ctx.GetStub().GetState(key)

Callers 4

GetBanksMethod · 0.70
GetCompaniesMethod · 0.70
GetTransactionsMethod · 0.70
nextIDFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected