(ctx contractapi.TransactionContextInterface, key string, value interface{})
| 400 | } |
| 401 | |
| 402 | func putJSON(ctx contractapi.TransactionContextInterface, key string, value interface{}) error { |
| 403 | data, err := json.Marshal(value) |
| 404 | if err != nil { |
| 405 | return fmt.Errorf("failed to encode %s: %w", key, err) |
| 406 | } |
| 407 | if err := ctx.GetStub().PutState(key, data); err != nil { |
| 408 | return fmt.Errorf("failed to write %s: %w", key, err) |
| 409 | } |
| 410 | return nil |
| 411 | } |
| 412 | |
| 413 | func bankKey(id int) string { |
| 414 | return fmt.Sprintf("bank:%d", id) |
no outgoing calls
no test coverage detected