mirror of
https://github.com/hyperledger/fabric-samples.git
synced 2026-06-17 07:25:10 +00:00
Update Go chaincode to fabric-contract-api-go/v2
Signed-off-by: Mark S. Lewis <Mark.S.Lewis@outlook.com>
This commit is contained in:
parent
7258b4f4ab
commit
110e732259
73 changed files with 1404 additions and 15737 deletions
|
|
@ -1,32 +1,32 @@
|
|||
module github.com/hyperledger/fabric-samples/asset-transfer-abac/chaincode-go
|
||||
|
||||
go 1.17
|
||||
go 1.21
|
||||
|
||||
require github.com/hyperledger/fabric-contract-api-go v1.2.1
|
||||
require github.com/hyperledger/fabric-contract-api-go/v2 v2.0.0
|
||||
|
||||
require (
|
||||
github.com/go-openapi/jsonpointer v0.19.5 // indirect
|
||||
github.com/go-openapi/jsonreference v0.20.0 // indirect
|
||||
github.com/go-openapi/spec v0.20.8 // indirect
|
||||
github.com/go-openapi/swag v0.21.1 // indirect
|
||||
github.com/gobuffalo/envy v1.10.1 // indirect
|
||||
github.com/gobuffalo/packd v1.0.1 // indirect
|
||||
github.com/go-openapi/jsonpointer v0.21.0 // indirect
|
||||
github.com/go-openapi/jsonreference v0.21.0 // indirect
|
||||
github.com/go-openapi/spec v0.21.0 // indirect
|
||||
github.com/go-openapi/swag v0.23.0 // indirect
|
||||
github.com/gobuffalo/envy v1.10.2 // indirect
|
||||
github.com/gobuffalo/packd v1.0.2 // indirect
|
||||
github.com/gobuffalo/packr v1.30.1 // indirect
|
||||
github.com/golang/protobuf v1.5.2 // indirect
|
||||
github.com/hyperledger/fabric-chaincode-go v0.0.0-20230228194215-b84622ba6a7a // indirect
|
||||
github.com/hyperledger/fabric-protos-go v0.3.0 // indirect
|
||||
github.com/joho/godotenv v1.4.0 // indirect
|
||||
github.com/hyperledger/fabric-chaincode-go/v2 v2.0.0-20240618210511-f7903324a8af // indirect
|
||||
github.com/hyperledger/fabric-protos-go-apiv2 v0.3.3 // indirect
|
||||
github.com/joho/godotenv v1.5.1 // indirect
|
||||
github.com/josharian/intern v1.0.0 // indirect
|
||||
github.com/mailru/easyjson v0.7.7 // indirect
|
||||
github.com/rogpeppe/go-internal v1.8.1 // indirect
|
||||
github.com/rogpeppe/go-internal v1.12.0 // indirect
|
||||
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
|
||||
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
|
||||
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
|
||||
golang.org/x/net v0.7.0 // indirect
|
||||
golang.org/x/sys v0.5.0 // indirect
|
||||
golang.org/x/text v0.7.0 // indirect
|
||||
golang.org/x/mod v0.17.0 // indirect
|
||||
golang.org/x/net v0.24.0 // indirect
|
||||
golang.org/x/sys v0.19.0 // indirect
|
||||
golang.org/x/text v0.14.0 // indirect
|
||||
google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect
|
||||
google.golang.org/grpc v1.53.0 // indirect
|
||||
google.golang.org/protobuf v1.28.1 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
google.golang.org/grpc v1.64.0 // indirect
|
||||
google.golang.org/protobuf v1.34.2 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -5,7 +5,7 @@ import (
|
|||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
"github.com/hyperledger/fabric-contract-api-go/contractapi"
|
||||
"github.com/hyperledger/fabric-contract-api-go/v2/contractapi"
|
||||
)
|
||||
|
||||
// SmartContract provides functions for managing an Asset
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ package main
|
|||
import (
|
||||
"log"
|
||||
|
||||
"github.com/hyperledger/fabric-contract-api-go/contractapi"
|
||||
"github.com/hyperledger/fabric-contract-api-go/v2/contractapi"
|
||||
abac "github.com/hyperledger/fabric-samples/asset-transfer-abac/chaincode-go/smart-contract"
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
ARG GO_VER=1.17
|
||||
ARG ALPINE_VER=3.16
|
||||
ARG GO_VER=1.22
|
||||
ARG ALPINE_VER=3.20
|
||||
|
||||
FROM golang:${GO_VER}-alpine${ALPINE_VER}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ import (
|
|||
"os"
|
||||
"strconv"
|
||||
|
||||
"github.com/hyperledger/fabric-chaincode-go/shim"
|
||||
"github.com/hyperledger/fabric-contract-api-go/contractapi"
|
||||
"github.com/hyperledger/fabric-chaincode-go/v2/shim"
|
||||
"github.com/hyperledger/fabric-contract-api-go/v2/contractapi"
|
||||
)
|
||||
|
||||
type serverConfig struct {
|
||||
|
|
|
|||
|
|
@ -1,34 +1,34 @@
|
|||
module github.com/hyperledger/fabric-samples/asset-transfer-basic/chaincode-external
|
||||
|
||||
go 1.17
|
||||
go 1.21
|
||||
|
||||
require (
|
||||
github.com/hyperledger/fabric-chaincode-go v0.0.0-20230228194215-b84622ba6a7a
|
||||
github.com/hyperledger/fabric-contract-api-go v1.2.1
|
||||
github.com/hyperledger/fabric-chaincode-go/v2 v2.0.0-20240618210511-f7903324a8af
|
||||
github.com/hyperledger/fabric-contract-api-go/v2 v2.0.0
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/go-openapi/jsonpointer v0.19.5 // indirect
|
||||
github.com/go-openapi/jsonreference v0.20.0 // indirect
|
||||
github.com/go-openapi/spec v0.20.8 // indirect
|
||||
github.com/go-openapi/swag v0.21.1 // indirect
|
||||
github.com/gobuffalo/envy v1.10.1 // indirect
|
||||
github.com/gobuffalo/packd v1.0.1 // indirect
|
||||
github.com/go-openapi/jsonpointer v0.21.0 // indirect
|
||||
github.com/go-openapi/jsonreference v0.21.0 // indirect
|
||||
github.com/go-openapi/spec v0.21.0 // indirect
|
||||
github.com/go-openapi/swag v0.23.0 // indirect
|
||||
github.com/gobuffalo/envy v1.10.2 // indirect
|
||||
github.com/gobuffalo/packd v1.0.2 // indirect
|
||||
github.com/gobuffalo/packr v1.30.1 // indirect
|
||||
github.com/golang/protobuf v1.5.2 // indirect
|
||||
github.com/hyperledger/fabric-protos-go v0.3.0 // indirect
|
||||
github.com/joho/godotenv v1.4.0 // indirect
|
||||
github.com/hyperledger/fabric-protos-go-apiv2 v0.3.3 // indirect
|
||||
github.com/joho/godotenv v1.5.1 // indirect
|
||||
github.com/josharian/intern v1.0.0 // indirect
|
||||
github.com/mailru/easyjson v0.7.7 // indirect
|
||||
github.com/rogpeppe/go-internal v1.8.1 // indirect
|
||||
github.com/rogpeppe/go-internal v1.12.0 // indirect
|
||||
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
|
||||
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
|
||||
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
|
||||
golang.org/x/net v0.7.0 // indirect
|
||||
golang.org/x/sys v0.5.0 // indirect
|
||||
golang.org/x/text v0.7.0 // indirect
|
||||
golang.org/x/mod v0.17.0 // indirect
|
||||
golang.org/x/net v0.24.0 // indirect
|
||||
golang.org/x/sys v0.19.0 // indirect
|
||||
golang.org/x/text v0.14.0 // indirect
|
||||
google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect
|
||||
google.golang.org/grpc v1.53.0 // indirect
|
||||
google.golang.org/protobuf v1.28.1 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
google.golang.org/grpc v1.64.0 // indirect
|
||||
google.golang.org/protobuf v1.34.2 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -7,7 +7,7 @@ package main
|
|||
import (
|
||||
"log"
|
||||
|
||||
"github.com/hyperledger/fabric-contract-api-go/contractapi"
|
||||
"github.com/hyperledger/fabric-contract-api-go/v2/contractapi"
|
||||
"github.com/hyperledger/fabric-samples/asset-transfer-basic/chaincode-go/chaincode"
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ package mocks
|
|||
import (
|
||||
"sync"
|
||||
|
||||
"github.com/hyperledger/fabric-chaincode-go/shim"
|
||||
"github.com/hyperledger/fabric-protos-go/peer"
|
||||
"github.com/hyperledger/fabric-chaincode-go/v2/shim"
|
||||
"github.com/hyperledger/fabric-protos-go-apiv2/peer"
|
||||
"google.golang.org/protobuf/types/known/timestamppb"
|
||||
)
|
||||
|
||||
|
|
@ -400,7 +400,7 @@ type ChaincodeStub struct {
|
|||
result1 *timestamppb.Timestamp
|
||||
result2 error
|
||||
}
|
||||
InvokeChaincodeStub func(string, [][]byte, string) peer.Response
|
||||
InvokeChaincodeStub func(string, [][]byte, string) *peer.Response
|
||||
invokeChaincodeMutex sync.RWMutex
|
||||
invokeChaincodeArgsForCall []struct {
|
||||
arg1 string
|
||||
|
|
@ -408,10 +408,10 @@ type ChaincodeStub struct {
|
|||
arg3 string
|
||||
}
|
||||
invokeChaincodeReturns struct {
|
||||
result1 peer.Response
|
||||
result1 *peer.Response
|
||||
}
|
||||
invokeChaincodeReturnsOnCall map[int]struct {
|
||||
result1 peer.Response
|
||||
result1 *peer.Response
|
||||
}
|
||||
PurgePrivateDataStub func(string, string) error
|
||||
purgePrivateDataMutex sync.RWMutex
|
||||
|
|
@ -518,15 +518,16 @@ func (fake *ChaincodeStub) CreateCompositeKey(arg1 string, arg2 []string) (strin
|
|||
arg1 string
|
||||
arg2 []string
|
||||
}{arg1, arg2Copy})
|
||||
stub := fake.CreateCompositeKeyStub
|
||||
fakeReturns := fake.createCompositeKeyReturns
|
||||
fake.recordInvocation("CreateCompositeKey", []interface{}{arg1, arg2Copy})
|
||||
fake.createCompositeKeyMutex.Unlock()
|
||||
if fake.CreateCompositeKeyStub != nil {
|
||||
return fake.CreateCompositeKeyStub(arg1, arg2)
|
||||
if stub != nil {
|
||||
return stub(arg1, arg2)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1, ret.result2
|
||||
}
|
||||
fakeReturns := fake.createCompositeKeyReturns
|
||||
return fakeReturns.result1, fakeReturns.result2
|
||||
}
|
||||
|
||||
|
|
@ -582,15 +583,16 @@ func (fake *ChaincodeStub) DelPrivateData(arg1 string, arg2 string) error {
|
|||
arg1 string
|
||||
arg2 string
|
||||
}{arg1, arg2})
|
||||
stub := fake.DelPrivateDataStub
|
||||
fakeReturns := fake.delPrivateDataReturns
|
||||
fake.recordInvocation("DelPrivateData", []interface{}{arg1, arg2})
|
||||
fake.delPrivateDataMutex.Unlock()
|
||||
if fake.DelPrivateDataStub != nil {
|
||||
return fake.DelPrivateDataStub(arg1, arg2)
|
||||
if stub != nil {
|
||||
return stub(arg1, arg2)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1
|
||||
}
|
||||
fakeReturns := fake.delPrivateDataReturns
|
||||
return fakeReturns.result1
|
||||
}
|
||||
|
||||
|
|
@ -642,15 +644,16 @@ func (fake *ChaincodeStub) DelState(arg1 string) error {
|
|||
fake.delStateArgsForCall = append(fake.delStateArgsForCall, struct {
|
||||
arg1 string
|
||||
}{arg1})
|
||||
stub := fake.DelStateStub
|
||||
fakeReturns := fake.delStateReturns
|
||||
fake.recordInvocation("DelState", []interface{}{arg1})
|
||||
fake.delStateMutex.Unlock()
|
||||
if fake.DelStateStub != nil {
|
||||
return fake.DelStateStub(arg1)
|
||||
if stub != nil {
|
||||
return stub(arg1)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1
|
||||
}
|
||||
fakeReturns := fake.delStateReturns
|
||||
return fakeReturns.result1
|
||||
}
|
||||
|
||||
|
|
@ -701,15 +704,16 @@ func (fake *ChaincodeStub) GetArgs() [][]byte {
|
|||
ret, specificReturn := fake.getArgsReturnsOnCall[len(fake.getArgsArgsForCall)]
|
||||
fake.getArgsArgsForCall = append(fake.getArgsArgsForCall, struct {
|
||||
}{})
|
||||
stub := fake.GetArgsStub
|
||||
fakeReturns := fake.getArgsReturns
|
||||
fake.recordInvocation("GetArgs", []interface{}{})
|
||||
fake.getArgsMutex.Unlock()
|
||||
if fake.GetArgsStub != nil {
|
||||
return fake.GetArgsStub()
|
||||
if stub != nil {
|
||||
return stub()
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1
|
||||
}
|
||||
fakeReturns := fake.getArgsReturns
|
||||
return fakeReturns.result1
|
||||
}
|
||||
|
||||
|
|
@ -753,15 +757,16 @@ func (fake *ChaincodeStub) GetArgsSlice() ([]byte, error) {
|
|||
ret, specificReturn := fake.getArgsSliceReturnsOnCall[len(fake.getArgsSliceArgsForCall)]
|
||||
fake.getArgsSliceArgsForCall = append(fake.getArgsSliceArgsForCall, struct {
|
||||
}{})
|
||||
stub := fake.GetArgsSliceStub
|
||||
fakeReturns := fake.getArgsSliceReturns
|
||||
fake.recordInvocation("GetArgsSlice", []interface{}{})
|
||||
fake.getArgsSliceMutex.Unlock()
|
||||
if fake.GetArgsSliceStub != nil {
|
||||
return fake.GetArgsSliceStub()
|
||||
if stub != nil {
|
||||
return stub()
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1, ret.result2
|
||||
}
|
||||
fakeReturns := fake.getArgsSliceReturns
|
||||
return fakeReturns.result1, fakeReturns.result2
|
||||
}
|
||||
|
||||
|
|
@ -808,15 +813,16 @@ func (fake *ChaincodeStub) GetBinding() ([]byte, error) {
|
|||
ret, specificReturn := fake.getBindingReturnsOnCall[len(fake.getBindingArgsForCall)]
|
||||
fake.getBindingArgsForCall = append(fake.getBindingArgsForCall, struct {
|
||||
}{})
|
||||
stub := fake.GetBindingStub
|
||||
fakeReturns := fake.getBindingReturns
|
||||
fake.recordInvocation("GetBinding", []interface{}{})
|
||||
fake.getBindingMutex.Unlock()
|
||||
if fake.GetBindingStub != nil {
|
||||
return fake.GetBindingStub()
|
||||
if stub != nil {
|
||||
return stub()
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1, ret.result2
|
||||
}
|
||||
fakeReturns := fake.getBindingReturns
|
||||
return fakeReturns.result1, fakeReturns.result2
|
||||
}
|
||||
|
||||
|
|
@ -863,15 +869,16 @@ func (fake *ChaincodeStub) GetChannelID() string {
|
|||
ret, specificReturn := fake.getChannelIDReturnsOnCall[len(fake.getChannelIDArgsForCall)]
|
||||
fake.getChannelIDArgsForCall = append(fake.getChannelIDArgsForCall, struct {
|
||||
}{})
|
||||
stub := fake.GetChannelIDStub
|
||||
fakeReturns := fake.getChannelIDReturns
|
||||
fake.recordInvocation("GetChannelID", []interface{}{})
|
||||
fake.getChannelIDMutex.Unlock()
|
||||
if fake.GetChannelIDStub != nil {
|
||||
return fake.GetChannelIDStub()
|
||||
if stub != nil {
|
||||
return stub()
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1
|
||||
}
|
||||
fakeReturns := fake.getChannelIDReturns
|
||||
return fakeReturns.result1
|
||||
}
|
||||
|
||||
|
|
@ -915,15 +922,16 @@ func (fake *ChaincodeStub) GetCreator() ([]byte, error) {
|
|||
ret, specificReturn := fake.getCreatorReturnsOnCall[len(fake.getCreatorArgsForCall)]
|
||||
fake.getCreatorArgsForCall = append(fake.getCreatorArgsForCall, struct {
|
||||
}{})
|
||||
stub := fake.GetCreatorStub
|
||||
fakeReturns := fake.getCreatorReturns
|
||||
fake.recordInvocation("GetCreator", []interface{}{})
|
||||
fake.getCreatorMutex.Unlock()
|
||||
if fake.GetCreatorStub != nil {
|
||||
return fake.GetCreatorStub()
|
||||
if stub != nil {
|
||||
return stub()
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1, ret.result2
|
||||
}
|
||||
fakeReturns := fake.getCreatorReturns
|
||||
return fakeReturns.result1, fakeReturns.result2
|
||||
}
|
||||
|
||||
|
|
@ -970,15 +978,16 @@ func (fake *ChaincodeStub) GetDecorations() map[string][]byte {
|
|||
ret, specificReturn := fake.getDecorationsReturnsOnCall[len(fake.getDecorationsArgsForCall)]
|
||||
fake.getDecorationsArgsForCall = append(fake.getDecorationsArgsForCall, struct {
|
||||
}{})
|
||||
stub := fake.GetDecorationsStub
|
||||
fakeReturns := fake.getDecorationsReturns
|
||||
fake.recordInvocation("GetDecorations", []interface{}{})
|
||||
fake.getDecorationsMutex.Unlock()
|
||||
if fake.GetDecorationsStub != nil {
|
||||
return fake.GetDecorationsStub()
|
||||
if stub != nil {
|
||||
return stub()
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1
|
||||
}
|
||||
fakeReturns := fake.getDecorationsReturns
|
||||
return fakeReturns.result1
|
||||
}
|
||||
|
||||
|
|
@ -1022,15 +1031,16 @@ func (fake *ChaincodeStub) GetFunctionAndParameters() (string, []string) {
|
|||
ret, specificReturn := fake.getFunctionAndParametersReturnsOnCall[len(fake.getFunctionAndParametersArgsForCall)]
|
||||
fake.getFunctionAndParametersArgsForCall = append(fake.getFunctionAndParametersArgsForCall, struct {
|
||||
}{})
|
||||
stub := fake.GetFunctionAndParametersStub
|
||||
fakeReturns := fake.getFunctionAndParametersReturns
|
||||
fake.recordInvocation("GetFunctionAndParameters", []interface{}{})
|
||||
fake.getFunctionAndParametersMutex.Unlock()
|
||||
if fake.GetFunctionAndParametersStub != nil {
|
||||
return fake.GetFunctionAndParametersStub()
|
||||
if stub != nil {
|
||||
return stub()
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1, ret.result2
|
||||
}
|
||||
fakeReturns := fake.getFunctionAndParametersReturns
|
||||
return fakeReturns.result1, fakeReturns.result2
|
||||
}
|
||||
|
||||
|
|
@ -1078,15 +1088,16 @@ func (fake *ChaincodeStub) GetHistoryForKey(arg1 string) (shim.HistoryQueryItera
|
|||
fake.getHistoryForKeyArgsForCall = append(fake.getHistoryForKeyArgsForCall, struct {
|
||||
arg1 string
|
||||
}{arg1})
|
||||
stub := fake.GetHistoryForKeyStub
|
||||
fakeReturns := fake.getHistoryForKeyReturns
|
||||
fake.recordInvocation("GetHistoryForKey", []interface{}{arg1})
|
||||
fake.getHistoryForKeyMutex.Unlock()
|
||||
if fake.GetHistoryForKeyStub != nil {
|
||||
return fake.GetHistoryForKeyStub(arg1)
|
||||
if stub != nil {
|
||||
return stub(arg1)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1, ret.result2
|
||||
}
|
||||
fakeReturns := fake.getHistoryForKeyReturns
|
||||
return fakeReturns.result1, fakeReturns.result2
|
||||
}
|
||||
|
||||
|
|
@ -1142,15 +1153,16 @@ func (fake *ChaincodeStub) GetPrivateData(arg1 string, arg2 string) ([]byte, err
|
|||
arg1 string
|
||||
arg2 string
|
||||
}{arg1, arg2})
|
||||
stub := fake.GetPrivateDataStub
|
||||
fakeReturns := fake.getPrivateDataReturns
|
||||
fake.recordInvocation("GetPrivateData", []interface{}{arg1, arg2})
|
||||
fake.getPrivateDataMutex.Unlock()
|
||||
if fake.GetPrivateDataStub != nil {
|
||||
return fake.GetPrivateDataStub(arg1, arg2)
|
||||
if stub != nil {
|
||||
return stub(arg1, arg2)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1, ret.result2
|
||||
}
|
||||
fakeReturns := fake.getPrivateDataReturns
|
||||
return fakeReturns.result1, fakeReturns.result2
|
||||
}
|
||||
|
||||
|
|
@ -1212,15 +1224,16 @@ func (fake *ChaincodeStub) GetPrivateDataByPartialCompositeKey(arg1 string, arg2
|
|||
arg2 string
|
||||
arg3 []string
|
||||
}{arg1, arg2, arg3Copy})
|
||||
stub := fake.GetPrivateDataByPartialCompositeKeyStub
|
||||
fakeReturns := fake.getPrivateDataByPartialCompositeKeyReturns
|
||||
fake.recordInvocation("GetPrivateDataByPartialCompositeKey", []interface{}{arg1, arg2, arg3Copy})
|
||||
fake.getPrivateDataByPartialCompositeKeyMutex.Unlock()
|
||||
if fake.GetPrivateDataByPartialCompositeKeyStub != nil {
|
||||
return fake.GetPrivateDataByPartialCompositeKeyStub(arg1, arg2, arg3)
|
||||
if stub != nil {
|
||||
return stub(arg1, arg2, arg3)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1, ret.result2
|
||||
}
|
||||
fakeReturns := fake.getPrivateDataByPartialCompositeKeyReturns
|
||||
return fakeReturns.result1, fakeReturns.result2
|
||||
}
|
||||
|
||||
|
|
@ -1277,15 +1290,16 @@ func (fake *ChaincodeStub) GetPrivateDataByRange(arg1 string, arg2 string, arg3
|
|||
arg2 string
|
||||
arg3 string
|
||||
}{arg1, arg2, arg3})
|
||||
stub := fake.GetPrivateDataByRangeStub
|
||||
fakeReturns := fake.getPrivateDataByRangeReturns
|
||||
fake.recordInvocation("GetPrivateDataByRange", []interface{}{arg1, arg2, arg3})
|
||||
fake.getPrivateDataByRangeMutex.Unlock()
|
||||
if fake.GetPrivateDataByRangeStub != nil {
|
||||
return fake.GetPrivateDataByRangeStub(arg1, arg2, arg3)
|
||||
if stub != nil {
|
||||
return stub(arg1, arg2, arg3)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1, ret.result2
|
||||
}
|
||||
fakeReturns := fake.getPrivateDataByRangeReturns
|
||||
return fakeReturns.result1, fakeReturns.result2
|
||||
}
|
||||
|
||||
|
|
@ -1341,15 +1355,16 @@ func (fake *ChaincodeStub) GetPrivateDataHash(arg1 string, arg2 string) ([]byte,
|
|||
arg1 string
|
||||
arg2 string
|
||||
}{arg1, arg2})
|
||||
stub := fake.GetPrivateDataHashStub
|
||||
fakeReturns := fake.getPrivateDataHashReturns
|
||||
fake.recordInvocation("GetPrivateDataHash", []interface{}{arg1, arg2})
|
||||
fake.getPrivateDataHashMutex.Unlock()
|
||||
if fake.GetPrivateDataHashStub != nil {
|
||||
return fake.GetPrivateDataHashStub(arg1, arg2)
|
||||
if stub != nil {
|
||||
return stub(arg1, arg2)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1, ret.result2
|
||||
}
|
||||
fakeReturns := fake.getPrivateDataHashReturns
|
||||
return fakeReturns.result1, fakeReturns.result2
|
||||
}
|
||||
|
||||
|
|
@ -1405,15 +1420,16 @@ func (fake *ChaincodeStub) GetPrivateDataQueryResult(arg1 string, arg2 string) (
|
|||
arg1 string
|
||||
arg2 string
|
||||
}{arg1, arg2})
|
||||
stub := fake.GetPrivateDataQueryResultStub
|
||||
fakeReturns := fake.getPrivateDataQueryResultReturns
|
||||
fake.recordInvocation("GetPrivateDataQueryResult", []interface{}{arg1, arg2})
|
||||
fake.getPrivateDataQueryResultMutex.Unlock()
|
||||
if fake.GetPrivateDataQueryResultStub != nil {
|
||||
return fake.GetPrivateDataQueryResultStub(arg1, arg2)
|
||||
if stub != nil {
|
||||
return stub(arg1, arg2)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1, ret.result2
|
||||
}
|
||||
fakeReturns := fake.getPrivateDataQueryResultReturns
|
||||
return fakeReturns.result1, fakeReturns.result2
|
||||
}
|
||||
|
||||
|
|
@ -1469,15 +1485,16 @@ func (fake *ChaincodeStub) GetPrivateDataValidationParameter(arg1 string, arg2 s
|
|||
arg1 string
|
||||
arg2 string
|
||||
}{arg1, arg2})
|
||||
stub := fake.GetPrivateDataValidationParameterStub
|
||||
fakeReturns := fake.getPrivateDataValidationParameterReturns
|
||||
fake.recordInvocation("GetPrivateDataValidationParameter", []interface{}{arg1, arg2})
|
||||
fake.getPrivateDataValidationParameterMutex.Unlock()
|
||||
if fake.GetPrivateDataValidationParameterStub != nil {
|
||||
return fake.GetPrivateDataValidationParameterStub(arg1, arg2)
|
||||
if stub != nil {
|
||||
return stub(arg1, arg2)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1, ret.result2
|
||||
}
|
||||
fakeReturns := fake.getPrivateDataValidationParameterReturns
|
||||
return fakeReturns.result1, fakeReturns.result2
|
||||
}
|
||||
|
||||
|
|
@ -1532,15 +1549,16 @@ func (fake *ChaincodeStub) GetQueryResult(arg1 string) (shim.StateQueryIteratorI
|
|||
fake.getQueryResultArgsForCall = append(fake.getQueryResultArgsForCall, struct {
|
||||
arg1 string
|
||||
}{arg1})
|
||||
stub := fake.GetQueryResultStub
|
||||
fakeReturns := fake.getQueryResultReturns
|
||||
fake.recordInvocation("GetQueryResult", []interface{}{arg1})
|
||||
fake.getQueryResultMutex.Unlock()
|
||||
if fake.GetQueryResultStub != nil {
|
||||
return fake.GetQueryResultStub(arg1)
|
||||
if stub != nil {
|
||||
return stub(arg1)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1, ret.result2
|
||||
}
|
||||
fakeReturns := fake.getQueryResultReturns
|
||||
return fakeReturns.result1, fakeReturns.result2
|
||||
}
|
||||
|
||||
|
|
@ -1597,15 +1615,16 @@ func (fake *ChaincodeStub) GetQueryResultWithPagination(arg1 string, arg2 int32,
|
|||
arg2 int32
|
||||
arg3 string
|
||||
}{arg1, arg2, arg3})
|
||||
stub := fake.GetQueryResultWithPaginationStub
|
||||
fakeReturns := fake.getQueryResultWithPaginationReturns
|
||||
fake.recordInvocation("GetQueryResultWithPagination", []interface{}{arg1, arg2, arg3})
|
||||
fake.getQueryResultWithPaginationMutex.Unlock()
|
||||
if fake.GetQueryResultWithPaginationStub != nil {
|
||||
return fake.GetQueryResultWithPaginationStub(arg1, arg2, arg3)
|
||||
if stub != nil {
|
||||
return stub(arg1, arg2, arg3)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1, ret.result2, ret.result3
|
||||
}
|
||||
fakeReturns := fake.getQueryResultWithPaginationReturns
|
||||
return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3
|
||||
}
|
||||
|
||||
|
|
@ -1662,15 +1681,16 @@ func (fake *ChaincodeStub) GetSignedProposal() (*peer.SignedProposal, error) {
|
|||
ret, specificReturn := fake.getSignedProposalReturnsOnCall[len(fake.getSignedProposalArgsForCall)]
|
||||
fake.getSignedProposalArgsForCall = append(fake.getSignedProposalArgsForCall, struct {
|
||||
}{})
|
||||
stub := fake.GetSignedProposalStub
|
||||
fakeReturns := fake.getSignedProposalReturns
|
||||
fake.recordInvocation("GetSignedProposal", []interface{}{})
|
||||
fake.getSignedProposalMutex.Unlock()
|
||||
if fake.GetSignedProposalStub != nil {
|
||||
return fake.GetSignedProposalStub()
|
||||
if stub != nil {
|
||||
return stub()
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1, ret.result2
|
||||
}
|
||||
fakeReturns := fake.getSignedProposalReturns
|
||||
return fakeReturns.result1, fakeReturns.result2
|
||||
}
|
||||
|
||||
|
|
@ -1718,15 +1738,16 @@ func (fake *ChaincodeStub) GetState(arg1 string) ([]byte, error) {
|
|||
fake.getStateArgsForCall = append(fake.getStateArgsForCall, struct {
|
||||
arg1 string
|
||||
}{arg1})
|
||||
stub := fake.GetStateStub
|
||||
fakeReturns := fake.getStateReturns
|
||||
fake.recordInvocation("GetState", []interface{}{arg1})
|
||||
fake.getStateMutex.Unlock()
|
||||
if fake.GetStateStub != nil {
|
||||
return fake.GetStateStub(arg1)
|
||||
if stub != nil {
|
||||
return stub(arg1)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1, ret.result2
|
||||
}
|
||||
fakeReturns := fake.getStateReturns
|
||||
return fakeReturns.result1, fakeReturns.result2
|
||||
}
|
||||
|
||||
|
|
@ -1787,15 +1808,16 @@ func (fake *ChaincodeStub) GetStateByPartialCompositeKey(arg1 string, arg2 []str
|
|||
arg1 string
|
||||
arg2 []string
|
||||
}{arg1, arg2Copy})
|
||||
stub := fake.GetStateByPartialCompositeKeyStub
|
||||
fakeReturns := fake.getStateByPartialCompositeKeyReturns
|
||||
fake.recordInvocation("GetStateByPartialCompositeKey", []interface{}{arg1, arg2Copy})
|
||||
fake.getStateByPartialCompositeKeyMutex.Unlock()
|
||||
if fake.GetStateByPartialCompositeKeyStub != nil {
|
||||
return fake.GetStateByPartialCompositeKeyStub(arg1, arg2)
|
||||
if stub != nil {
|
||||
return stub(arg1, arg2)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1, ret.result2
|
||||
}
|
||||
fakeReturns := fake.getStateByPartialCompositeKeyReturns
|
||||
return fakeReturns.result1, fakeReturns.result2
|
||||
}
|
||||
|
||||
|
|
@ -1858,15 +1880,16 @@ func (fake *ChaincodeStub) GetStateByPartialCompositeKeyWithPagination(arg1 stri
|
|||
arg3 int32
|
||||
arg4 string
|
||||
}{arg1, arg2Copy, arg3, arg4})
|
||||
stub := fake.GetStateByPartialCompositeKeyWithPaginationStub
|
||||
fakeReturns := fake.getStateByPartialCompositeKeyWithPaginationReturns
|
||||
fake.recordInvocation("GetStateByPartialCompositeKeyWithPagination", []interface{}{arg1, arg2Copy, arg3, arg4})
|
||||
fake.getStateByPartialCompositeKeyWithPaginationMutex.Unlock()
|
||||
if fake.GetStateByPartialCompositeKeyWithPaginationStub != nil {
|
||||
return fake.GetStateByPartialCompositeKeyWithPaginationStub(arg1, arg2, arg3, arg4)
|
||||
if stub != nil {
|
||||
return stub(arg1, arg2, arg3, arg4)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1, ret.result2, ret.result3
|
||||
}
|
||||
fakeReturns := fake.getStateByPartialCompositeKeyWithPaginationReturns
|
||||
return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3
|
||||
}
|
||||
|
||||
|
|
@ -1925,15 +1948,16 @@ func (fake *ChaincodeStub) GetStateByRange(arg1 string, arg2 string) (shim.State
|
|||
arg1 string
|
||||
arg2 string
|
||||
}{arg1, arg2})
|
||||
stub := fake.GetStateByRangeStub
|
||||
fakeReturns := fake.getStateByRangeReturns
|
||||
fake.recordInvocation("GetStateByRange", []interface{}{arg1, arg2})
|
||||
fake.getStateByRangeMutex.Unlock()
|
||||
if fake.GetStateByRangeStub != nil {
|
||||
return fake.GetStateByRangeStub(arg1, arg2)
|
||||
if stub != nil {
|
||||
return stub(arg1, arg2)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1, ret.result2
|
||||
}
|
||||
fakeReturns := fake.getStateByRangeReturns
|
||||
return fakeReturns.result1, fakeReturns.result2
|
||||
}
|
||||
|
||||
|
|
@ -1991,15 +2015,16 @@ func (fake *ChaincodeStub) GetStateByRangeWithPagination(arg1 string, arg2 strin
|
|||
arg3 int32
|
||||
arg4 string
|
||||
}{arg1, arg2, arg3, arg4})
|
||||
stub := fake.GetStateByRangeWithPaginationStub
|
||||
fakeReturns := fake.getStateByRangeWithPaginationReturns
|
||||
fake.recordInvocation("GetStateByRangeWithPagination", []interface{}{arg1, arg2, arg3, arg4})
|
||||
fake.getStateByRangeWithPaginationMutex.Unlock()
|
||||
if fake.GetStateByRangeWithPaginationStub != nil {
|
||||
return fake.GetStateByRangeWithPaginationStub(arg1, arg2, arg3, arg4)
|
||||
if stub != nil {
|
||||
return stub(arg1, arg2, arg3, arg4)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1, ret.result2, ret.result3
|
||||
}
|
||||
fakeReturns := fake.getStateByRangeWithPaginationReturns
|
||||
return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3
|
||||
}
|
||||
|
||||
|
|
@ -2057,15 +2082,16 @@ func (fake *ChaincodeStub) GetStateValidationParameter(arg1 string) ([]byte, err
|
|||
fake.getStateValidationParameterArgsForCall = append(fake.getStateValidationParameterArgsForCall, struct {
|
||||
arg1 string
|
||||
}{arg1})
|
||||
stub := fake.GetStateValidationParameterStub
|
||||
fakeReturns := fake.getStateValidationParameterReturns
|
||||
fake.recordInvocation("GetStateValidationParameter", []interface{}{arg1})
|
||||
fake.getStateValidationParameterMutex.Unlock()
|
||||
if fake.GetStateValidationParameterStub != nil {
|
||||
return fake.GetStateValidationParameterStub(arg1)
|
||||
if stub != nil {
|
||||
return stub(arg1)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1, ret.result2
|
||||
}
|
||||
fakeReturns := fake.getStateValidationParameterReturns
|
||||
return fakeReturns.result1, fakeReturns.result2
|
||||
}
|
||||
|
||||
|
|
@ -2119,15 +2145,16 @@ func (fake *ChaincodeStub) GetStringArgs() []string {
|
|||
ret, specificReturn := fake.getStringArgsReturnsOnCall[len(fake.getStringArgsArgsForCall)]
|
||||
fake.getStringArgsArgsForCall = append(fake.getStringArgsArgsForCall, struct {
|
||||
}{})
|
||||
stub := fake.GetStringArgsStub
|
||||
fakeReturns := fake.getStringArgsReturns
|
||||
fake.recordInvocation("GetStringArgs", []interface{}{})
|
||||
fake.getStringArgsMutex.Unlock()
|
||||
if fake.GetStringArgsStub != nil {
|
||||
return fake.GetStringArgsStub()
|
||||
if stub != nil {
|
||||
return stub()
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1
|
||||
}
|
||||
fakeReturns := fake.getStringArgsReturns
|
||||
return fakeReturns.result1
|
||||
}
|
||||
|
||||
|
|
@ -2171,15 +2198,16 @@ func (fake *ChaincodeStub) GetTransient() (map[string][]byte, error) {
|
|||
ret, specificReturn := fake.getTransientReturnsOnCall[len(fake.getTransientArgsForCall)]
|
||||
fake.getTransientArgsForCall = append(fake.getTransientArgsForCall, struct {
|
||||
}{})
|
||||
stub := fake.GetTransientStub
|
||||
fakeReturns := fake.getTransientReturns
|
||||
fake.recordInvocation("GetTransient", []interface{}{})
|
||||
fake.getTransientMutex.Unlock()
|
||||
if fake.GetTransientStub != nil {
|
||||
return fake.GetTransientStub()
|
||||
if stub != nil {
|
||||
return stub()
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1, ret.result2
|
||||
}
|
||||
fakeReturns := fake.getTransientReturns
|
||||
return fakeReturns.result1, fakeReturns.result2
|
||||
}
|
||||
|
||||
|
|
@ -2226,15 +2254,16 @@ func (fake *ChaincodeStub) GetTxID() string {
|
|||
ret, specificReturn := fake.getTxIDReturnsOnCall[len(fake.getTxIDArgsForCall)]
|
||||
fake.getTxIDArgsForCall = append(fake.getTxIDArgsForCall, struct {
|
||||
}{})
|
||||
stub := fake.GetTxIDStub
|
||||
fakeReturns := fake.getTxIDReturns
|
||||
fake.recordInvocation("GetTxID", []interface{}{})
|
||||
fake.getTxIDMutex.Unlock()
|
||||
if fake.GetTxIDStub != nil {
|
||||
return fake.GetTxIDStub()
|
||||
if stub != nil {
|
||||
return stub()
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1
|
||||
}
|
||||
fakeReturns := fake.getTxIDReturns
|
||||
return fakeReturns.result1
|
||||
}
|
||||
|
||||
|
|
@ -2278,15 +2307,16 @@ func (fake *ChaincodeStub) GetTxTimestamp() (*timestamppb.Timestamp, error) {
|
|||
ret, specificReturn := fake.getTxTimestampReturnsOnCall[len(fake.getTxTimestampArgsForCall)]
|
||||
fake.getTxTimestampArgsForCall = append(fake.getTxTimestampArgsForCall, struct {
|
||||
}{})
|
||||
stub := fake.GetTxTimestampStub
|
||||
fakeReturns := fake.getTxTimestampReturns
|
||||
fake.recordInvocation("GetTxTimestamp", []interface{}{})
|
||||
fake.getTxTimestampMutex.Unlock()
|
||||
if fake.GetTxTimestampStub != nil {
|
||||
return fake.GetTxTimestampStub()
|
||||
if stub != nil {
|
||||
return stub()
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1, ret.result2
|
||||
}
|
||||
fakeReturns := fake.getTxTimestampReturns
|
||||
return fakeReturns.result1, fakeReturns.result2
|
||||
}
|
||||
|
||||
|
|
@ -2328,7 +2358,7 @@ func (fake *ChaincodeStub) GetTxTimestampReturnsOnCall(i int, result1 *timestamp
|
|||
}{result1, result2}
|
||||
}
|
||||
|
||||
func (fake *ChaincodeStub) InvokeChaincode(arg1 string, arg2 [][]byte, arg3 string) peer.Response {
|
||||
func (fake *ChaincodeStub) InvokeChaincode(arg1 string, arg2 [][]byte, arg3 string) *peer.Response {
|
||||
var arg2Copy [][]byte
|
||||
if arg2 != nil {
|
||||
arg2Copy = make([][]byte, len(arg2))
|
||||
|
|
@ -2341,15 +2371,16 @@ func (fake *ChaincodeStub) InvokeChaincode(arg1 string, arg2 [][]byte, arg3 stri
|
|||
arg2 [][]byte
|
||||
arg3 string
|
||||
}{arg1, arg2Copy, arg3})
|
||||
stub := fake.InvokeChaincodeStub
|
||||
fakeReturns := fake.invokeChaincodeReturns
|
||||
fake.recordInvocation("InvokeChaincode", []interface{}{arg1, arg2Copy, arg3})
|
||||
fake.invokeChaincodeMutex.Unlock()
|
||||
if fake.InvokeChaincodeStub != nil {
|
||||
return fake.InvokeChaincodeStub(arg1, arg2, arg3)
|
||||
if stub != nil {
|
||||
return stub(arg1, arg2, arg3)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1
|
||||
}
|
||||
fakeReturns := fake.invokeChaincodeReturns
|
||||
return fakeReturns.result1
|
||||
}
|
||||
|
||||
|
|
@ -2359,7 +2390,7 @@ func (fake *ChaincodeStub) InvokeChaincodeCallCount() int {
|
|||
return len(fake.invokeChaincodeArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *ChaincodeStub) InvokeChaincodeCalls(stub func(string, [][]byte, string) peer.Response) {
|
||||
func (fake *ChaincodeStub) InvokeChaincodeCalls(stub func(string, [][]byte, string) *peer.Response) {
|
||||
fake.invokeChaincodeMutex.Lock()
|
||||
defer fake.invokeChaincodeMutex.Unlock()
|
||||
fake.InvokeChaincodeStub = stub
|
||||
|
|
@ -2372,26 +2403,26 @@ func (fake *ChaincodeStub) InvokeChaincodeArgsForCall(i int) (string, [][]byte,
|
|||
return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3
|
||||
}
|
||||
|
||||
func (fake *ChaincodeStub) InvokeChaincodeReturns(result1 peer.Response) {
|
||||
func (fake *ChaincodeStub) InvokeChaincodeReturns(result1 *peer.Response) {
|
||||
fake.invokeChaincodeMutex.Lock()
|
||||
defer fake.invokeChaincodeMutex.Unlock()
|
||||
fake.InvokeChaincodeStub = nil
|
||||
fake.invokeChaincodeReturns = struct {
|
||||
result1 peer.Response
|
||||
result1 *peer.Response
|
||||
}{result1}
|
||||
}
|
||||
|
||||
func (fake *ChaincodeStub) InvokeChaincodeReturnsOnCall(i int, result1 peer.Response) {
|
||||
func (fake *ChaincodeStub) InvokeChaincodeReturnsOnCall(i int, result1 *peer.Response) {
|
||||
fake.invokeChaincodeMutex.Lock()
|
||||
defer fake.invokeChaincodeMutex.Unlock()
|
||||
fake.InvokeChaincodeStub = nil
|
||||
if fake.invokeChaincodeReturnsOnCall == nil {
|
||||
fake.invokeChaincodeReturnsOnCall = make(map[int]struct {
|
||||
result1 peer.Response
|
||||
result1 *peer.Response
|
||||
})
|
||||
}
|
||||
fake.invokeChaincodeReturnsOnCall[i] = struct {
|
||||
result1 peer.Response
|
||||
result1 *peer.Response
|
||||
}{result1}
|
||||
}
|
||||
|
||||
|
|
@ -2402,15 +2433,16 @@ func (fake *ChaincodeStub) PurgePrivateData(arg1 string, arg2 string) error {
|
|||
arg1 string
|
||||
arg2 string
|
||||
}{arg1, arg2})
|
||||
stub := fake.PurgePrivateDataStub
|
||||
fakeReturns := fake.purgePrivateDataReturns
|
||||
fake.recordInvocation("PurgePrivateData", []interface{}{arg1, arg2})
|
||||
fake.purgePrivateDataMutex.Unlock()
|
||||
if fake.PurgePrivateDataStub != nil {
|
||||
return fake.PurgePrivateDataStub(arg1, arg2)
|
||||
if stub != nil {
|
||||
return stub(arg1, arg2)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1
|
||||
}
|
||||
fakeReturns := fake.purgePrivateDataReturns
|
||||
return fakeReturns.result1
|
||||
}
|
||||
|
||||
|
|
@ -2469,15 +2501,16 @@ func (fake *ChaincodeStub) PutPrivateData(arg1 string, arg2 string, arg3 []byte)
|
|||
arg2 string
|
||||
arg3 []byte
|
||||
}{arg1, arg2, arg3Copy})
|
||||
stub := fake.PutPrivateDataStub
|
||||
fakeReturns := fake.putPrivateDataReturns
|
||||
fake.recordInvocation("PutPrivateData", []interface{}{arg1, arg2, arg3Copy})
|
||||
fake.putPrivateDataMutex.Unlock()
|
||||
if fake.PutPrivateDataStub != nil {
|
||||
return fake.PutPrivateDataStub(arg1, arg2, arg3)
|
||||
if stub != nil {
|
||||
return stub(arg1, arg2, arg3)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1
|
||||
}
|
||||
fakeReturns := fake.putPrivateDataReturns
|
||||
return fakeReturns.result1
|
||||
}
|
||||
|
||||
|
|
@ -2535,15 +2568,16 @@ func (fake *ChaincodeStub) PutState(arg1 string, arg2 []byte) error {
|
|||
arg1 string
|
||||
arg2 []byte
|
||||
}{arg1, arg2Copy})
|
||||
stub := fake.PutStateStub
|
||||
fakeReturns := fake.putStateReturns
|
||||
fake.recordInvocation("PutState", []interface{}{arg1, arg2Copy})
|
||||
fake.putStateMutex.Unlock()
|
||||
if fake.PutStateStub != nil {
|
||||
return fake.PutStateStub(arg1, arg2)
|
||||
if stub != nil {
|
||||
return stub(arg1, arg2)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1
|
||||
}
|
||||
fakeReturns := fake.putStateReturns
|
||||
return fakeReturns.result1
|
||||
}
|
||||
|
||||
|
|
@ -2601,15 +2635,16 @@ func (fake *ChaincodeStub) SetEvent(arg1 string, arg2 []byte) error {
|
|||
arg1 string
|
||||
arg2 []byte
|
||||
}{arg1, arg2Copy})
|
||||
stub := fake.SetEventStub
|
||||
fakeReturns := fake.setEventReturns
|
||||
fake.recordInvocation("SetEvent", []interface{}{arg1, arg2Copy})
|
||||
fake.setEventMutex.Unlock()
|
||||
if fake.SetEventStub != nil {
|
||||
return fake.SetEventStub(arg1, arg2)
|
||||
if stub != nil {
|
||||
return stub(arg1, arg2)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1
|
||||
}
|
||||
fakeReturns := fake.setEventReturns
|
||||
return fakeReturns.result1
|
||||
}
|
||||
|
||||
|
|
@ -2668,15 +2703,16 @@ func (fake *ChaincodeStub) SetPrivateDataValidationParameter(arg1 string, arg2 s
|
|||
arg2 string
|
||||
arg3 []byte
|
||||
}{arg1, arg2, arg3Copy})
|
||||
stub := fake.SetPrivateDataValidationParameterStub
|
||||
fakeReturns := fake.setPrivateDataValidationParameterReturns
|
||||
fake.recordInvocation("SetPrivateDataValidationParameter", []interface{}{arg1, arg2, arg3Copy})
|
||||
fake.setPrivateDataValidationParameterMutex.Unlock()
|
||||
if fake.SetPrivateDataValidationParameterStub != nil {
|
||||
return fake.SetPrivateDataValidationParameterStub(arg1, arg2, arg3)
|
||||
if stub != nil {
|
||||
return stub(arg1, arg2, arg3)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1
|
||||
}
|
||||
fakeReturns := fake.setPrivateDataValidationParameterReturns
|
||||
return fakeReturns.result1
|
||||
}
|
||||
|
||||
|
|
@ -2734,15 +2770,16 @@ func (fake *ChaincodeStub) SetStateValidationParameter(arg1 string, arg2 []byte)
|
|||
arg1 string
|
||||
arg2 []byte
|
||||
}{arg1, arg2Copy})
|
||||
stub := fake.SetStateValidationParameterStub
|
||||
fakeReturns := fake.setStateValidationParameterReturns
|
||||
fake.recordInvocation("SetStateValidationParameter", []interface{}{arg1, arg2Copy})
|
||||
fake.setStateValidationParameterMutex.Unlock()
|
||||
if fake.SetStateValidationParameterStub != nil {
|
||||
return fake.SetStateValidationParameterStub(arg1, arg2)
|
||||
if stub != nil {
|
||||
return stub(arg1, arg2)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1
|
||||
}
|
||||
fakeReturns := fake.setStateValidationParameterReturns
|
||||
return fakeReturns.result1
|
||||
}
|
||||
|
||||
|
|
@ -2794,15 +2831,16 @@ func (fake *ChaincodeStub) SplitCompositeKey(arg1 string) (string, []string, err
|
|||
fake.splitCompositeKeyArgsForCall = append(fake.splitCompositeKeyArgsForCall, struct {
|
||||
arg1 string
|
||||
}{arg1})
|
||||
stub := fake.SplitCompositeKeyStub
|
||||
fakeReturns := fake.splitCompositeKeyReturns
|
||||
fake.recordInvocation("SplitCompositeKey", []interface{}{arg1})
|
||||
fake.splitCompositeKeyMutex.Unlock()
|
||||
if fake.SplitCompositeKeyStub != nil {
|
||||
return fake.SplitCompositeKeyStub(arg1)
|
||||
if stub != nil {
|
||||
return stub(arg1)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1, ret.result2, ret.result3
|
||||
}
|
||||
fakeReturns := fake.splitCompositeKeyReturns
|
||||
return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ package mocks
|
|||
import (
|
||||
"sync"
|
||||
|
||||
"github.com/hyperledger/fabric-protos-go/ledger/queryresult"
|
||||
"github.com/hyperledger/fabric-protos-go-apiv2/ledger/queryresult"
|
||||
)
|
||||
|
||||
type StateQueryIterator struct {
|
||||
|
|
@ -49,15 +49,16 @@ func (fake *StateQueryIterator) Close() error {
|
|||
ret, specificReturn := fake.closeReturnsOnCall[len(fake.closeArgsForCall)]
|
||||
fake.closeArgsForCall = append(fake.closeArgsForCall, struct {
|
||||
}{})
|
||||
stub := fake.CloseStub
|
||||
fakeReturns := fake.closeReturns
|
||||
fake.recordInvocation("Close", []interface{}{})
|
||||
fake.closeMutex.Unlock()
|
||||
if fake.CloseStub != nil {
|
||||
return fake.CloseStub()
|
||||
if stub != nil {
|
||||
return stub()
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1
|
||||
}
|
||||
fakeReturns := fake.closeReturns
|
||||
return fakeReturns.result1
|
||||
}
|
||||
|
||||
|
|
@ -101,15 +102,16 @@ func (fake *StateQueryIterator) HasNext() bool {
|
|||
ret, specificReturn := fake.hasNextReturnsOnCall[len(fake.hasNextArgsForCall)]
|
||||
fake.hasNextArgsForCall = append(fake.hasNextArgsForCall, struct {
|
||||
}{})
|
||||
stub := fake.HasNextStub
|
||||
fakeReturns := fake.hasNextReturns
|
||||
fake.recordInvocation("HasNext", []interface{}{})
|
||||
fake.hasNextMutex.Unlock()
|
||||
if fake.HasNextStub != nil {
|
||||
return fake.HasNextStub()
|
||||
if stub != nil {
|
||||
return stub()
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1
|
||||
}
|
||||
fakeReturns := fake.hasNextReturns
|
||||
return fakeReturns.result1
|
||||
}
|
||||
|
||||
|
|
@ -153,15 +155,16 @@ func (fake *StateQueryIterator) Next() (*queryresult.KV, error) {
|
|||
ret, specificReturn := fake.nextReturnsOnCall[len(fake.nextArgsForCall)]
|
||||
fake.nextArgsForCall = append(fake.nextArgsForCall, struct {
|
||||
}{})
|
||||
stub := fake.NextStub
|
||||
fakeReturns := fake.nextReturns
|
||||
fake.recordInvocation("Next", []interface{}{})
|
||||
fake.nextMutex.Unlock()
|
||||
if fake.NextStub != nil {
|
||||
return fake.NextStub()
|
||||
if stub != nil {
|
||||
return stub()
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1, ret.result2
|
||||
}
|
||||
fakeReturns := fake.nextReturns
|
||||
return fakeReturns.result1, fakeReturns.result2
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ package mocks
|
|||
import (
|
||||
"sync"
|
||||
|
||||
"github.com/hyperledger/fabric-chaincode-go/pkg/cid"
|
||||
"github.com/hyperledger/fabric-chaincode-go/shim"
|
||||
"github.com/hyperledger/fabric-chaincode-go/v2/pkg/cid"
|
||||
"github.com/hyperledger/fabric-chaincode-go/v2/shim"
|
||||
)
|
||||
|
||||
type TransactionContext struct {
|
||||
|
|
@ -38,15 +38,16 @@ func (fake *TransactionContext) GetClientIdentity() cid.ClientIdentity {
|
|||
ret, specificReturn := fake.getClientIdentityReturnsOnCall[len(fake.getClientIdentityArgsForCall)]
|
||||
fake.getClientIdentityArgsForCall = append(fake.getClientIdentityArgsForCall, struct {
|
||||
}{})
|
||||
stub := fake.GetClientIdentityStub
|
||||
fakeReturns := fake.getClientIdentityReturns
|
||||
fake.recordInvocation("GetClientIdentity", []interface{}{})
|
||||
fake.getClientIdentityMutex.Unlock()
|
||||
if fake.GetClientIdentityStub != nil {
|
||||
return fake.GetClientIdentityStub()
|
||||
if stub != nil {
|
||||
return stub()
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1
|
||||
}
|
||||
fakeReturns := fake.getClientIdentityReturns
|
||||
return fakeReturns.result1
|
||||
}
|
||||
|
||||
|
|
@ -90,15 +91,16 @@ func (fake *TransactionContext) GetStub() shim.ChaincodeStubInterface {
|
|||
ret, specificReturn := fake.getStubReturnsOnCall[len(fake.getStubArgsForCall)]
|
||||
fake.getStubArgsForCall = append(fake.getStubArgsForCall, struct {
|
||||
}{})
|
||||
stub := fake.GetStubStub
|
||||
fakeReturns := fake.getStubReturns
|
||||
fake.recordInvocation("GetStub", []interface{}{})
|
||||
fake.getStubMutex.Unlock()
|
||||
if fake.GetStubStub != nil {
|
||||
return fake.GetStubStub()
|
||||
if stub != nil {
|
||||
return stub()
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1
|
||||
}
|
||||
fakeReturns := fake.getStubReturns
|
||||
return fakeReturns.result1
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import (
|
|||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
"github.com/hyperledger/fabric-contract-api-go/contractapi"
|
||||
"github.com/hyperledger/fabric-contract-api-go/v2/contractapi"
|
||||
)
|
||||
|
||||
// SmartContract provides functions for managing an Asset
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@ import (
|
|||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/hyperledger/fabric-chaincode-go/shim"
|
||||
"github.com/hyperledger/fabric-contract-api-go/contractapi"
|
||||
"github.com/hyperledger/fabric-protos-go/ledger/queryresult"
|
||||
"github.com/hyperledger/fabric-chaincode-go/v2/shim"
|
||||
"github.com/hyperledger/fabric-contract-api-go/v2/contractapi"
|
||||
"github.com/hyperledger/fabric-protos-go-apiv2/ledger/queryresult"
|
||||
"github.com/hyperledger/fabric-samples/asset-transfer-basic/chaincode-go/chaincode"
|
||||
"github.com/hyperledger/fabric-samples/asset-transfer-basic/chaincode-go/chaincode/mocks"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
|
|
|||
|
|
@ -1,38 +1,39 @@
|
|||
module github.com/hyperledger/fabric-samples/asset-transfer-basic/chaincode-go
|
||||
|
||||
go 1.17
|
||||
go 1.21
|
||||
|
||||
toolchain go1.22.4
|
||||
|
||||
require (
|
||||
github.com/hyperledger/fabric-chaincode-go v0.0.0-20230228194215-b84622ba6a7a
|
||||
github.com/hyperledger/fabric-contract-api-go v1.2.1
|
||||
github.com/hyperledger/fabric-protos-go v0.3.0
|
||||
github.com/stretchr/testify v1.8.2
|
||||
google.golang.org/protobuf v1.28.1
|
||||
github.com/hyperledger/fabric-chaincode-go/v2 v2.0.0-20240618210511-f7903324a8af
|
||||
github.com/hyperledger/fabric-contract-api-go/v2 v2.0.0
|
||||
github.com/hyperledger/fabric-protos-go-apiv2 v0.3.3
|
||||
github.com/stretchr/testify v1.9.0
|
||||
google.golang.org/protobuf v1.34.2
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/go-openapi/jsonpointer v0.19.5 // indirect
|
||||
github.com/go-openapi/jsonreference v0.20.0 // indirect
|
||||
github.com/go-openapi/spec v0.20.8 // indirect
|
||||
github.com/go-openapi/swag v0.21.1 // indirect
|
||||
github.com/gobuffalo/envy v1.10.1 // indirect
|
||||
github.com/gobuffalo/packd v1.0.1 // indirect
|
||||
github.com/go-openapi/jsonpointer v0.21.0 // indirect
|
||||
github.com/go-openapi/jsonreference v0.21.0 // indirect
|
||||
github.com/go-openapi/spec v0.21.0 // indirect
|
||||
github.com/go-openapi/swag v0.23.0 // indirect
|
||||
github.com/gobuffalo/envy v1.10.2 // indirect
|
||||
github.com/gobuffalo/packd v1.0.2 // indirect
|
||||
github.com/gobuffalo/packr v1.30.1 // indirect
|
||||
github.com/golang/protobuf v1.5.2 // indirect
|
||||
github.com/joho/godotenv v1.4.0 // indirect
|
||||
github.com/joho/godotenv v1.5.1 // indirect
|
||||
github.com/josharian/intern v1.0.0 // indirect
|
||||
github.com/mailru/easyjson v0.7.7 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
github.com/rogpeppe/go-internal v1.8.1 // indirect
|
||||
github.com/rogpeppe/go-internal v1.12.0 // indirect
|
||||
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
|
||||
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
|
||||
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
|
||||
golang.org/x/net v0.7.0 // indirect
|
||||
golang.org/x/sys v0.5.0 // indirect
|
||||
golang.org/x/text v0.7.0 // indirect
|
||||
google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect
|
||||
google.golang.org/grpc v1.53.0 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
golang.org/x/mod v0.17.0 // indirect
|
||||
golang.org/x/net v0.24.0 // indirect
|
||||
golang.org/x/sys v0.19.0 // indirect
|
||||
golang.org/x/text v0.14.0 // indirect
|
||||
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect
|
||||
google.golang.org/grpc v1.64.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -7,7 +7,7 @@ package main
|
|||
import (
|
||||
"log"
|
||||
|
||||
"github.com/hyperledger/fabric-contract-api-go/contractapi"
|
||||
"github.com/hyperledger/fabric-contract-api-go/v2/contractapi"
|
||||
"github.com/hyperledger/fabric-samples/asset-transfer-events/chaincode-go/chaincode"
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import (
|
|||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
"github.com/hyperledger/fabric-contract-api-go/contractapi"
|
||||
"github.com/hyperledger/fabric-contract-api-go/v2/contractapi"
|
||||
)
|
||||
|
||||
// SmartContract provides functions for managing an Asset
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
module github.com/hyperledger/fabric-samples/asset-transfer-events/chaincode-go
|
||||
|
||||
go 1.19
|
||||
go 1.21
|
||||
|
||||
require github.com/hyperledger/fabric-contract-api-go v1.2.2
|
||||
require github.com/hyperledger/fabric-contract-api-go/v2 v2.0.0
|
||||
|
||||
require (
|
||||
github.com/go-openapi/jsonpointer v0.21.0 // indirect
|
||||
|
|
@ -12,9 +12,8 @@ require (
|
|||
github.com/gobuffalo/envy v1.10.2 // indirect
|
||||
github.com/gobuffalo/packd v1.0.2 // indirect
|
||||
github.com/gobuffalo/packr v1.30.1 // indirect
|
||||
github.com/golang/protobuf v1.5.4 // indirect
|
||||
github.com/hyperledger/fabric-chaincode-go v0.0.0-20240124143825-7dec3c7e7d45 // indirect
|
||||
github.com/hyperledger/fabric-protos-go v0.3.3 // indirect
|
||||
github.com/hyperledger/fabric-chaincode-go/v2 v2.0.0-20240618210511-f7903324a8af // indirect
|
||||
github.com/hyperledger/fabric-protos-go-apiv2 v0.3.3 // indirect
|
||||
github.com/joho/godotenv v1.5.1 // indirect
|
||||
github.com/josharian/intern v1.0.0 // indirect
|
||||
github.com/mailru/easyjson v0.7.7 // indirect
|
||||
|
|
@ -22,12 +21,12 @@ require (
|
|||
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
|
||||
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
|
||||
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
|
||||
golang.org/x/mod v0.16.0 // indirect
|
||||
golang.org/x/net v0.22.0 // indirect
|
||||
golang.org/x/sys v0.18.0 // indirect
|
||||
golang.org/x/mod v0.17.0 // indirect
|
||||
golang.org/x/net v0.24.0 // indirect
|
||||
golang.org/x/sys v0.19.0 // indirect
|
||||
golang.org/x/text v0.14.0 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda // indirect
|
||||
google.golang.org/grpc v1.62.1 // indirect
|
||||
google.golang.org/protobuf v1.33.0 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157 // indirect
|
||||
google.golang.org/grpc v1.64.0 // indirect
|
||||
google.golang.org/protobuf v1.34.2 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
|
|
|||
|
|
@ -26,16 +26,15 @@ github.com/gobuffalo/packd v1.0.2/go.mod h1:sUc61tDqGMXON80zpKGp92lDb86Km28jfvX7
|
|||
github.com/gobuffalo/packr v1.30.1 h1:hu1fuVR3fXEZR7rXNW3h8rqSML8EVAf6KNm0NKO/wKg=
|
||||
github.com/gobuffalo/packr v1.30.1/go.mod h1:ljMyFO2EcrnzsHsN99cvbq055Y9OhRrIaviy289eRuk=
|
||||
github.com/gobuffalo/packr/v2 v2.5.1/go.mod h1:8f9c96ITobJlPzI44jj+4tHnEKNt0xXWSVlXRN9X1Iw=
|
||||
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
|
||||
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
|
||||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
||||
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
|
||||
github.com/hyperledger/fabric-chaincode-go v0.0.0-20240124143825-7dec3c7e7d45 h1:tZeJCTwbAE3cwi6XId+dYd/gTtfTKzZ3uEb1ksvQf7I=
|
||||
github.com/hyperledger/fabric-chaincode-go v0.0.0-20240124143825-7dec3c7e7d45/go.mod h1:YZBt6/ZlJCzyPoWecbfFp34G+ZIYKodTQA46c0sxHIk=
|
||||
github.com/hyperledger/fabric-contract-api-go v1.2.2 h1:zun9/BmaIWFSSOkfQXikdepK0XDb7MkJfc/lb5j3ku8=
|
||||
github.com/hyperledger/fabric-contract-api-go v1.2.2/go.mod h1:UnFLlRFn8GvXE7mXxWtU+bESM7fb5YzsKo1DA16vvaE=
|
||||
github.com/hyperledger/fabric-protos-go v0.3.3 h1:0nssqz8QWJNVNBVQz+IIfAd2j1ku7QPKFSM/1anKizI=
|
||||
github.com/hyperledger/fabric-protos-go v0.3.3/go.mod h1:BPXse9gIOQwyAePQrwQVUcc44bTW4bB5V3tujuvyArk=
|
||||
github.com/hyperledger/fabric-chaincode-go/v2 v2.0.0-20240618210511-f7903324a8af h1:WT4NjX7Uk03GSeH++jF3a0wp4FhybTM86zDPCETvmSk=
|
||||
github.com/hyperledger/fabric-chaincode-go/v2 v2.0.0-20240618210511-f7903324a8af/go.mod h1:f/ER25FaBepxJugwpLhbD2hLAoZaZEVqkBjOcHjw72Y=
|
||||
github.com/hyperledger/fabric-contract-api-go/v2 v2.0.0 h1:IDiCGVOBlRd6zpL0Y+f6V7IpBqa4/Z5JAK9SF7a5ea8=
|
||||
github.com/hyperledger/fabric-contract-api-go/v2 v2.0.0/go.mod h1:pdqhe7ALf4lmXgQdprCyNWYdnCPxgj02Vhf8JF5w8po=
|
||||
github.com/hyperledger/fabric-protos-go-apiv2 v0.3.3 h1:Xpd6fzG/KjAOHJsq7EQXY2l+qi/y8muxBaY7R6QWABk=
|
||||
github.com/hyperledger/fabric-protos-go-apiv2 v0.3.3/go.mod h1:2pq0ui6ZWA0cC8J+eCErgnMDCS1kPOEYVY+06ZAK0qE=
|
||||
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
|
||||
github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
|
||||
github.com/joho/godotenv v1.4.0/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
|
||||
|
|
@ -48,9 +47,11 @@ github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxv
|
|||
github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
||||
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
|
||||
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
|
||||
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
|
||||
|
|
@ -76,11 +77,14 @@ github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DM
|
|||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||
github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=
|
||||
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
|
||||
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||
github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0=
|
||||
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=
|
||||
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb h1:zGWFAtiMcyryUHoUjUJX0/lt1H2+i2Ka2n+D3DImSNo=
|
||||
|
|
@ -93,33 +97,34 @@ github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:
|
|||
golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20190621222207-cc06ce4a13d4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/mod v0.16.0 h1:QX4fJ0Rr5cPQCF7O9lh9Se4pmwfwskqZfq5moyldzic=
|
||||
golang.org/x/mod v0.16.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
|
||||
golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA=
|
||||
golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
|
||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc=
|
||||
golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
|
||||
golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w=
|
||||
golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190515120540-06a5c4944438/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
|
||||
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o=
|
||||
golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
|
||||
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||
golang.org/x/tools v0.0.0-20190624180213-70d37148ca0c/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda h1:LI5DOvAxUPMv/50agcLLoo+AdWc1irS9Rzz4vPuD1V4=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda/go.mod h1:WtryC6hu0hhx87FDGxWCDptyssuo68sk10vYjF+T9fY=
|
||||
google.golang.org/grpc v1.62.1 h1:B4n+nfKzOICUXMgyrNd19h/I9oH0L1pizfk1d4zSgTk=
|
||||
google.golang.org/grpc v1.62.1/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE=
|
||||
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
|
||||
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157 h1:Zy9XzmMEflZ/MAaA7vNcoebnRAld7FsPW1EeBB7V0m8=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0=
|
||||
google.golang.org/grpc v1.64.0 h1:KH3VH9y/MgNQg1dE7b3XfVK0GsPSIzJwdF617gUSbvY=
|
||||
google.golang.org/grpc v1.64.0/go.mod h1:oxjF8E3FBnjp+/gVFYdWacaLDx9na1aqy9oovLpxQYg=
|
||||
google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg=
|
||||
google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
||||
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
|
||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
|
|
|
|||
|
|
@ -75,9 +75,8 @@ import (
|
|||
"log"
|
||||
"time"
|
||||
|
||||
"github.com/golang/protobuf/ptypes"
|
||||
"github.com/hyperledger/fabric-chaincode-go/shim"
|
||||
"github.com/hyperledger/fabric-contract-api-go/contractapi"
|
||||
"github.com/hyperledger/fabric-chaincode-go/v2/shim"
|
||||
"github.com/hyperledger/fabric-contract-api-go/v2/contractapi"
|
||||
)
|
||||
|
||||
const index = "color~name"
|
||||
|
|
@ -415,14 +414,9 @@ func (t *SimpleChaincode) GetAssetHistory(ctx contractapi.TransactionContextInte
|
|||
}
|
||||
}
|
||||
|
||||
timestamp, err := ptypes.Timestamp(response.Timestamp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
record := HistoryQueryResult{
|
||||
TxId: response.TxId,
|
||||
Timestamp: timestamp,
|
||||
Timestamp: response.Timestamp.AsTime(),
|
||||
Record: &asset,
|
||||
IsDelete: response.IsDelete,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,34 +1,34 @@
|
|||
module github.com/hyperledger/fabric-samples/asset-transfer-ledger-queries/chaincode-go
|
||||
|
||||
go 1.17
|
||||
go 1.21
|
||||
|
||||
require (
|
||||
github.com/golang/protobuf v1.5.2
|
||||
github.com/hyperledger/fabric-chaincode-go v0.0.0-20230228194215-b84622ba6a7a
|
||||
github.com/hyperledger/fabric-contract-api-go v1.2.1
|
||||
github.com/hyperledger/fabric-chaincode-go/v2 v2.0.0-20240618210511-f7903324a8af
|
||||
github.com/hyperledger/fabric-contract-api-go/v2 v2.0.0
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/go-openapi/jsonpointer v0.19.5 // indirect
|
||||
github.com/go-openapi/jsonreference v0.20.0 // indirect
|
||||
github.com/go-openapi/spec v0.20.8 // indirect
|
||||
github.com/go-openapi/swag v0.21.1 // indirect
|
||||
github.com/gobuffalo/envy v1.10.1 // indirect
|
||||
github.com/gobuffalo/packd v1.0.1 // indirect
|
||||
github.com/go-openapi/jsonpointer v0.21.0 // indirect
|
||||
github.com/go-openapi/jsonreference v0.21.0 // indirect
|
||||
github.com/go-openapi/spec v0.21.0 // indirect
|
||||
github.com/go-openapi/swag v0.23.0 // indirect
|
||||
github.com/gobuffalo/envy v1.10.2 // indirect
|
||||
github.com/gobuffalo/packd v1.0.2 // indirect
|
||||
github.com/gobuffalo/packr v1.30.1 // indirect
|
||||
github.com/hyperledger/fabric-protos-go v0.3.0 // indirect
|
||||
github.com/joho/godotenv v1.4.0 // indirect
|
||||
github.com/hyperledger/fabric-protos-go-apiv2 v0.3.3 // indirect
|
||||
github.com/joho/godotenv v1.5.1 // indirect
|
||||
github.com/josharian/intern v1.0.0 // indirect
|
||||
github.com/mailru/easyjson v0.7.7 // indirect
|
||||
github.com/rogpeppe/go-internal v1.8.1 // indirect
|
||||
github.com/rogpeppe/go-internal v1.12.0 // indirect
|
||||
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
|
||||
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
|
||||
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
|
||||
golang.org/x/net v0.7.0 // indirect
|
||||
golang.org/x/sys v0.5.0 // indirect
|
||||
golang.org/x/text v0.7.0 // indirect
|
||||
golang.org/x/mod v0.17.0 // indirect
|
||||
golang.org/x/net v0.24.0 // indirect
|
||||
golang.org/x/sys v0.19.0 // indirect
|
||||
golang.org/x/text v0.14.0 // indirect
|
||||
google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect
|
||||
google.golang.org/grpc v1.53.0 // indirect
|
||||
google.golang.org/protobuf v1.28.1 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
google.golang.org/grpc v1.64.0 // indirect
|
||||
google.golang.org/protobuf v1.34.2 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -11,7 +11,7 @@ import (
|
|||
"fmt"
|
||||
"log"
|
||||
|
||||
"github.com/hyperledger/fabric-contract-api-go/contractapi"
|
||||
"github.com/hyperledger/fabric-contract-api-go/v2/contractapi"
|
||||
)
|
||||
|
||||
// ReadAsset reads the information from collection
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import (
|
|||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/hyperledger/fabric-protos-go/ledger/queryresult"
|
||||
"github.com/hyperledger/fabric-protos-go-apiv2/ledger/queryresult"
|
||||
|
||||
"github.com/hyperledger/fabric-samples/asset-transfer-private-data/chaincode-go/chaincode"
|
||||
"github.com/hyperledger/fabric-samples/asset-transfer-private-data/chaincode-go/chaincode/mocks"
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@ import (
|
|||
"fmt"
|
||||
"log"
|
||||
|
||||
"github.com/hyperledger/fabric-chaincode-go/shim"
|
||||
"github.com/hyperledger/fabric-contract-api-go/contractapi"
|
||||
"github.com/hyperledger/fabric-chaincode-go/v2/shim"
|
||||
"github.com/hyperledger/fabric-contract-api-go/v2/contractapi"
|
||||
)
|
||||
|
||||
const assetCollection = "assetCollection"
|
||||
|
|
|
|||
|
|
@ -6,14 +6,14 @@ SPDX-License-Identifier: Apache-2.0
|
|||
package chaincode_test
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"os"
|
||||
"testing"
|
||||
"encoding/base64"
|
||||
|
||||
"github.com/hyperledger/fabric-chaincode-go/pkg/cid"
|
||||
"github.com/hyperledger/fabric-chaincode-go/shim"
|
||||
"github.com/hyperledger/fabric-contract-api-go/contractapi"
|
||||
"github.com/hyperledger/fabric-chaincode-go/v2/pkg/cid"
|
||||
"github.com/hyperledger/fabric-chaincode-go/v2/shim"
|
||||
"github.com/hyperledger/fabric-contract-api-go/v2/contractapi"
|
||||
|
||||
"github.com/hyperledger/fabric-samples/asset-transfer-private-data/chaincode-go/chaincode"
|
||||
"github.com/hyperledger/fabric-samples/asset-transfer-private-data/chaincode-go/chaincode/mocks"
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ package mocks
|
|||
import (
|
||||
"sync"
|
||||
|
||||
"github.com/hyperledger/fabric-chaincode-go/shim"
|
||||
"github.com/hyperledger/fabric-protos-go/peer"
|
||||
"github.com/hyperledger/fabric-chaincode-go/v2/shim"
|
||||
"github.com/hyperledger/fabric-protos-go-apiv2/peer"
|
||||
"google.golang.org/protobuf/types/known/timestamppb"
|
||||
)
|
||||
|
||||
|
|
@ -400,7 +400,7 @@ type ChaincodeStub struct {
|
|||
result1 *timestamppb.Timestamp
|
||||
result2 error
|
||||
}
|
||||
InvokeChaincodeStub func(string, [][]byte, string) peer.Response
|
||||
InvokeChaincodeStub func(string, [][]byte, string) *peer.Response
|
||||
invokeChaincodeMutex sync.RWMutex
|
||||
invokeChaincodeArgsForCall []struct {
|
||||
arg1 string
|
||||
|
|
@ -408,10 +408,10 @@ type ChaincodeStub struct {
|
|||
arg3 string
|
||||
}
|
||||
invokeChaincodeReturns struct {
|
||||
result1 peer.Response
|
||||
result1 *peer.Response
|
||||
}
|
||||
invokeChaincodeReturnsOnCall map[int]struct {
|
||||
result1 peer.Response
|
||||
result1 *peer.Response
|
||||
}
|
||||
PurgePrivateDataStub func(string, string) error
|
||||
purgePrivateDataMutex sync.RWMutex
|
||||
|
|
@ -518,15 +518,16 @@ func (fake *ChaincodeStub) CreateCompositeKey(arg1 string, arg2 []string) (strin
|
|||
arg1 string
|
||||
arg2 []string
|
||||
}{arg1, arg2Copy})
|
||||
stub := fake.CreateCompositeKeyStub
|
||||
fakeReturns := fake.createCompositeKeyReturns
|
||||
fake.recordInvocation("CreateCompositeKey", []interface{}{arg1, arg2Copy})
|
||||
fake.createCompositeKeyMutex.Unlock()
|
||||
if fake.CreateCompositeKeyStub != nil {
|
||||
return fake.CreateCompositeKeyStub(arg1, arg2)
|
||||
if stub != nil {
|
||||
return stub(arg1, arg2)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1, ret.result2
|
||||
}
|
||||
fakeReturns := fake.createCompositeKeyReturns
|
||||
return fakeReturns.result1, fakeReturns.result2
|
||||
}
|
||||
|
||||
|
|
@ -582,15 +583,16 @@ func (fake *ChaincodeStub) DelPrivateData(arg1 string, arg2 string) error {
|
|||
arg1 string
|
||||
arg2 string
|
||||
}{arg1, arg2})
|
||||
stub := fake.DelPrivateDataStub
|
||||
fakeReturns := fake.delPrivateDataReturns
|
||||
fake.recordInvocation("DelPrivateData", []interface{}{arg1, arg2})
|
||||
fake.delPrivateDataMutex.Unlock()
|
||||
if fake.DelPrivateDataStub != nil {
|
||||
return fake.DelPrivateDataStub(arg1, arg2)
|
||||
if stub != nil {
|
||||
return stub(arg1, arg2)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1
|
||||
}
|
||||
fakeReturns := fake.delPrivateDataReturns
|
||||
return fakeReturns.result1
|
||||
}
|
||||
|
||||
|
|
@ -642,15 +644,16 @@ func (fake *ChaincodeStub) DelState(arg1 string) error {
|
|||
fake.delStateArgsForCall = append(fake.delStateArgsForCall, struct {
|
||||
arg1 string
|
||||
}{arg1})
|
||||
stub := fake.DelStateStub
|
||||
fakeReturns := fake.delStateReturns
|
||||
fake.recordInvocation("DelState", []interface{}{arg1})
|
||||
fake.delStateMutex.Unlock()
|
||||
if fake.DelStateStub != nil {
|
||||
return fake.DelStateStub(arg1)
|
||||
if stub != nil {
|
||||
return stub(arg1)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1
|
||||
}
|
||||
fakeReturns := fake.delStateReturns
|
||||
return fakeReturns.result1
|
||||
}
|
||||
|
||||
|
|
@ -701,15 +704,16 @@ func (fake *ChaincodeStub) GetArgs() [][]byte {
|
|||
ret, specificReturn := fake.getArgsReturnsOnCall[len(fake.getArgsArgsForCall)]
|
||||
fake.getArgsArgsForCall = append(fake.getArgsArgsForCall, struct {
|
||||
}{})
|
||||
stub := fake.GetArgsStub
|
||||
fakeReturns := fake.getArgsReturns
|
||||
fake.recordInvocation("GetArgs", []interface{}{})
|
||||
fake.getArgsMutex.Unlock()
|
||||
if fake.GetArgsStub != nil {
|
||||
return fake.GetArgsStub()
|
||||
if stub != nil {
|
||||
return stub()
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1
|
||||
}
|
||||
fakeReturns := fake.getArgsReturns
|
||||
return fakeReturns.result1
|
||||
}
|
||||
|
||||
|
|
@ -753,15 +757,16 @@ func (fake *ChaincodeStub) GetArgsSlice() ([]byte, error) {
|
|||
ret, specificReturn := fake.getArgsSliceReturnsOnCall[len(fake.getArgsSliceArgsForCall)]
|
||||
fake.getArgsSliceArgsForCall = append(fake.getArgsSliceArgsForCall, struct {
|
||||
}{})
|
||||
stub := fake.GetArgsSliceStub
|
||||
fakeReturns := fake.getArgsSliceReturns
|
||||
fake.recordInvocation("GetArgsSlice", []interface{}{})
|
||||
fake.getArgsSliceMutex.Unlock()
|
||||
if fake.GetArgsSliceStub != nil {
|
||||
return fake.GetArgsSliceStub()
|
||||
if stub != nil {
|
||||
return stub()
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1, ret.result2
|
||||
}
|
||||
fakeReturns := fake.getArgsSliceReturns
|
||||
return fakeReturns.result1, fakeReturns.result2
|
||||
}
|
||||
|
||||
|
|
@ -808,15 +813,16 @@ func (fake *ChaincodeStub) GetBinding() ([]byte, error) {
|
|||
ret, specificReturn := fake.getBindingReturnsOnCall[len(fake.getBindingArgsForCall)]
|
||||
fake.getBindingArgsForCall = append(fake.getBindingArgsForCall, struct {
|
||||
}{})
|
||||
stub := fake.GetBindingStub
|
||||
fakeReturns := fake.getBindingReturns
|
||||
fake.recordInvocation("GetBinding", []interface{}{})
|
||||
fake.getBindingMutex.Unlock()
|
||||
if fake.GetBindingStub != nil {
|
||||
return fake.GetBindingStub()
|
||||
if stub != nil {
|
||||
return stub()
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1, ret.result2
|
||||
}
|
||||
fakeReturns := fake.getBindingReturns
|
||||
return fakeReturns.result1, fakeReturns.result2
|
||||
}
|
||||
|
||||
|
|
@ -863,15 +869,16 @@ func (fake *ChaincodeStub) GetChannelID() string {
|
|||
ret, specificReturn := fake.getChannelIDReturnsOnCall[len(fake.getChannelIDArgsForCall)]
|
||||
fake.getChannelIDArgsForCall = append(fake.getChannelIDArgsForCall, struct {
|
||||
}{})
|
||||
stub := fake.GetChannelIDStub
|
||||
fakeReturns := fake.getChannelIDReturns
|
||||
fake.recordInvocation("GetChannelID", []interface{}{})
|
||||
fake.getChannelIDMutex.Unlock()
|
||||
if fake.GetChannelIDStub != nil {
|
||||
return fake.GetChannelIDStub()
|
||||
if stub != nil {
|
||||
return stub()
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1
|
||||
}
|
||||
fakeReturns := fake.getChannelIDReturns
|
||||
return fakeReturns.result1
|
||||
}
|
||||
|
||||
|
|
@ -915,15 +922,16 @@ func (fake *ChaincodeStub) GetCreator() ([]byte, error) {
|
|||
ret, specificReturn := fake.getCreatorReturnsOnCall[len(fake.getCreatorArgsForCall)]
|
||||
fake.getCreatorArgsForCall = append(fake.getCreatorArgsForCall, struct {
|
||||
}{})
|
||||
stub := fake.GetCreatorStub
|
||||
fakeReturns := fake.getCreatorReturns
|
||||
fake.recordInvocation("GetCreator", []interface{}{})
|
||||
fake.getCreatorMutex.Unlock()
|
||||
if fake.GetCreatorStub != nil {
|
||||
return fake.GetCreatorStub()
|
||||
if stub != nil {
|
||||
return stub()
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1, ret.result2
|
||||
}
|
||||
fakeReturns := fake.getCreatorReturns
|
||||
return fakeReturns.result1, fakeReturns.result2
|
||||
}
|
||||
|
||||
|
|
@ -970,15 +978,16 @@ func (fake *ChaincodeStub) GetDecorations() map[string][]byte {
|
|||
ret, specificReturn := fake.getDecorationsReturnsOnCall[len(fake.getDecorationsArgsForCall)]
|
||||
fake.getDecorationsArgsForCall = append(fake.getDecorationsArgsForCall, struct {
|
||||
}{})
|
||||
stub := fake.GetDecorationsStub
|
||||
fakeReturns := fake.getDecorationsReturns
|
||||
fake.recordInvocation("GetDecorations", []interface{}{})
|
||||
fake.getDecorationsMutex.Unlock()
|
||||
if fake.GetDecorationsStub != nil {
|
||||
return fake.GetDecorationsStub()
|
||||
if stub != nil {
|
||||
return stub()
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1
|
||||
}
|
||||
fakeReturns := fake.getDecorationsReturns
|
||||
return fakeReturns.result1
|
||||
}
|
||||
|
||||
|
|
@ -1022,15 +1031,16 @@ func (fake *ChaincodeStub) GetFunctionAndParameters() (string, []string) {
|
|||
ret, specificReturn := fake.getFunctionAndParametersReturnsOnCall[len(fake.getFunctionAndParametersArgsForCall)]
|
||||
fake.getFunctionAndParametersArgsForCall = append(fake.getFunctionAndParametersArgsForCall, struct {
|
||||
}{})
|
||||
stub := fake.GetFunctionAndParametersStub
|
||||
fakeReturns := fake.getFunctionAndParametersReturns
|
||||
fake.recordInvocation("GetFunctionAndParameters", []interface{}{})
|
||||
fake.getFunctionAndParametersMutex.Unlock()
|
||||
if fake.GetFunctionAndParametersStub != nil {
|
||||
return fake.GetFunctionAndParametersStub()
|
||||
if stub != nil {
|
||||
return stub()
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1, ret.result2
|
||||
}
|
||||
fakeReturns := fake.getFunctionAndParametersReturns
|
||||
return fakeReturns.result1, fakeReturns.result2
|
||||
}
|
||||
|
||||
|
|
@ -1078,15 +1088,16 @@ func (fake *ChaincodeStub) GetHistoryForKey(arg1 string) (shim.HistoryQueryItera
|
|||
fake.getHistoryForKeyArgsForCall = append(fake.getHistoryForKeyArgsForCall, struct {
|
||||
arg1 string
|
||||
}{arg1})
|
||||
stub := fake.GetHistoryForKeyStub
|
||||
fakeReturns := fake.getHistoryForKeyReturns
|
||||
fake.recordInvocation("GetHistoryForKey", []interface{}{arg1})
|
||||
fake.getHistoryForKeyMutex.Unlock()
|
||||
if fake.GetHistoryForKeyStub != nil {
|
||||
return fake.GetHistoryForKeyStub(arg1)
|
||||
if stub != nil {
|
||||
return stub(arg1)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1, ret.result2
|
||||
}
|
||||
fakeReturns := fake.getHistoryForKeyReturns
|
||||
return fakeReturns.result1, fakeReturns.result2
|
||||
}
|
||||
|
||||
|
|
@ -1142,15 +1153,16 @@ func (fake *ChaincodeStub) GetPrivateData(arg1 string, arg2 string) ([]byte, err
|
|||
arg1 string
|
||||
arg2 string
|
||||
}{arg1, arg2})
|
||||
stub := fake.GetPrivateDataStub
|
||||
fakeReturns := fake.getPrivateDataReturns
|
||||
fake.recordInvocation("GetPrivateData", []interface{}{arg1, arg2})
|
||||
fake.getPrivateDataMutex.Unlock()
|
||||
if fake.GetPrivateDataStub != nil {
|
||||
return fake.GetPrivateDataStub(arg1, arg2)
|
||||
if stub != nil {
|
||||
return stub(arg1, arg2)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1, ret.result2
|
||||
}
|
||||
fakeReturns := fake.getPrivateDataReturns
|
||||
return fakeReturns.result1, fakeReturns.result2
|
||||
}
|
||||
|
||||
|
|
@ -1212,15 +1224,16 @@ func (fake *ChaincodeStub) GetPrivateDataByPartialCompositeKey(arg1 string, arg2
|
|||
arg2 string
|
||||
arg3 []string
|
||||
}{arg1, arg2, arg3Copy})
|
||||
stub := fake.GetPrivateDataByPartialCompositeKeyStub
|
||||
fakeReturns := fake.getPrivateDataByPartialCompositeKeyReturns
|
||||
fake.recordInvocation("GetPrivateDataByPartialCompositeKey", []interface{}{arg1, arg2, arg3Copy})
|
||||
fake.getPrivateDataByPartialCompositeKeyMutex.Unlock()
|
||||
if fake.GetPrivateDataByPartialCompositeKeyStub != nil {
|
||||
return fake.GetPrivateDataByPartialCompositeKeyStub(arg1, arg2, arg3)
|
||||
if stub != nil {
|
||||
return stub(arg1, arg2, arg3)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1, ret.result2
|
||||
}
|
||||
fakeReturns := fake.getPrivateDataByPartialCompositeKeyReturns
|
||||
return fakeReturns.result1, fakeReturns.result2
|
||||
}
|
||||
|
||||
|
|
@ -1277,15 +1290,16 @@ func (fake *ChaincodeStub) GetPrivateDataByRange(arg1 string, arg2 string, arg3
|
|||
arg2 string
|
||||
arg3 string
|
||||
}{arg1, arg2, arg3})
|
||||
stub := fake.GetPrivateDataByRangeStub
|
||||
fakeReturns := fake.getPrivateDataByRangeReturns
|
||||
fake.recordInvocation("GetPrivateDataByRange", []interface{}{arg1, arg2, arg3})
|
||||
fake.getPrivateDataByRangeMutex.Unlock()
|
||||
if fake.GetPrivateDataByRangeStub != nil {
|
||||
return fake.GetPrivateDataByRangeStub(arg1, arg2, arg3)
|
||||
if stub != nil {
|
||||
return stub(arg1, arg2, arg3)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1, ret.result2
|
||||
}
|
||||
fakeReturns := fake.getPrivateDataByRangeReturns
|
||||
return fakeReturns.result1, fakeReturns.result2
|
||||
}
|
||||
|
||||
|
|
@ -1341,15 +1355,16 @@ func (fake *ChaincodeStub) GetPrivateDataHash(arg1 string, arg2 string) ([]byte,
|
|||
arg1 string
|
||||
arg2 string
|
||||
}{arg1, arg2})
|
||||
stub := fake.GetPrivateDataHashStub
|
||||
fakeReturns := fake.getPrivateDataHashReturns
|
||||
fake.recordInvocation("GetPrivateDataHash", []interface{}{arg1, arg2})
|
||||
fake.getPrivateDataHashMutex.Unlock()
|
||||
if fake.GetPrivateDataHashStub != nil {
|
||||
return fake.GetPrivateDataHashStub(arg1, arg2)
|
||||
if stub != nil {
|
||||
return stub(arg1, arg2)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1, ret.result2
|
||||
}
|
||||
fakeReturns := fake.getPrivateDataHashReturns
|
||||
return fakeReturns.result1, fakeReturns.result2
|
||||
}
|
||||
|
||||
|
|
@ -1405,15 +1420,16 @@ func (fake *ChaincodeStub) GetPrivateDataQueryResult(arg1 string, arg2 string) (
|
|||
arg1 string
|
||||
arg2 string
|
||||
}{arg1, arg2})
|
||||
stub := fake.GetPrivateDataQueryResultStub
|
||||
fakeReturns := fake.getPrivateDataQueryResultReturns
|
||||
fake.recordInvocation("GetPrivateDataQueryResult", []interface{}{arg1, arg2})
|
||||
fake.getPrivateDataQueryResultMutex.Unlock()
|
||||
if fake.GetPrivateDataQueryResultStub != nil {
|
||||
return fake.GetPrivateDataQueryResultStub(arg1, arg2)
|
||||
if stub != nil {
|
||||
return stub(arg1, arg2)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1, ret.result2
|
||||
}
|
||||
fakeReturns := fake.getPrivateDataQueryResultReturns
|
||||
return fakeReturns.result1, fakeReturns.result2
|
||||
}
|
||||
|
||||
|
|
@ -1469,15 +1485,16 @@ func (fake *ChaincodeStub) GetPrivateDataValidationParameter(arg1 string, arg2 s
|
|||
arg1 string
|
||||
arg2 string
|
||||
}{arg1, arg2})
|
||||
stub := fake.GetPrivateDataValidationParameterStub
|
||||
fakeReturns := fake.getPrivateDataValidationParameterReturns
|
||||
fake.recordInvocation("GetPrivateDataValidationParameter", []interface{}{arg1, arg2})
|
||||
fake.getPrivateDataValidationParameterMutex.Unlock()
|
||||
if fake.GetPrivateDataValidationParameterStub != nil {
|
||||
return fake.GetPrivateDataValidationParameterStub(arg1, arg2)
|
||||
if stub != nil {
|
||||
return stub(arg1, arg2)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1, ret.result2
|
||||
}
|
||||
fakeReturns := fake.getPrivateDataValidationParameterReturns
|
||||
return fakeReturns.result1, fakeReturns.result2
|
||||
}
|
||||
|
||||
|
|
@ -1532,15 +1549,16 @@ func (fake *ChaincodeStub) GetQueryResult(arg1 string) (shim.StateQueryIteratorI
|
|||
fake.getQueryResultArgsForCall = append(fake.getQueryResultArgsForCall, struct {
|
||||
arg1 string
|
||||
}{arg1})
|
||||
stub := fake.GetQueryResultStub
|
||||
fakeReturns := fake.getQueryResultReturns
|
||||
fake.recordInvocation("GetQueryResult", []interface{}{arg1})
|
||||
fake.getQueryResultMutex.Unlock()
|
||||
if fake.GetQueryResultStub != nil {
|
||||
return fake.GetQueryResultStub(arg1)
|
||||
if stub != nil {
|
||||
return stub(arg1)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1, ret.result2
|
||||
}
|
||||
fakeReturns := fake.getQueryResultReturns
|
||||
return fakeReturns.result1, fakeReturns.result2
|
||||
}
|
||||
|
||||
|
|
@ -1597,15 +1615,16 @@ func (fake *ChaincodeStub) GetQueryResultWithPagination(arg1 string, arg2 int32,
|
|||
arg2 int32
|
||||
arg3 string
|
||||
}{arg1, arg2, arg3})
|
||||
stub := fake.GetQueryResultWithPaginationStub
|
||||
fakeReturns := fake.getQueryResultWithPaginationReturns
|
||||
fake.recordInvocation("GetQueryResultWithPagination", []interface{}{arg1, arg2, arg3})
|
||||
fake.getQueryResultWithPaginationMutex.Unlock()
|
||||
if fake.GetQueryResultWithPaginationStub != nil {
|
||||
return fake.GetQueryResultWithPaginationStub(arg1, arg2, arg3)
|
||||
if stub != nil {
|
||||
return stub(arg1, arg2, arg3)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1, ret.result2, ret.result3
|
||||
}
|
||||
fakeReturns := fake.getQueryResultWithPaginationReturns
|
||||
return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3
|
||||
}
|
||||
|
||||
|
|
@ -1662,15 +1681,16 @@ func (fake *ChaincodeStub) GetSignedProposal() (*peer.SignedProposal, error) {
|
|||
ret, specificReturn := fake.getSignedProposalReturnsOnCall[len(fake.getSignedProposalArgsForCall)]
|
||||
fake.getSignedProposalArgsForCall = append(fake.getSignedProposalArgsForCall, struct {
|
||||
}{})
|
||||
stub := fake.GetSignedProposalStub
|
||||
fakeReturns := fake.getSignedProposalReturns
|
||||
fake.recordInvocation("GetSignedProposal", []interface{}{})
|
||||
fake.getSignedProposalMutex.Unlock()
|
||||
if fake.GetSignedProposalStub != nil {
|
||||
return fake.GetSignedProposalStub()
|
||||
if stub != nil {
|
||||
return stub()
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1, ret.result2
|
||||
}
|
||||
fakeReturns := fake.getSignedProposalReturns
|
||||
return fakeReturns.result1, fakeReturns.result2
|
||||
}
|
||||
|
||||
|
|
@ -1718,15 +1738,16 @@ func (fake *ChaincodeStub) GetState(arg1 string) ([]byte, error) {
|
|||
fake.getStateArgsForCall = append(fake.getStateArgsForCall, struct {
|
||||
arg1 string
|
||||
}{arg1})
|
||||
stub := fake.GetStateStub
|
||||
fakeReturns := fake.getStateReturns
|
||||
fake.recordInvocation("GetState", []interface{}{arg1})
|
||||
fake.getStateMutex.Unlock()
|
||||
if fake.GetStateStub != nil {
|
||||
return fake.GetStateStub(arg1)
|
||||
if stub != nil {
|
||||
return stub(arg1)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1, ret.result2
|
||||
}
|
||||
fakeReturns := fake.getStateReturns
|
||||
return fakeReturns.result1, fakeReturns.result2
|
||||
}
|
||||
|
||||
|
|
@ -1787,15 +1808,16 @@ func (fake *ChaincodeStub) GetStateByPartialCompositeKey(arg1 string, arg2 []str
|
|||
arg1 string
|
||||
arg2 []string
|
||||
}{arg1, arg2Copy})
|
||||
stub := fake.GetStateByPartialCompositeKeyStub
|
||||
fakeReturns := fake.getStateByPartialCompositeKeyReturns
|
||||
fake.recordInvocation("GetStateByPartialCompositeKey", []interface{}{arg1, arg2Copy})
|
||||
fake.getStateByPartialCompositeKeyMutex.Unlock()
|
||||
if fake.GetStateByPartialCompositeKeyStub != nil {
|
||||
return fake.GetStateByPartialCompositeKeyStub(arg1, arg2)
|
||||
if stub != nil {
|
||||
return stub(arg1, arg2)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1, ret.result2
|
||||
}
|
||||
fakeReturns := fake.getStateByPartialCompositeKeyReturns
|
||||
return fakeReturns.result1, fakeReturns.result2
|
||||
}
|
||||
|
||||
|
|
@ -1858,15 +1880,16 @@ func (fake *ChaincodeStub) GetStateByPartialCompositeKeyWithPagination(arg1 stri
|
|||
arg3 int32
|
||||
arg4 string
|
||||
}{arg1, arg2Copy, arg3, arg4})
|
||||
stub := fake.GetStateByPartialCompositeKeyWithPaginationStub
|
||||
fakeReturns := fake.getStateByPartialCompositeKeyWithPaginationReturns
|
||||
fake.recordInvocation("GetStateByPartialCompositeKeyWithPagination", []interface{}{arg1, arg2Copy, arg3, arg4})
|
||||
fake.getStateByPartialCompositeKeyWithPaginationMutex.Unlock()
|
||||
if fake.GetStateByPartialCompositeKeyWithPaginationStub != nil {
|
||||
return fake.GetStateByPartialCompositeKeyWithPaginationStub(arg1, arg2, arg3, arg4)
|
||||
if stub != nil {
|
||||
return stub(arg1, arg2, arg3, arg4)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1, ret.result2, ret.result3
|
||||
}
|
||||
fakeReturns := fake.getStateByPartialCompositeKeyWithPaginationReturns
|
||||
return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3
|
||||
}
|
||||
|
||||
|
|
@ -1925,15 +1948,16 @@ func (fake *ChaincodeStub) GetStateByRange(arg1 string, arg2 string) (shim.State
|
|||
arg1 string
|
||||
arg2 string
|
||||
}{arg1, arg2})
|
||||
stub := fake.GetStateByRangeStub
|
||||
fakeReturns := fake.getStateByRangeReturns
|
||||
fake.recordInvocation("GetStateByRange", []interface{}{arg1, arg2})
|
||||
fake.getStateByRangeMutex.Unlock()
|
||||
if fake.GetStateByRangeStub != nil {
|
||||
return fake.GetStateByRangeStub(arg1, arg2)
|
||||
if stub != nil {
|
||||
return stub(arg1, arg2)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1, ret.result2
|
||||
}
|
||||
fakeReturns := fake.getStateByRangeReturns
|
||||
return fakeReturns.result1, fakeReturns.result2
|
||||
}
|
||||
|
||||
|
|
@ -1991,15 +2015,16 @@ func (fake *ChaincodeStub) GetStateByRangeWithPagination(arg1 string, arg2 strin
|
|||
arg3 int32
|
||||
arg4 string
|
||||
}{arg1, arg2, arg3, arg4})
|
||||
stub := fake.GetStateByRangeWithPaginationStub
|
||||
fakeReturns := fake.getStateByRangeWithPaginationReturns
|
||||
fake.recordInvocation("GetStateByRangeWithPagination", []interface{}{arg1, arg2, arg3, arg4})
|
||||
fake.getStateByRangeWithPaginationMutex.Unlock()
|
||||
if fake.GetStateByRangeWithPaginationStub != nil {
|
||||
return fake.GetStateByRangeWithPaginationStub(arg1, arg2, arg3, arg4)
|
||||
if stub != nil {
|
||||
return stub(arg1, arg2, arg3, arg4)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1, ret.result2, ret.result3
|
||||
}
|
||||
fakeReturns := fake.getStateByRangeWithPaginationReturns
|
||||
return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3
|
||||
}
|
||||
|
||||
|
|
@ -2057,15 +2082,16 @@ func (fake *ChaincodeStub) GetStateValidationParameter(arg1 string) ([]byte, err
|
|||
fake.getStateValidationParameterArgsForCall = append(fake.getStateValidationParameterArgsForCall, struct {
|
||||
arg1 string
|
||||
}{arg1})
|
||||
stub := fake.GetStateValidationParameterStub
|
||||
fakeReturns := fake.getStateValidationParameterReturns
|
||||
fake.recordInvocation("GetStateValidationParameter", []interface{}{arg1})
|
||||
fake.getStateValidationParameterMutex.Unlock()
|
||||
if fake.GetStateValidationParameterStub != nil {
|
||||
return fake.GetStateValidationParameterStub(arg1)
|
||||
if stub != nil {
|
||||
return stub(arg1)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1, ret.result2
|
||||
}
|
||||
fakeReturns := fake.getStateValidationParameterReturns
|
||||
return fakeReturns.result1, fakeReturns.result2
|
||||
}
|
||||
|
||||
|
|
@ -2119,15 +2145,16 @@ func (fake *ChaincodeStub) GetStringArgs() []string {
|
|||
ret, specificReturn := fake.getStringArgsReturnsOnCall[len(fake.getStringArgsArgsForCall)]
|
||||
fake.getStringArgsArgsForCall = append(fake.getStringArgsArgsForCall, struct {
|
||||
}{})
|
||||
stub := fake.GetStringArgsStub
|
||||
fakeReturns := fake.getStringArgsReturns
|
||||
fake.recordInvocation("GetStringArgs", []interface{}{})
|
||||
fake.getStringArgsMutex.Unlock()
|
||||
if fake.GetStringArgsStub != nil {
|
||||
return fake.GetStringArgsStub()
|
||||
if stub != nil {
|
||||
return stub()
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1
|
||||
}
|
||||
fakeReturns := fake.getStringArgsReturns
|
||||
return fakeReturns.result1
|
||||
}
|
||||
|
||||
|
|
@ -2171,15 +2198,16 @@ func (fake *ChaincodeStub) GetTransient() (map[string][]byte, error) {
|
|||
ret, specificReturn := fake.getTransientReturnsOnCall[len(fake.getTransientArgsForCall)]
|
||||
fake.getTransientArgsForCall = append(fake.getTransientArgsForCall, struct {
|
||||
}{})
|
||||
stub := fake.GetTransientStub
|
||||
fakeReturns := fake.getTransientReturns
|
||||
fake.recordInvocation("GetTransient", []interface{}{})
|
||||
fake.getTransientMutex.Unlock()
|
||||
if fake.GetTransientStub != nil {
|
||||
return fake.GetTransientStub()
|
||||
if stub != nil {
|
||||
return stub()
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1, ret.result2
|
||||
}
|
||||
fakeReturns := fake.getTransientReturns
|
||||
return fakeReturns.result1, fakeReturns.result2
|
||||
}
|
||||
|
||||
|
|
@ -2226,15 +2254,16 @@ func (fake *ChaincodeStub) GetTxID() string {
|
|||
ret, specificReturn := fake.getTxIDReturnsOnCall[len(fake.getTxIDArgsForCall)]
|
||||
fake.getTxIDArgsForCall = append(fake.getTxIDArgsForCall, struct {
|
||||
}{})
|
||||
stub := fake.GetTxIDStub
|
||||
fakeReturns := fake.getTxIDReturns
|
||||
fake.recordInvocation("GetTxID", []interface{}{})
|
||||
fake.getTxIDMutex.Unlock()
|
||||
if fake.GetTxIDStub != nil {
|
||||
return fake.GetTxIDStub()
|
||||
if stub != nil {
|
||||
return stub()
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1
|
||||
}
|
||||
fakeReturns := fake.getTxIDReturns
|
||||
return fakeReturns.result1
|
||||
}
|
||||
|
||||
|
|
@ -2278,15 +2307,16 @@ func (fake *ChaincodeStub) GetTxTimestamp() (*timestamppb.Timestamp, error) {
|
|||
ret, specificReturn := fake.getTxTimestampReturnsOnCall[len(fake.getTxTimestampArgsForCall)]
|
||||
fake.getTxTimestampArgsForCall = append(fake.getTxTimestampArgsForCall, struct {
|
||||
}{})
|
||||
stub := fake.GetTxTimestampStub
|
||||
fakeReturns := fake.getTxTimestampReturns
|
||||
fake.recordInvocation("GetTxTimestamp", []interface{}{})
|
||||
fake.getTxTimestampMutex.Unlock()
|
||||
if fake.GetTxTimestampStub != nil {
|
||||
return fake.GetTxTimestampStub()
|
||||
if stub != nil {
|
||||
return stub()
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1, ret.result2
|
||||
}
|
||||
fakeReturns := fake.getTxTimestampReturns
|
||||
return fakeReturns.result1, fakeReturns.result2
|
||||
}
|
||||
|
||||
|
|
@ -2328,7 +2358,7 @@ func (fake *ChaincodeStub) GetTxTimestampReturnsOnCall(i int, result1 *timestamp
|
|||
}{result1, result2}
|
||||
}
|
||||
|
||||
func (fake *ChaincodeStub) InvokeChaincode(arg1 string, arg2 [][]byte, arg3 string) peer.Response {
|
||||
func (fake *ChaincodeStub) InvokeChaincode(arg1 string, arg2 [][]byte, arg3 string) *peer.Response {
|
||||
var arg2Copy [][]byte
|
||||
if arg2 != nil {
|
||||
arg2Copy = make([][]byte, len(arg2))
|
||||
|
|
@ -2341,15 +2371,16 @@ func (fake *ChaincodeStub) InvokeChaincode(arg1 string, arg2 [][]byte, arg3 stri
|
|||
arg2 [][]byte
|
||||
arg3 string
|
||||
}{arg1, arg2Copy, arg3})
|
||||
stub := fake.InvokeChaincodeStub
|
||||
fakeReturns := fake.invokeChaincodeReturns
|
||||
fake.recordInvocation("InvokeChaincode", []interface{}{arg1, arg2Copy, arg3})
|
||||
fake.invokeChaincodeMutex.Unlock()
|
||||
if fake.InvokeChaincodeStub != nil {
|
||||
return fake.InvokeChaincodeStub(arg1, arg2, arg3)
|
||||
if stub != nil {
|
||||
return stub(arg1, arg2, arg3)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1
|
||||
}
|
||||
fakeReturns := fake.invokeChaincodeReturns
|
||||
return fakeReturns.result1
|
||||
}
|
||||
|
||||
|
|
@ -2359,7 +2390,7 @@ func (fake *ChaincodeStub) InvokeChaincodeCallCount() int {
|
|||
return len(fake.invokeChaincodeArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *ChaincodeStub) InvokeChaincodeCalls(stub func(string, [][]byte, string) peer.Response) {
|
||||
func (fake *ChaincodeStub) InvokeChaincodeCalls(stub func(string, [][]byte, string) *peer.Response) {
|
||||
fake.invokeChaincodeMutex.Lock()
|
||||
defer fake.invokeChaincodeMutex.Unlock()
|
||||
fake.InvokeChaincodeStub = stub
|
||||
|
|
@ -2372,26 +2403,26 @@ func (fake *ChaincodeStub) InvokeChaincodeArgsForCall(i int) (string, [][]byte,
|
|||
return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3
|
||||
}
|
||||
|
||||
func (fake *ChaincodeStub) InvokeChaincodeReturns(result1 peer.Response) {
|
||||
func (fake *ChaincodeStub) InvokeChaincodeReturns(result1 *peer.Response) {
|
||||
fake.invokeChaincodeMutex.Lock()
|
||||
defer fake.invokeChaincodeMutex.Unlock()
|
||||
fake.InvokeChaincodeStub = nil
|
||||
fake.invokeChaincodeReturns = struct {
|
||||
result1 peer.Response
|
||||
result1 *peer.Response
|
||||
}{result1}
|
||||
}
|
||||
|
||||
func (fake *ChaincodeStub) InvokeChaincodeReturnsOnCall(i int, result1 peer.Response) {
|
||||
func (fake *ChaincodeStub) InvokeChaincodeReturnsOnCall(i int, result1 *peer.Response) {
|
||||
fake.invokeChaincodeMutex.Lock()
|
||||
defer fake.invokeChaincodeMutex.Unlock()
|
||||
fake.InvokeChaincodeStub = nil
|
||||
if fake.invokeChaincodeReturnsOnCall == nil {
|
||||
fake.invokeChaincodeReturnsOnCall = make(map[int]struct {
|
||||
result1 peer.Response
|
||||
result1 *peer.Response
|
||||
})
|
||||
}
|
||||
fake.invokeChaincodeReturnsOnCall[i] = struct {
|
||||
result1 peer.Response
|
||||
result1 *peer.Response
|
||||
}{result1}
|
||||
}
|
||||
|
||||
|
|
@ -2402,15 +2433,16 @@ func (fake *ChaincodeStub) PurgePrivateData(arg1 string, arg2 string) error {
|
|||
arg1 string
|
||||
arg2 string
|
||||
}{arg1, arg2})
|
||||
stub := fake.PurgePrivateDataStub
|
||||
fakeReturns := fake.purgePrivateDataReturns
|
||||
fake.recordInvocation("PurgePrivateData", []interface{}{arg1, arg2})
|
||||
fake.purgePrivateDataMutex.Unlock()
|
||||
if fake.PurgePrivateDataStub != nil {
|
||||
return fake.PurgePrivateDataStub(arg1, arg2)
|
||||
if stub != nil {
|
||||
return stub(arg1, arg2)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1
|
||||
}
|
||||
fakeReturns := fake.purgePrivateDataReturns
|
||||
return fakeReturns.result1
|
||||
}
|
||||
|
||||
|
|
@ -2469,15 +2501,16 @@ func (fake *ChaincodeStub) PutPrivateData(arg1 string, arg2 string, arg3 []byte)
|
|||
arg2 string
|
||||
arg3 []byte
|
||||
}{arg1, arg2, arg3Copy})
|
||||
stub := fake.PutPrivateDataStub
|
||||
fakeReturns := fake.putPrivateDataReturns
|
||||
fake.recordInvocation("PutPrivateData", []interface{}{arg1, arg2, arg3Copy})
|
||||
fake.putPrivateDataMutex.Unlock()
|
||||
if fake.PutPrivateDataStub != nil {
|
||||
return fake.PutPrivateDataStub(arg1, arg2, arg3)
|
||||
if stub != nil {
|
||||
return stub(arg1, arg2, arg3)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1
|
||||
}
|
||||
fakeReturns := fake.putPrivateDataReturns
|
||||
return fakeReturns.result1
|
||||
}
|
||||
|
||||
|
|
@ -2535,15 +2568,16 @@ func (fake *ChaincodeStub) PutState(arg1 string, arg2 []byte) error {
|
|||
arg1 string
|
||||
arg2 []byte
|
||||
}{arg1, arg2Copy})
|
||||
stub := fake.PutStateStub
|
||||
fakeReturns := fake.putStateReturns
|
||||
fake.recordInvocation("PutState", []interface{}{arg1, arg2Copy})
|
||||
fake.putStateMutex.Unlock()
|
||||
if fake.PutStateStub != nil {
|
||||
return fake.PutStateStub(arg1, arg2)
|
||||
if stub != nil {
|
||||
return stub(arg1, arg2)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1
|
||||
}
|
||||
fakeReturns := fake.putStateReturns
|
||||
return fakeReturns.result1
|
||||
}
|
||||
|
||||
|
|
@ -2601,15 +2635,16 @@ func (fake *ChaincodeStub) SetEvent(arg1 string, arg2 []byte) error {
|
|||
arg1 string
|
||||
arg2 []byte
|
||||
}{arg1, arg2Copy})
|
||||
stub := fake.SetEventStub
|
||||
fakeReturns := fake.setEventReturns
|
||||
fake.recordInvocation("SetEvent", []interface{}{arg1, arg2Copy})
|
||||
fake.setEventMutex.Unlock()
|
||||
if fake.SetEventStub != nil {
|
||||
return fake.SetEventStub(arg1, arg2)
|
||||
if stub != nil {
|
||||
return stub(arg1, arg2)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1
|
||||
}
|
||||
fakeReturns := fake.setEventReturns
|
||||
return fakeReturns.result1
|
||||
}
|
||||
|
||||
|
|
@ -2668,15 +2703,16 @@ func (fake *ChaincodeStub) SetPrivateDataValidationParameter(arg1 string, arg2 s
|
|||
arg2 string
|
||||
arg3 []byte
|
||||
}{arg1, arg2, arg3Copy})
|
||||
stub := fake.SetPrivateDataValidationParameterStub
|
||||
fakeReturns := fake.setPrivateDataValidationParameterReturns
|
||||
fake.recordInvocation("SetPrivateDataValidationParameter", []interface{}{arg1, arg2, arg3Copy})
|
||||
fake.setPrivateDataValidationParameterMutex.Unlock()
|
||||
if fake.SetPrivateDataValidationParameterStub != nil {
|
||||
return fake.SetPrivateDataValidationParameterStub(arg1, arg2, arg3)
|
||||
if stub != nil {
|
||||
return stub(arg1, arg2, arg3)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1
|
||||
}
|
||||
fakeReturns := fake.setPrivateDataValidationParameterReturns
|
||||
return fakeReturns.result1
|
||||
}
|
||||
|
||||
|
|
@ -2734,15 +2770,16 @@ func (fake *ChaincodeStub) SetStateValidationParameter(arg1 string, arg2 []byte)
|
|||
arg1 string
|
||||
arg2 []byte
|
||||
}{arg1, arg2Copy})
|
||||
stub := fake.SetStateValidationParameterStub
|
||||
fakeReturns := fake.setStateValidationParameterReturns
|
||||
fake.recordInvocation("SetStateValidationParameter", []interface{}{arg1, arg2Copy})
|
||||
fake.setStateValidationParameterMutex.Unlock()
|
||||
if fake.SetStateValidationParameterStub != nil {
|
||||
return fake.SetStateValidationParameterStub(arg1, arg2)
|
||||
if stub != nil {
|
||||
return stub(arg1, arg2)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1
|
||||
}
|
||||
fakeReturns := fake.setStateValidationParameterReturns
|
||||
return fakeReturns.result1
|
||||
}
|
||||
|
||||
|
|
@ -2794,15 +2831,16 @@ func (fake *ChaincodeStub) SplitCompositeKey(arg1 string) (string, []string, err
|
|||
fake.splitCompositeKeyArgsForCall = append(fake.splitCompositeKeyArgsForCall, struct {
|
||||
arg1 string
|
||||
}{arg1})
|
||||
stub := fake.SplitCompositeKeyStub
|
||||
fakeReturns := fake.splitCompositeKeyReturns
|
||||
fake.recordInvocation("SplitCompositeKey", []interface{}{arg1})
|
||||
fake.splitCompositeKeyMutex.Unlock()
|
||||
if fake.SplitCompositeKeyStub != nil {
|
||||
return fake.SplitCompositeKeyStub(arg1)
|
||||
if stub != nil {
|
||||
return stub(arg1)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1, ret.result2, ret.result3
|
||||
}
|
||||
fakeReturns := fake.splitCompositeKeyReturns
|
||||
return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -81,15 +81,16 @@ func (fake *ClientIdentity) AssertAttributeValue(arg1 string, arg2 string) error
|
|||
arg1 string
|
||||
arg2 string
|
||||
}{arg1, arg2})
|
||||
stub := fake.AssertAttributeValueStub
|
||||
fakeReturns := fake.assertAttributeValueReturns
|
||||
fake.recordInvocation("AssertAttributeValue", []interface{}{arg1, arg2})
|
||||
fake.assertAttributeValueMutex.Unlock()
|
||||
if fake.AssertAttributeValueStub != nil {
|
||||
return fake.AssertAttributeValueStub(arg1, arg2)
|
||||
if stub != nil {
|
||||
return stub(arg1, arg2)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1
|
||||
}
|
||||
fakeReturns := fake.assertAttributeValueReturns
|
||||
return fakeReturns.result1
|
||||
}
|
||||
|
||||
|
|
@ -141,15 +142,16 @@ func (fake *ClientIdentity) GetAttributeValue(arg1 string) (string, bool, error)
|
|||
fake.getAttributeValueArgsForCall = append(fake.getAttributeValueArgsForCall, struct {
|
||||
arg1 string
|
||||
}{arg1})
|
||||
stub := fake.GetAttributeValueStub
|
||||
fakeReturns := fake.getAttributeValueReturns
|
||||
fake.recordInvocation("GetAttributeValue", []interface{}{arg1})
|
||||
fake.getAttributeValueMutex.Unlock()
|
||||
if fake.GetAttributeValueStub != nil {
|
||||
return fake.GetAttributeValueStub(arg1)
|
||||
if stub != nil {
|
||||
return stub(arg1)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1, ret.result2, ret.result3
|
||||
}
|
||||
fakeReturns := fake.getAttributeValueReturns
|
||||
return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3
|
||||
}
|
||||
|
||||
|
|
@ -206,15 +208,16 @@ func (fake *ClientIdentity) GetID() (string, error) {
|
|||
ret, specificReturn := fake.getIDReturnsOnCall[len(fake.getIDArgsForCall)]
|
||||
fake.getIDArgsForCall = append(fake.getIDArgsForCall, struct {
|
||||
}{})
|
||||
stub := fake.GetIDStub
|
||||
fakeReturns := fake.getIDReturns
|
||||
fake.recordInvocation("GetID", []interface{}{})
|
||||
fake.getIDMutex.Unlock()
|
||||
if fake.GetIDStub != nil {
|
||||
return fake.GetIDStub()
|
||||
if stub != nil {
|
||||
return stub()
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1, ret.result2
|
||||
}
|
||||
fakeReturns := fake.getIDReturns
|
||||
return fakeReturns.result1, fakeReturns.result2
|
||||
}
|
||||
|
||||
|
|
@ -261,15 +264,16 @@ func (fake *ClientIdentity) GetMSPID() (string, error) {
|
|||
ret, specificReturn := fake.getMSPIDReturnsOnCall[len(fake.getMSPIDArgsForCall)]
|
||||
fake.getMSPIDArgsForCall = append(fake.getMSPIDArgsForCall, struct {
|
||||
}{})
|
||||
stub := fake.GetMSPIDStub
|
||||
fakeReturns := fake.getMSPIDReturns
|
||||
fake.recordInvocation("GetMSPID", []interface{}{})
|
||||
fake.getMSPIDMutex.Unlock()
|
||||
if fake.GetMSPIDStub != nil {
|
||||
return fake.GetMSPIDStub()
|
||||
if stub != nil {
|
||||
return stub()
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1, ret.result2
|
||||
}
|
||||
fakeReturns := fake.getMSPIDReturns
|
||||
return fakeReturns.result1, fakeReturns.result2
|
||||
}
|
||||
|
||||
|
|
@ -316,15 +320,16 @@ func (fake *ClientIdentity) GetX509Certificate() (*x509.Certificate, error) {
|
|||
ret, specificReturn := fake.getX509CertificateReturnsOnCall[len(fake.getX509CertificateArgsForCall)]
|
||||
fake.getX509CertificateArgsForCall = append(fake.getX509CertificateArgsForCall, struct {
|
||||
}{})
|
||||
stub := fake.GetX509CertificateStub
|
||||
fakeReturns := fake.getX509CertificateReturns
|
||||
fake.recordInvocation("GetX509Certificate", []interface{}{})
|
||||
fake.getX509CertificateMutex.Unlock()
|
||||
if fake.GetX509CertificateStub != nil {
|
||||
return fake.GetX509CertificateStub()
|
||||
if stub != nil {
|
||||
return stub()
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1, ret.result2
|
||||
}
|
||||
fakeReturns := fake.getX509CertificateReturns
|
||||
return fakeReturns.result1, fakeReturns.result2
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ package mocks
|
|||
import (
|
||||
"sync"
|
||||
|
||||
"github.com/hyperledger/fabric-protos-go/ledger/queryresult"
|
||||
"github.com/hyperledger/fabric-protos-go-apiv2/ledger/queryresult"
|
||||
)
|
||||
|
||||
type StateQueryIterator struct {
|
||||
|
|
@ -49,15 +49,16 @@ func (fake *StateQueryIterator) Close() error {
|
|||
ret, specificReturn := fake.closeReturnsOnCall[len(fake.closeArgsForCall)]
|
||||
fake.closeArgsForCall = append(fake.closeArgsForCall, struct {
|
||||
}{})
|
||||
stub := fake.CloseStub
|
||||
fakeReturns := fake.closeReturns
|
||||
fake.recordInvocation("Close", []interface{}{})
|
||||
fake.closeMutex.Unlock()
|
||||
if fake.CloseStub != nil {
|
||||
return fake.CloseStub()
|
||||
if stub != nil {
|
||||
return stub()
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1
|
||||
}
|
||||
fakeReturns := fake.closeReturns
|
||||
return fakeReturns.result1
|
||||
}
|
||||
|
||||
|
|
@ -101,15 +102,16 @@ func (fake *StateQueryIterator) HasNext() bool {
|
|||
ret, specificReturn := fake.hasNextReturnsOnCall[len(fake.hasNextArgsForCall)]
|
||||
fake.hasNextArgsForCall = append(fake.hasNextArgsForCall, struct {
|
||||
}{})
|
||||
stub := fake.HasNextStub
|
||||
fakeReturns := fake.hasNextReturns
|
||||
fake.recordInvocation("HasNext", []interface{}{})
|
||||
fake.hasNextMutex.Unlock()
|
||||
if fake.HasNextStub != nil {
|
||||
return fake.HasNextStub()
|
||||
if stub != nil {
|
||||
return stub()
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1
|
||||
}
|
||||
fakeReturns := fake.hasNextReturns
|
||||
return fakeReturns.result1
|
||||
}
|
||||
|
||||
|
|
@ -153,15 +155,16 @@ func (fake *StateQueryIterator) Next() (*queryresult.KV, error) {
|
|||
ret, specificReturn := fake.nextReturnsOnCall[len(fake.nextArgsForCall)]
|
||||
fake.nextArgsForCall = append(fake.nextArgsForCall, struct {
|
||||
}{})
|
||||
stub := fake.NextStub
|
||||
fakeReturns := fake.nextReturns
|
||||
fake.recordInvocation("Next", []interface{}{})
|
||||
fake.nextMutex.Unlock()
|
||||
if fake.NextStub != nil {
|
||||
return fake.NextStub()
|
||||
if stub != nil {
|
||||
return stub()
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1, ret.result2
|
||||
}
|
||||
fakeReturns := fake.nextReturns
|
||||
return fakeReturns.result1, fakeReturns.result2
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ package mocks
|
|||
import (
|
||||
"sync"
|
||||
|
||||
"github.com/hyperledger/fabric-chaincode-go/pkg/cid"
|
||||
"github.com/hyperledger/fabric-chaincode-go/shim"
|
||||
"github.com/hyperledger/fabric-chaincode-go/v2/pkg/cid"
|
||||
"github.com/hyperledger/fabric-chaincode-go/v2/shim"
|
||||
)
|
||||
|
||||
type TransactionContext struct {
|
||||
|
|
@ -38,15 +38,16 @@ func (fake *TransactionContext) GetClientIdentity() cid.ClientIdentity {
|
|||
ret, specificReturn := fake.getClientIdentityReturnsOnCall[len(fake.getClientIdentityArgsForCall)]
|
||||
fake.getClientIdentityArgsForCall = append(fake.getClientIdentityArgsForCall, struct {
|
||||
}{})
|
||||
stub := fake.GetClientIdentityStub
|
||||
fakeReturns := fake.getClientIdentityReturns
|
||||
fake.recordInvocation("GetClientIdentity", []interface{}{})
|
||||
fake.getClientIdentityMutex.Unlock()
|
||||
if fake.GetClientIdentityStub != nil {
|
||||
return fake.GetClientIdentityStub()
|
||||
if stub != nil {
|
||||
return stub()
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1
|
||||
}
|
||||
fakeReturns := fake.getClientIdentityReturns
|
||||
return fakeReturns.result1
|
||||
}
|
||||
|
||||
|
|
@ -90,15 +91,16 @@ func (fake *TransactionContext) GetStub() shim.ChaincodeStubInterface {
|
|||
ret, specificReturn := fake.getStubReturnsOnCall[len(fake.getStubArgsForCall)]
|
||||
fake.getStubArgsForCall = append(fake.getStubArgsForCall, struct {
|
||||
}{})
|
||||
stub := fake.GetStubStub
|
||||
fakeReturns := fake.getStubReturns
|
||||
fake.recordInvocation("GetStub", []interface{}{})
|
||||
fake.getStubMutex.Unlock()
|
||||
if fake.GetStubStub != nil {
|
||||
return fake.GetStubStub()
|
||||
if stub != nil {
|
||||
return stub()
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1
|
||||
}
|
||||
fakeReturns := fake.getStubReturns
|
||||
return fakeReturns.result1
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,38 +1,37 @@
|
|||
module github.com/hyperledger/fabric-samples/asset-transfer-private-data/chaincode-go
|
||||
|
||||
go 1.17
|
||||
go 1.21
|
||||
|
||||
require (
|
||||
github.com/hyperledger/fabric-chaincode-go v0.0.0-20230228194215-b84622ba6a7a
|
||||
github.com/hyperledger/fabric-contract-api-go v1.2.1
|
||||
github.com/hyperledger/fabric-protos-go v0.3.0
|
||||
github.com/stretchr/testify v1.8.2
|
||||
google.golang.org/protobuf v1.28.1
|
||||
github.com/hyperledger/fabric-chaincode-go/v2 v2.0.0-20240618210511-f7903324a8af
|
||||
github.com/hyperledger/fabric-contract-api-go/v2 v2.0.0
|
||||
github.com/hyperledger/fabric-protos-go-apiv2 v0.3.3
|
||||
github.com/stretchr/testify v1.9.0
|
||||
google.golang.org/protobuf v1.34.2
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/go-openapi/jsonpointer v0.19.5 // indirect
|
||||
github.com/go-openapi/jsonreference v0.20.0 // indirect
|
||||
github.com/go-openapi/spec v0.20.8 // indirect
|
||||
github.com/go-openapi/swag v0.21.1 // indirect
|
||||
github.com/gobuffalo/envy v1.10.1 // indirect
|
||||
github.com/gobuffalo/packd v1.0.1 // indirect
|
||||
github.com/go-openapi/jsonpointer v0.21.0 // indirect
|
||||
github.com/go-openapi/jsonreference v0.21.0 // indirect
|
||||
github.com/go-openapi/spec v0.21.0 // indirect
|
||||
github.com/go-openapi/swag v0.23.0 // indirect
|
||||
github.com/gobuffalo/envy v1.10.2 // indirect
|
||||
github.com/gobuffalo/packd v1.0.2 // indirect
|
||||
github.com/gobuffalo/packr v1.30.1 // indirect
|
||||
github.com/golang/protobuf v1.5.2 // indirect
|
||||
github.com/joho/godotenv v1.4.0 // indirect
|
||||
github.com/joho/godotenv v1.5.1 // indirect
|
||||
github.com/josharian/intern v1.0.0 // indirect
|
||||
github.com/mailru/easyjson v0.7.7 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
github.com/rogpeppe/go-internal v1.8.1 // indirect
|
||||
github.com/rogpeppe/go-internal v1.12.0 // indirect
|
||||
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
|
||||
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
|
||||
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
|
||||
golang.org/x/net v0.7.0 // indirect
|
||||
golang.org/x/sys v0.5.0 // indirect
|
||||
golang.org/x/text v0.7.0 // indirect
|
||||
golang.org/x/mod v0.17.0 // indirect
|
||||
golang.org/x/net v0.24.0 // indirect
|
||||
golang.org/x/sys v0.19.0 // indirect
|
||||
golang.org/x/text v0.14.0 // indirect
|
||||
google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect
|
||||
google.golang.org/grpc v1.53.0 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
google.golang.org/grpc v1.64.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -7,7 +7,7 @@ package main
|
|||
import (
|
||||
"log"
|
||||
|
||||
"github.com/hyperledger/fabric-contract-api-go/contractapi"
|
||||
"github.com/hyperledger/fabric-contract-api-go/v2/contractapi"
|
||||
"github.com/hyperledger/fabric-samples/asset-transfer-private-data/chaincode-go/chaincode"
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -13,10 +13,9 @@ import (
|
|||
"log"
|
||||
"time"
|
||||
|
||||
"github.com/golang/protobuf/ptypes"
|
||||
"github.com/hyperledger/fabric-chaincode-go/pkg/statebased"
|
||||
"github.com/hyperledger/fabric-chaincode-go/shim"
|
||||
"github.com/hyperledger/fabric-contract-api-go/contractapi"
|
||||
"github.com/hyperledger/fabric-chaincode-go/v2/pkg/statebased"
|
||||
"github.com/hyperledger/fabric-chaincode-go/v2/shim"
|
||||
"github.com/hyperledger/fabric-contract-api-go/v2/contractapi"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
@ -485,13 +484,9 @@ func transferAssetState(ctx contractapi.TransactionContextInterface, asset *Asse
|
|||
return fmt.Errorf("failed to create timestamp for receipt: %v", err)
|
||||
}
|
||||
|
||||
timestamp, err := ptypes.Timestamp(txTimestamp)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
assetReceipt := receipt{
|
||||
price: price,
|
||||
timestamp: timestamp,
|
||||
timestamp: txTimestamp.AsTime(),
|
||||
}
|
||||
receipt, err := json.Marshal(assetReceipt)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -9,8 +9,7 @@ import (
|
|||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/golang/protobuf/ptypes"
|
||||
"github.com/hyperledger/fabric-contract-api-go/contractapi"
|
||||
"github.com/hyperledger/fabric-contract-api-go/v2/contractapi"
|
||||
)
|
||||
|
||||
// QueryResult structure used for handling result of query
|
||||
|
|
@ -161,13 +160,9 @@ func (s *SmartContract) QueryAssetHistory(ctx contractapi.TransactionContextInte
|
|||
return nil, err
|
||||
}
|
||||
|
||||
timestamp, err := ptypes.Timestamp(response.Timestamp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
record := QueryResult{
|
||||
TxId: response.TxId,
|
||||
Timestamp: timestamp,
|
||||
Timestamp: response.Timestamp.AsTime(),
|
||||
Record: asset,
|
||||
}
|
||||
results = append(results, record)
|
||||
|
|
|
|||
|
|
@ -1,34 +1,34 @@
|
|||
module github.com/hyperledger/fabric-samples/chaincode/tradingMarbles
|
||||
|
||||
go 1.17
|
||||
go 1.21
|
||||
|
||||
require (
|
||||
github.com/golang/protobuf v1.5.2
|
||||
github.com/hyperledger/fabric-chaincode-go v0.0.0-20230228194215-b84622ba6a7a
|
||||
github.com/hyperledger/fabric-contract-api-go v1.2.1
|
||||
github.com/hyperledger/fabric-chaincode-go/v2 v2.0.0-20240618210511-f7903324a8af
|
||||
github.com/hyperledger/fabric-contract-api-go/v2 v2.0.0
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/go-openapi/jsonpointer v0.19.5 // indirect
|
||||
github.com/go-openapi/jsonreference v0.20.0 // indirect
|
||||
github.com/go-openapi/spec v0.20.8 // indirect
|
||||
github.com/go-openapi/swag v0.21.1 // indirect
|
||||
github.com/gobuffalo/envy v1.10.1 // indirect
|
||||
github.com/gobuffalo/packd v1.0.1 // indirect
|
||||
github.com/go-openapi/jsonpointer v0.21.0 // indirect
|
||||
github.com/go-openapi/jsonreference v0.21.0 // indirect
|
||||
github.com/go-openapi/spec v0.21.0 // indirect
|
||||
github.com/go-openapi/swag v0.23.0 // indirect
|
||||
github.com/gobuffalo/envy v1.10.2 // indirect
|
||||
github.com/gobuffalo/packd v1.0.2 // indirect
|
||||
github.com/gobuffalo/packr v1.30.1 // indirect
|
||||
github.com/hyperledger/fabric-protos-go v0.3.0 // indirect
|
||||
github.com/joho/godotenv v1.4.0 // indirect
|
||||
github.com/hyperledger/fabric-protos-go-apiv2 v0.3.3 // indirect
|
||||
github.com/joho/godotenv v1.5.1 // indirect
|
||||
github.com/josharian/intern v1.0.0 // indirect
|
||||
github.com/mailru/easyjson v0.7.7 // indirect
|
||||
github.com/rogpeppe/go-internal v1.8.1 // indirect
|
||||
github.com/rogpeppe/go-internal v1.12.0 // indirect
|
||||
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
|
||||
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
|
||||
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
|
||||
golang.org/x/net v0.7.0 // indirect
|
||||
golang.org/x/sys v0.5.0 // indirect
|
||||
golang.org/x/text v0.7.0 // indirect
|
||||
golang.org/x/mod v0.17.0 // indirect
|
||||
golang.org/x/net v0.24.0 // indirect
|
||||
golang.org/x/sys v0.19.0 // indirect
|
||||
golang.org/x/text v0.14.0 // indirect
|
||||
google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect
|
||||
google.golang.org/grpc v1.53.0 // indirect
|
||||
google.golang.org/protobuf v1.28.1 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
google.golang.org/grpc v1.64.0 // indirect
|
||||
google.golang.org/protobuf v1.34.2 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -1,34 +1,34 @@
|
|||
module github.com/hyperledger/fabric-samples/auction/dutch-auction/chaincode-go-auditor
|
||||
|
||||
go 1.17
|
||||
go 1.21
|
||||
|
||||
require (
|
||||
github.com/golang/protobuf v1.5.2
|
||||
github.com/hyperledger/fabric-chaincode-go v0.0.0-20230228194215-b84622ba6a7a
|
||||
github.com/hyperledger/fabric-contract-api-go v1.2.1
|
||||
github.com/hyperledger/fabric-protos-go v0.3.0
|
||||
github.com/hyperledger/fabric-chaincode-go/v2 v2.0.0-20240618210511-f7903324a8af
|
||||
github.com/hyperledger/fabric-contract-api-go/v2 v2.0.0
|
||||
github.com/hyperledger/fabric-protos-go-apiv2 v0.3.3
|
||||
google.golang.org/protobuf v1.34.2
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/go-openapi/jsonpointer v0.19.5 // indirect
|
||||
github.com/go-openapi/jsonreference v0.20.0 // indirect
|
||||
github.com/go-openapi/spec v0.20.8 // indirect
|
||||
github.com/go-openapi/swag v0.21.1 // indirect
|
||||
github.com/gobuffalo/envy v1.10.1 // indirect
|
||||
github.com/gobuffalo/packd v1.0.1 // indirect
|
||||
github.com/go-openapi/jsonpointer v0.21.0 // indirect
|
||||
github.com/go-openapi/jsonreference v0.21.0 // indirect
|
||||
github.com/go-openapi/spec v0.21.0 // indirect
|
||||
github.com/go-openapi/swag v0.23.0 // indirect
|
||||
github.com/gobuffalo/envy v1.10.2 // indirect
|
||||
github.com/gobuffalo/packd v1.0.2 // indirect
|
||||
github.com/gobuffalo/packr v1.30.1 // indirect
|
||||
github.com/joho/godotenv v1.4.0 // indirect
|
||||
github.com/joho/godotenv v1.5.1 // indirect
|
||||
github.com/josharian/intern v1.0.0 // indirect
|
||||
github.com/mailru/easyjson v0.7.7 // indirect
|
||||
github.com/rogpeppe/go-internal v1.8.1 // indirect
|
||||
github.com/rogpeppe/go-internal v1.12.0 // indirect
|
||||
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
|
||||
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
|
||||
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
|
||||
golang.org/x/net v0.7.0 // indirect
|
||||
golang.org/x/sys v0.5.0 // indirect
|
||||
golang.org/x/text v0.7.0 // indirect
|
||||
golang.org/x/mod v0.17.0 // indirect
|
||||
golang.org/x/net v0.24.0 // indirect
|
||||
golang.org/x/sys v0.19.0 // indirect
|
||||
golang.org/x/text v0.14.0 // indirect
|
||||
google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect
|
||||
google.golang.org/grpc v1.53.0 // indirect
|
||||
google.golang.org/protobuf v1.28.1 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
google.golang.org/grpc v1.64.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -8,10 +8,11 @@ import (
|
|||
"bytes"
|
||||
"crypto/sha256"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"sort"
|
||||
|
||||
"github.com/hyperledger/fabric-contract-api-go/contractapi"
|
||||
"github.com/hyperledger/fabric-contract-api-go/v2/contractapi"
|
||||
)
|
||||
|
||||
type SmartContract struct {
|
||||
|
|
@ -106,10 +107,7 @@ func (s *SmartContract) SubmitBid(ctx contractapi.TransactionContextInterface, a
|
|||
Hash: fmt.Sprintf("%x", bidHash),
|
||||
}
|
||||
|
||||
bidders := make(map[string]BidHash)
|
||||
bidders = auction.PrivateBids
|
||||
bidders[bidKey] = newHash
|
||||
auction.PrivateBids = bidders
|
||||
auction.PrivateBids[bidKey] = newHash
|
||||
|
||||
// Add the bidding organization to the list of participating organization's if it is not already
|
||||
orgs := auction.Orgs
|
||||
|
|
@ -183,7 +181,7 @@ func (s *SmartContract) RevealBid(ctx contractapi.TransactionContextInterface, a
|
|||
// check that the bidders org is a participant in the auction
|
||||
orgs := auction.Orgs
|
||||
if !(contains(orgs, clientOrgID)) {
|
||||
return fmt.Errorf("Particiant is not a member of the auction", err)
|
||||
return fmt.Errorf("particiant %s is not a member of the auction", clientOrgID)
|
||||
}
|
||||
|
||||
// Complete a series of three checks before we add the bid to the auction
|
||||
|
|
@ -192,7 +190,7 @@ func (s *SmartContract) RevealBid(ctx contractapi.TransactionContextInterface, a
|
|||
// bid to an open auction
|
||||
status := auction.Status
|
||||
if status != "closed" {
|
||||
return fmt.Errorf("cannot reveal bid for open or ended auction")
|
||||
return errors.New("cannot reveal bid for open or ended auction")
|
||||
}
|
||||
|
||||
// check 2: check that hash of revealed bid matches hash of private bid
|
||||
|
|
@ -216,8 +214,7 @@ func (s *SmartContract) RevealBid(ctx contractapi.TransactionContextInterface, a
|
|||
// added earlier. This ensures that the bid has not changed since it
|
||||
// was added to the auction
|
||||
|
||||
bidders := auction.PrivateBids
|
||||
privateBidHashString := bidders[bidKey].Hash
|
||||
privateBidHashString := auction.PrivateBids[bidKey].Hash
|
||||
|
||||
onChainBidHashString := fmt.Sprintf("%x", bidHash)
|
||||
if privateBidHashString != onChainBidHashString {
|
||||
|
|
@ -260,13 +257,10 @@ func (s *SmartContract) RevealBid(ctx contractapi.TransactionContextInterface, a
|
|||
|
||||
// check 4: make sure that the transaction is being submitted is the bidder
|
||||
if bidInput.Buyer != clientID {
|
||||
return fmt.Errorf("Permission denied, client id %v is not the owner of the bid", clientID)
|
||||
return fmt.Errorf("permission denied, client id %v is not the owner of the bid", clientID)
|
||||
}
|
||||
|
||||
revealedBids := make(map[string]FullBid)
|
||||
revealedBids = auction.RevealedBids
|
||||
revealedBids[bidKey] = newBid
|
||||
auction.RevealedBids = revealedBids
|
||||
auction.RevealedBids[bidKey] = newBid
|
||||
|
||||
auctionJSON, _ := json.Marshal(auction)
|
||||
|
||||
|
|
@ -298,7 +292,7 @@ func (s *SmartContract) CloseAuction(ctx contractapi.TransactionContextInterface
|
|||
// check that the bidders org is a participant in the auction
|
||||
orgs := auction.Orgs
|
||||
if !(contains(orgs, clientOrgID)) {
|
||||
return fmt.Errorf("Particiant is not a member of the auction", err)
|
||||
return fmt.Errorf("particiant %s is not a member of the auction", clientOrgID)
|
||||
}
|
||||
|
||||
// the auction can only be closed by the seller
|
||||
|
|
@ -316,7 +310,7 @@ func (s *SmartContract) CloseAuction(ctx contractapi.TransactionContextInterface
|
|||
|
||||
status := auction.Status
|
||||
if status != "open" {
|
||||
return fmt.Errorf("cannot close auction that is not open")
|
||||
return errors.New("cannot close auction that is not open")
|
||||
}
|
||||
|
||||
auction.Status = string("closed")
|
||||
|
|
@ -350,7 +344,7 @@ func (s *SmartContract) EndAuction(ctx contractapi.TransactionContextInterface,
|
|||
// check that the bidders org is a participant in the auction
|
||||
orgs := auction.Orgs
|
||||
if !(contains(orgs, clientOrgID)) {
|
||||
return fmt.Errorf("Particiant is not a member of the auction", err)
|
||||
return fmt.Errorf("particiant %s is not a member of the auction", clientOrgID)
|
||||
}
|
||||
|
||||
// Check that the auction is being ended by the seller
|
||||
|
|
@ -368,14 +362,14 @@ func (s *SmartContract) EndAuction(ctx contractapi.TransactionContextInterface,
|
|||
|
||||
status := auction.Status
|
||||
if status != "closed" {
|
||||
return fmt.Errorf("Can only end a closed auction")
|
||||
return errors.New("can only end a closed auction")
|
||||
}
|
||||
|
||||
// get the list of revealed bids
|
||||
|
||||
revealedBidMap := auction.RevealedBids
|
||||
if len(auction.RevealedBids) == 0 {
|
||||
return fmt.Errorf("No bids have been revealed, cannot end auction: %v", err)
|
||||
return fmt.Errorf("no bids have been revealed, cannot end auction: %v", err)
|
||||
}
|
||||
|
||||
// sort the map of revealed bids to make it easier to calculate winners
|
||||
|
|
@ -431,10 +425,10 @@ func (s *SmartContract) EndAuction(ctx contractapi.TransactionContextInterface,
|
|||
// check if there is a winning bid that has yet to be revealed
|
||||
err = checkForHigherBid(ctx, auction.Price, auction.RevealedBids, auction.PrivateBids)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Cannot end auction: %v", err)
|
||||
return fmt.Errorf("cannot end auction: %v", err)
|
||||
}
|
||||
|
||||
auction.Status = string("ended")
|
||||
auction.Status = "ended"
|
||||
|
||||
endedAuctionJSON, _ := json.Marshal(auction)
|
||||
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ import (
|
|||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
"github.com/hyperledger/fabric-chaincode-go/shim"
|
||||
"github.com/hyperledger/fabric-contract-api-go/contractapi"
|
||||
"github.com/hyperledger/fabric-chaincode-go/v2/shim"
|
||||
"github.com/hyperledger/fabric-contract-api-go/v2/contractapi"
|
||||
)
|
||||
|
||||
// QueryAuction allows all members of the channel to read a public auction
|
||||
|
|
|
|||
|
|
@ -8,11 +8,11 @@ import (
|
|||
"encoding/base64"
|
||||
"fmt"
|
||||
|
||||
"github.com/golang/protobuf/proto"
|
||||
"github.com/hyperledger/fabric-chaincode-go/shim"
|
||||
"github.com/hyperledger/fabric-contract-api-go/contractapi"
|
||||
"github.com/hyperledger/fabric-protos-go/common"
|
||||
"github.com/hyperledger/fabric-protos-go/msp"
|
||||
"github.com/hyperledger/fabric-chaincode-go/v2/shim"
|
||||
"github.com/hyperledger/fabric-contract-api-go/v2/contractapi"
|
||||
"github.com/hyperledger/fabric-protos-go-apiv2/common"
|
||||
"github.com/hyperledger/fabric-protos-go-apiv2/msp"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (s *SmartContract) GetSubmittingClientIdentity(ctx contractapi.TransactionContextInterface) (string, error) {
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ package main
|
|||
import (
|
||||
"log"
|
||||
|
||||
"github.com/hyperledger/fabric-contract-api-go/contractapi"
|
||||
"github.com/hyperledger/fabric-contract-api-go/v2/contractapi"
|
||||
auction "github.com/hyperledger/fabric-samples/auction/dutch-auction/chaincode-go-auditor/smart-contract"
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,34 +1,34 @@
|
|||
module github.com/hyperledger/fabric-samples/auction/dutch-auction/chaincode-go
|
||||
|
||||
go 1.17
|
||||
go 1.21
|
||||
|
||||
require (
|
||||
github.com/golang/protobuf v1.5.2
|
||||
github.com/hyperledger/fabric-chaincode-go v0.0.0-20230228194215-b84622ba6a7a
|
||||
github.com/hyperledger/fabric-contract-api-go v1.2.1
|
||||
github.com/hyperledger/fabric-protos-go v0.3.0
|
||||
github.com/hyperledger/fabric-chaincode-go/v2 v2.0.0-20240618210511-f7903324a8af
|
||||
github.com/hyperledger/fabric-contract-api-go/v2 v2.0.0
|
||||
github.com/hyperledger/fabric-protos-go-apiv2 v0.3.3
|
||||
google.golang.org/protobuf v1.34.2
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/go-openapi/jsonpointer v0.19.5 // indirect
|
||||
github.com/go-openapi/jsonreference v0.20.0 // indirect
|
||||
github.com/go-openapi/spec v0.20.8 // indirect
|
||||
github.com/go-openapi/swag v0.21.1 // indirect
|
||||
github.com/gobuffalo/envy v1.10.1 // indirect
|
||||
github.com/gobuffalo/packd v1.0.1 // indirect
|
||||
github.com/go-openapi/jsonpointer v0.21.0 // indirect
|
||||
github.com/go-openapi/jsonreference v0.21.0 // indirect
|
||||
github.com/go-openapi/spec v0.21.0 // indirect
|
||||
github.com/go-openapi/swag v0.23.0 // indirect
|
||||
github.com/gobuffalo/envy v1.10.2 // indirect
|
||||
github.com/gobuffalo/packd v1.0.2 // indirect
|
||||
github.com/gobuffalo/packr v1.30.1 // indirect
|
||||
github.com/joho/godotenv v1.4.0 // indirect
|
||||
github.com/joho/godotenv v1.5.1 // indirect
|
||||
github.com/josharian/intern v1.0.0 // indirect
|
||||
github.com/mailru/easyjson v0.7.7 // indirect
|
||||
github.com/rogpeppe/go-internal v1.8.1 // indirect
|
||||
github.com/rogpeppe/go-internal v1.12.0 // indirect
|
||||
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
|
||||
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
|
||||
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
|
||||
golang.org/x/net v0.7.0 // indirect
|
||||
golang.org/x/sys v0.5.0 // indirect
|
||||
golang.org/x/text v0.7.0 // indirect
|
||||
golang.org/x/mod v0.17.0 // indirect
|
||||
golang.org/x/net v0.24.0 // indirect
|
||||
golang.org/x/sys v0.19.0 // indirect
|
||||
golang.org/x/text v0.14.0 // indirect
|
||||
google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect
|
||||
google.golang.org/grpc v1.53.0 // indirect
|
||||
google.golang.org/protobuf v1.28.1 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
google.golang.org/grpc v1.64.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -11,7 +11,7 @@ import (
|
|||
"fmt"
|
||||
"sort"
|
||||
|
||||
"github.com/hyperledger/fabric-contract-api-go/contractapi"
|
||||
"github.com/hyperledger/fabric-contract-api-go/v2/contractapi"
|
||||
)
|
||||
|
||||
type SmartContract struct {
|
||||
|
|
@ -141,7 +141,7 @@ func (s *SmartContract) Bid(ctx contractapi.TransactionContextInterface, auction
|
|||
// the bidder has to target their peer to store the bid
|
||||
err = verifyClientOrgMatchesPeerOrg(ctx)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("Cannot store bid on this peer, not a member of this org: Error %v", err)
|
||||
return "", fmt.Errorf("cannot store bid on this peer, not a member of this org: %v", err)
|
||||
}
|
||||
|
||||
// the transaction ID is used as a unique index for the bid
|
||||
|
|
@ -213,10 +213,7 @@ func (s *SmartContract) SubmitBid(ctx contractapi.TransactionContextInterface, a
|
|||
Hash: fmt.Sprintf("%x", bidHash),
|
||||
}
|
||||
|
||||
bidders := make(map[string]BidHash)
|
||||
bidders = auction.PrivateBids
|
||||
bidders[bidKey] = newHash
|
||||
auction.PrivateBids = bidders
|
||||
auction.PrivateBids[bidKey] = newHash
|
||||
|
||||
// Add the bidding organization to the list of participating organization's if it is not already
|
||||
orgs := auction.Orgs
|
||||
|
|
@ -311,8 +308,7 @@ func (s *SmartContract) RevealBid(ctx contractapi.TransactionContextInterface, a
|
|||
// added earlier. This ensures that the bid has not changed since it
|
||||
// was added to the auction
|
||||
|
||||
bidders := auction.PrivateBids
|
||||
privateBidHashString := bidders[bidKey].Hash
|
||||
privateBidHashString := auction.PrivateBids[bidKey].Hash
|
||||
|
||||
onChainBidHashString := fmt.Sprintf("%x", bidHash)
|
||||
if privateBidHashString != onChainBidHashString {
|
||||
|
|
@ -355,11 +351,10 @@ func (s *SmartContract) RevealBid(ctx contractapi.TransactionContextInterface, a
|
|||
|
||||
// check 4: make sure that the transaction is being submitted is the bidder
|
||||
if bidInput.Buyer != clientID {
|
||||
return fmt.Errorf("Permission denied, client id %v is not the owner of the bid", clientID)
|
||||
return fmt.Errorf("permission denied, client id %v is not the owner of the bid", clientID)
|
||||
}
|
||||
|
||||
revealedBids := make(map[string]FullBid)
|
||||
revealedBids = auction.RevealedBids
|
||||
revealedBids := auction.RevealedBids
|
||||
revealedBids[bidKey] = newBid
|
||||
auction.RevealedBids = revealedBids
|
||||
|
||||
|
|
@ -439,14 +434,14 @@ func (s *SmartContract) EndAuction(ctx contractapi.TransactionContextInterface,
|
|||
|
||||
status := auction.Status
|
||||
if status != "closed" {
|
||||
return fmt.Errorf("Can only end a closed auction")
|
||||
return fmt.Errorf("can only end a closed auction")
|
||||
}
|
||||
|
||||
// get the list of revealed bids
|
||||
|
||||
revealedBidMap := auction.RevealedBids
|
||||
if len(auction.RevealedBids) == 0 {
|
||||
return fmt.Errorf("No bids have been revealed, cannot end auction: %v", err)
|
||||
return fmt.Errorf("no bids have been revealed, cannot end auction: %v", err)
|
||||
}
|
||||
|
||||
// sort the map of revealed bids to make it easier to calculate winners
|
||||
|
|
@ -502,10 +497,10 @@ func (s *SmartContract) EndAuction(ctx contractapi.TransactionContextInterface,
|
|||
// check if there is a winning bid that has yet to be revealed
|
||||
err = checkForHigherBid(ctx, auction.Price, auction.RevealedBids, auction.PrivateBids)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Cannot end auction: %v", err)
|
||||
return fmt.Errorf("cannot end auction: %v", err)
|
||||
}
|
||||
|
||||
auction.Status = string("ended")
|
||||
auction.Status = "ended"
|
||||
|
||||
endedAuctionJSON, _ := json.Marshal(auction)
|
||||
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ import (
|
|||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
"github.com/hyperledger/fabric-chaincode-go/shim"
|
||||
"github.com/hyperledger/fabric-contract-api-go/contractapi"
|
||||
"github.com/hyperledger/fabric-chaincode-go/v2/shim"
|
||||
"github.com/hyperledger/fabric-contract-api-go/v2/contractapi"
|
||||
)
|
||||
|
||||
// QueryAuction allows all members of the channel to read a public auction
|
||||
|
|
@ -71,7 +71,7 @@ func (s *SmartContract) QueryBid(ctx contractapi.TransactionContextInterface, au
|
|||
|
||||
// check that the client querying the bid is the bid owner
|
||||
if bid.Buyer != clientID {
|
||||
return nil, fmt.Errorf("Permission denied, client id %v is not the owner of the bid", clientID)
|
||||
return nil, fmt.Errorf("permission denied, client id %v is not the owner of the bid", clientID)
|
||||
}
|
||||
|
||||
return bid, nil
|
||||
|
|
@ -116,7 +116,7 @@ func checkForHigherBid(ctx contractapi.TransactionContextInterface, auctionPrice
|
|||
}
|
||||
|
||||
if bid.Price > auctionPrice {
|
||||
error = fmt.Errorf("Cannot close auction, bidder has a higher price: %v", err)
|
||||
error = fmt.Errorf("cannot close auction, bidder has a higher price: %v", err)
|
||||
}
|
||||
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -8,18 +8,18 @@ import (
|
|||
"encoding/base64"
|
||||
"fmt"
|
||||
|
||||
"github.com/golang/protobuf/proto"
|
||||
"github.com/hyperledger/fabric-chaincode-go/shim"
|
||||
"github.com/hyperledger/fabric-contract-api-go/contractapi"
|
||||
"github.com/hyperledger/fabric-protos-go/common"
|
||||
"github.com/hyperledger/fabric-protos-go/msp"
|
||||
"github.com/hyperledger/fabric-chaincode-go/v2/shim"
|
||||
"github.com/hyperledger/fabric-contract-api-go/v2/contractapi"
|
||||
"github.com/hyperledger/fabric-protos-go-apiv2/common"
|
||||
"github.com/hyperledger/fabric-protos-go-apiv2/msp"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (s *SmartContract) GetSubmittingClientIdentity(ctx contractapi.TransactionContextInterface) (string, error) {
|
||||
|
||||
b64ID, err := ctx.GetClientIdentity().GetID()
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("Failed to read clientID: %v", err)
|
||||
return "", fmt.Errorf("failed to read clientID: %v", err)
|
||||
}
|
||||
decodeID, err := base64.StdEncoding.DecodeString(b64ID)
|
||||
if err != nil {
|
||||
|
|
@ -97,7 +97,7 @@ func setAssetStateBasedEndorsement(ctx contractapi.TransactionContextInterface,
|
|||
}
|
||||
}
|
||||
|
||||
if auditor == false {
|
||||
if !auditor {
|
||||
// create the defalt policy for an auction without an auditor
|
||||
|
||||
policy := &common.SignaturePolicyEnvelope{
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ package main
|
|||
import (
|
||||
"log"
|
||||
|
||||
"github.com/hyperledger/fabric-contract-api-go/contractapi"
|
||||
"github.com/hyperledger/fabric-contract-api-go/v2/contractapi"
|
||||
auction "github.com/hyperledger/fabric-samples/auction/dutch-auction/chaincode-go/smart-contract"
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,34 +1,34 @@
|
|||
module github.com/hyperledger/fabric-samples/auction/chaincode-go
|
||||
|
||||
go 1.17
|
||||
go 1.21
|
||||
|
||||
require (
|
||||
github.com/hyperledger/fabric-chaincode-go v0.0.0-20230228194215-b84622ba6a7a
|
||||
github.com/hyperledger/fabric-contract-api-go v1.2.1
|
||||
github.com/hyperledger/fabric-chaincode-go/v2 v2.0.0-20240618210511-f7903324a8af
|
||||
github.com/hyperledger/fabric-contract-api-go/v2 v2.0.0
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/go-openapi/jsonpointer v0.19.5 // indirect
|
||||
github.com/go-openapi/jsonreference v0.20.0 // indirect
|
||||
github.com/go-openapi/spec v0.20.8 // indirect
|
||||
github.com/go-openapi/swag v0.21.1 // indirect
|
||||
github.com/gobuffalo/envy v1.10.1 // indirect
|
||||
github.com/gobuffalo/packd v1.0.1 // indirect
|
||||
github.com/go-openapi/jsonpointer v0.21.0 // indirect
|
||||
github.com/go-openapi/jsonreference v0.21.0 // indirect
|
||||
github.com/go-openapi/spec v0.21.0 // indirect
|
||||
github.com/go-openapi/swag v0.23.0 // indirect
|
||||
github.com/gobuffalo/envy v1.10.2 // indirect
|
||||
github.com/gobuffalo/packd v1.0.2 // indirect
|
||||
github.com/gobuffalo/packr v1.30.1 // indirect
|
||||
github.com/golang/protobuf v1.5.2 // indirect
|
||||
github.com/hyperledger/fabric-protos-go v0.3.0 // indirect
|
||||
github.com/joho/godotenv v1.4.0 // indirect
|
||||
github.com/hyperledger/fabric-protos-go-apiv2 v0.3.3 // indirect
|
||||
github.com/joho/godotenv v1.5.1 // indirect
|
||||
github.com/josharian/intern v1.0.0 // indirect
|
||||
github.com/mailru/easyjson v0.7.7 // indirect
|
||||
github.com/rogpeppe/go-internal v1.8.1 // indirect
|
||||
github.com/rogpeppe/go-internal v1.12.0 // indirect
|
||||
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
|
||||
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
|
||||
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
|
||||
golang.org/x/net v0.7.0 // indirect
|
||||
golang.org/x/sys v0.5.0 // indirect
|
||||
golang.org/x/text v0.7.0 // indirect
|
||||
golang.org/x/mod v0.17.0 // indirect
|
||||
golang.org/x/net v0.24.0 // indirect
|
||||
golang.org/x/sys v0.19.0 // indirect
|
||||
golang.org/x/text v0.14.0 // indirect
|
||||
google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect
|
||||
google.golang.org/grpc v1.53.0 // indirect
|
||||
google.golang.org/protobuf v1.28.1 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
google.golang.org/grpc v1.64.0 // indirect
|
||||
google.golang.org/protobuf v1.34.2 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -8,9 +8,10 @@ import (
|
|||
"bytes"
|
||||
"crypto/sha256"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/hyperledger/fabric-contract-api-go/contractapi"
|
||||
"github.com/hyperledger/fabric-contract-api-go/v2/contractapi"
|
||||
)
|
||||
|
||||
type SmartContract struct {
|
||||
|
|
@ -111,7 +112,7 @@ func (s *SmartContract) Bid(ctx contractapi.TransactionContextInterface, auction
|
|||
|
||||
BidJSON, ok := transientMap["bid"]
|
||||
if !ok {
|
||||
return "", fmt.Errorf("bid key not found in the transient map")
|
||||
return "", errors.New("bid key not found in the transient map")
|
||||
}
|
||||
|
||||
// get the implicit collection name using the bidder's organization ID
|
||||
|
|
@ -123,7 +124,7 @@ func (s *SmartContract) Bid(ctx contractapi.TransactionContextInterface, auction
|
|||
// the bidder has to target their peer to store the bid
|
||||
err = verifyClientOrgMatchesPeerOrg(ctx)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("Cannot store bid on this peer, not a member of this org: Error %v", err)
|
||||
return "", fmt.Errorf("cannot store bid on this peer, not a member of this org: Error %v", err)
|
||||
}
|
||||
|
||||
// the transaction ID is used as a unique index for the bid
|
||||
|
|
@ -165,7 +166,7 @@ func (s *SmartContract) SubmitBid(ctx contractapi.TransactionContextInterface, a
|
|||
// the auction needs to be open for users to add their bid
|
||||
Status := auction.Status
|
||||
if Status != "open" {
|
||||
return fmt.Errorf("cannot join closed or ended auction")
|
||||
return errors.New("cannot join closed or ended auction")
|
||||
}
|
||||
|
||||
// get the inplicit collection name of bidder's org
|
||||
|
|
@ -195,10 +196,7 @@ func (s *SmartContract) SubmitBid(ctx contractapi.TransactionContextInterface, a
|
|||
Hash: fmt.Sprintf("%x", bidHash),
|
||||
}
|
||||
|
||||
bidders := make(map[string]BidHash)
|
||||
bidders = auction.PrivateBids
|
||||
bidders[bidKey] = NewHash
|
||||
auction.PrivateBids = bidders
|
||||
auction.PrivateBids[bidKey] = NewHash
|
||||
|
||||
// Add the bidding organization to the list of participating organizations if it is not already
|
||||
Orgs := auction.Orgs
|
||||
|
|
@ -233,7 +231,7 @@ func (s *SmartContract) RevealBid(ctx contractapi.TransactionContextInterface, a
|
|||
|
||||
transientBidJSON, ok := transientMap["bid"]
|
||||
if !ok {
|
||||
return fmt.Errorf("bid key not found in the transient map")
|
||||
return errors.New("bid key not found in the transient map")
|
||||
}
|
||||
|
||||
// get implicit collection name of organization ID
|
||||
|
|
@ -269,7 +267,7 @@ func (s *SmartContract) RevealBid(ctx contractapi.TransactionContextInterface, a
|
|||
// bid to an open auction
|
||||
Status := auction.Status
|
||||
if Status != "closed" {
|
||||
return fmt.Errorf("cannot reveal bid for open or ended auction")
|
||||
return errors.New("cannot reveal bid for open or ended auction")
|
||||
}
|
||||
|
||||
// check 2: check that hash of revealed bid matches hash of private bid
|
||||
|
|
@ -293,8 +291,7 @@ func (s *SmartContract) RevealBid(ctx contractapi.TransactionContextInterface, a
|
|||
// added earlier. This ensures that the bid has not changed since it
|
||||
// was added to the auction
|
||||
|
||||
bidders := auction.PrivateBids
|
||||
privateBidHashString := bidders[bidKey].Hash
|
||||
privateBidHashString := auction.PrivateBids[bidKey].Hash
|
||||
|
||||
onChainBidHashString := fmt.Sprintf("%x", bidHash)
|
||||
if privateBidHashString != onChainBidHashString {
|
||||
|
|
@ -335,13 +332,10 @@ func (s *SmartContract) RevealBid(ctx contractapi.TransactionContextInterface, a
|
|||
|
||||
// check 4: make sure that the transaction is being submitted is the bidder
|
||||
if bidInput.Bidder != clientID {
|
||||
return fmt.Errorf("Permission denied, client id %v is not the owner of the bid", clientID)
|
||||
return fmt.Errorf("permission denied, client id %v is not the owner of the bid", clientID)
|
||||
}
|
||||
|
||||
revealedBids := make(map[string]FullBid)
|
||||
revealedBids = auction.RevealedBids
|
||||
revealedBids[bidKey] = NewBid
|
||||
auction.RevealedBids = revealedBids
|
||||
auction.RevealedBids[bidKey] = NewBid
|
||||
|
||||
newAuctionJSON, _ := json.Marshal(auction)
|
||||
|
||||
|
|
@ -379,7 +373,7 @@ func (s *SmartContract) CloseAuction(ctx contractapi.TransactionContextInterface
|
|||
|
||||
Status := auction.Status
|
||||
if Status != "open" {
|
||||
return fmt.Errorf("cannot close auction that is not open")
|
||||
return errors.New("cannot close auction that is not open")
|
||||
}
|
||||
|
||||
auction.Status = string("closed")
|
||||
|
|
@ -419,13 +413,13 @@ func (s *SmartContract) EndAuction(ctx contractapi.TransactionContextInterface,
|
|||
|
||||
Status := auction.Status
|
||||
if Status != "closed" {
|
||||
return fmt.Errorf("Can only end a closed auction")
|
||||
return errors.New("can only end a closed auction")
|
||||
}
|
||||
|
||||
// get the list of revealed bids
|
||||
revealedBidMap := auction.RevealedBids
|
||||
if len(auction.RevealedBids) == 0 {
|
||||
return fmt.Errorf("No bids have been revealed, cannot end auction: %v", err)
|
||||
return fmt.Errorf("no bids have been revealed, cannot end auction: %v", err)
|
||||
}
|
||||
|
||||
// determine the highest bid
|
||||
|
|
@ -439,10 +433,10 @@ func (s *SmartContract) EndAuction(ctx contractapi.TransactionContextInterface,
|
|||
// check if there is a winning bid that has yet to be revealed
|
||||
err = checkForHigherBid(ctx, auction.Price, auction.RevealedBids, auction.PrivateBids)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Cannot end auction: %v", err)
|
||||
return fmt.Errorf("cannot end auction: %v", err)
|
||||
}
|
||||
|
||||
auction.Status = string("ended")
|
||||
auction.Status = "ended"
|
||||
|
||||
endedAuctionJSON, _ := json.Marshal(auction)
|
||||
|
||||
|
|
|
|||
|
|
@ -6,10 +6,11 @@ package auction
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/hyperledger/fabric-chaincode-go/shim"
|
||||
"github.com/hyperledger/fabric-contract-api-go/contractapi"
|
||||
"github.com/hyperledger/fabric-chaincode-go/v2/shim"
|
||||
"github.com/hyperledger/fabric-contract-api-go/v2/contractapi"
|
||||
)
|
||||
|
||||
// QueryAuction allows all members of the channel to read a public auction
|
||||
|
|
@ -20,7 +21,7 @@ func (s *SmartContract) QueryAuction(ctx contractapi.TransactionContextInterface
|
|||
return nil, fmt.Errorf("failed to get auction object %v: %v", auctionID, err)
|
||||
}
|
||||
if auctionJSON == nil {
|
||||
return nil, fmt.Errorf("auction does not exist")
|
||||
return nil, errors.New("auction does not exist")
|
||||
}
|
||||
|
||||
var auction *Auction
|
||||
|
|
@ -71,7 +72,7 @@ func (s *SmartContract) QueryBid(ctx contractapi.TransactionContextInterface, au
|
|||
|
||||
// check that the client querying the bid is the bid owner
|
||||
if bid.Bidder != clientID {
|
||||
return nil, fmt.Errorf("Permission denied, client id %v is not the owner of the bid", clientID)
|
||||
return nil, fmt.Errorf("permission denied, client id %v is not the owner of the bid", clientID)
|
||||
}
|
||||
|
||||
return bid, nil
|
||||
|
|
@ -116,7 +117,7 @@ func checkForHigherBid(ctx contractapi.TransactionContextInterface, auctionPrice
|
|||
}
|
||||
|
||||
if bid.Price > auctionPrice {
|
||||
error = fmt.Errorf("Cannot close auction, bidder has a higher price: %v", err)
|
||||
error = fmt.Errorf("cannot close auction, bidder has a higher price: %v", err)
|
||||
}
|
||||
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -5,19 +5,19 @@ SPDX-License-Identifier: Apache-2.0
|
|||
package auction
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
|
||||
"github.com/hyperledger/fabric-chaincode-go/pkg/statebased"
|
||||
"github.com/hyperledger/fabric-chaincode-go/shim"
|
||||
"github.com/hyperledger/fabric-contract-api-go/contractapi"
|
||||
"github.com/hyperledger/fabric-chaincode-go/v2/pkg/statebased"
|
||||
"github.com/hyperledger/fabric-chaincode-go/v2/shim"
|
||||
"github.com/hyperledger/fabric-contract-api-go/v2/contractapi"
|
||||
)
|
||||
|
||||
func (s *SmartContract) GetSubmittingClientIdentity(ctx contractapi.TransactionContextInterface) (string, error) {
|
||||
|
||||
b64ID, err := ctx.GetClientIdentity().GetID()
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("Failed to read clientID: %v", err)
|
||||
return "", fmt.Errorf("failed to read clientID: %v", err)
|
||||
}
|
||||
decodeID, err := base64.StdEncoding.DecodeString(b64ID)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ package main
|
|||
import (
|
||||
"log"
|
||||
|
||||
"github.com/hyperledger/fabric-contract-api-go/contractapi"
|
||||
"github.com/hyperledger/fabric-contract-api-go/v2/contractapi"
|
||||
"github.com/hyperledger/fabric-samples/auction/chaincode-go/smart-contract"
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import (
|
|||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/hyperledger/fabric-contract-api-go/contractapi"
|
||||
"github.com/hyperledger/fabric-contract-api-go/v2/contractapi"
|
||||
)
|
||||
|
||||
const uriKey = "uri"
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ package main
|
|||
import (
|
||||
"erc1155/chaincode"
|
||||
|
||||
"github.com/hyperledger/fabric-contract-api-go/contractapi"
|
||||
"github.com/hyperledger/fabric-contract-api-go/v2/contractapi"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
|
|||
|
|
@ -1,32 +1,32 @@
|
|||
module erc1155
|
||||
|
||||
go 1.17
|
||||
go 1.21
|
||||
|
||||
require github.com/hyperledger/fabric-contract-api-go v1.2.1
|
||||
require github.com/hyperledger/fabric-contract-api-go/v2 v2.0.0
|
||||
|
||||
require (
|
||||
github.com/go-openapi/jsonpointer v0.19.5 // indirect
|
||||
github.com/go-openapi/jsonreference v0.20.0 // indirect
|
||||
github.com/go-openapi/spec v0.20.8 // indirect
|
||||
github.com/go-openapi/swag v0.21.1 // indirect
|
||||
github.com/gobuffalo/envy v1.10.1 // indirect
|
||||
github.com/gobuffalo/packd v1.0.1 // indirect
|
||||
github.com/go-openapi/jsonpointer v0.21.0 // indirect
|
||||
github.com/go-openapi/jsonreference v0.21.0 // indirect
|
||||
github.com/go-openapi/spec v0.21.0 // indirect
|
||||
github.com/go-openapi/swag v0.23.0 // indirect
|
||||
github.com/gobuffalo/envy v1.10.2 // indirect
|
||||
github.com/gobuffalo/packd v1.0.2 // indirect
|
||||
github.com/gobuffalo/packr v1.30.1 // indirect
|
||||
github.com/golang/protobuf v1.5.2 // indirect
|
||||
github.com/hyperledger/fabric-chaincode-go v0.0.0-20230228194215-b84622ba6a7a // indirect
|
||||
github.com/hyperledger/fabric-protos-go v0.3.0 // indirect
|
||||
github.com/joho/godotenv v1.4.0 // indirect
|
||||
github.com/hyperledger/fabric-chaincode-go/v2 v2.0.0-20240618210511-f7903324a8af // indirect
|
||||
github.com/hyperledger/fabric-protos-go-apiv2 v0.3.3 // indirect
|
||||
github.com/joho/godotenv v1.5.1 // indirect
|
||||
github.com/josharian/intern v1.0.0 // indirect
|
||||
github.com/mailru/easyjson v0.7.7 // indirect
|
||||
github.com/rogpeppe/go-internal v1.8.1 // indirect
|
||||
github.com/rogpeppe/go-internal v1.12.0 // indirect
|
||||
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
|
||||
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
|
||||
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
|
||||
golang.org/x/net v0.7.0 // indirect
|
||||
golang.org/x/sys v0.5.0 // indirect
|
||||
golang.org/x/text v0.7.0 // indirect
|
||||
golang.org/x/mod v0.17.0 // indirect
|
||||
golang.org/x/net v0.24.0 // indirect
|
||||
golang.org/x/sys v0.19.0 // indirect
|
||||
golang.org/x/text v0.14.0 // indirect
|
||||
google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect
|
||||
google.golang.org/grpc v1.53.0 // indirect
|
||||
google.golang.org/protobuf v1.28.1 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
google.golang.org/grpc v1.64.0 // indirect
|
||||
google.golang.org/protobuf v1.34.2 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -7,7 +7,7 @@ import (
|
|||
"log"
|
||||
"strconv"
|
||||
|
||||
"github.com/hyperledger/fabric-contract-api-go/contractapi"
|
||||
"github.com/hyperledger/fabric-contract-api-go/v2/contractapi"
|
||||
)
|
||||
|
||||
// Define key names for options
|
||||
|
|
|
|||
|
|
@ -1,32 +1,32 @@
|
|||
module github.com/hyperledger/fabric-samples/token-erc-20/chaincode-go
|
||||
|
||||
go 1.17
|
||||
go 1.21
|
||||
|
||||
require github.com/hyperledger/fabric-contract-api-go v1.2.1
|
||||
require github.com/hyperledger/fabric-contract-api-go/v2 v2.0.0
|
||||
|
||||
require (
|
||||
github.com/go-openapi/jsonpointer v0.19.5 // indirect
|
||||
github.com/go-openapi/jsonreference v0.20.0 // indirect
|
||||
github.com/go-openapi/spec v0.20.8 // indirect
|
||||
github.com/go-openapi/swag v0.21.1 // indirect
|
||||
github.com/gobuffalo/envy v1.10.1 // indirect
|
||||
github.com/gobuffalo/packd v1.0.1 // indirect
|
||||
github.com/go-openapi/jsonpointer v0.21.0 // indirect
|
||||
github.com/go-openapi/jsonreference v0.21.0 // indirect
|
||||
github.com/go-openapi/spec v0.21.0 // indirect
|
||||
github.com/go-openapi/swag v0.23.0 // indirect
|
||||
github.com/gobuffalo/envy v1.10.2 // indirect
|
||||
github.com/gobuffalo/packd v1.0.2 // indirect
|
||||
github.com/gobuffalo/packr v1.30.1 // indirect
|
||||
github.com/golang/protobuf v1.5.2 // indirect
|
||||
github.com/hyperledger/fabric-chaincode-go v0.0.0-20230228194215-b84622ba6a7a // indirect
|
||||
github.com/hyperledger/fabric-protos-go v0.3.0 // indirect
|
||||
github.com/joho/godotenv v1.4.0 // indirect
|
||||
github.com/hyperledger/fabric-chaincode-go/v2 v2.0.0-20240618210511-f7903324a8af // indirect
|
||||
github.com/hyperledger/fabric-protos-go-apiv2 v0.3.3 // indirect
|
||||
github.com/joho/godotenv v1.5.1 // indirect
|
||||
github.com/josharian/intern v1.0.0 // indirect
|
||||
github.com/mailru/easyjson v0.7.7 // indirect
|
||||
github.com/rogpeppe/go-internal v1.8.1 // indirect
|
||||
github.com/rogpeppe/go-internal v1.12.0 // indirect
|
||||
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
|
||||
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
|
||||
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
|
||||
golang.org/x/net v0.7.0 // indirect
|
||||
golang.org/x/sys v0.5.0 // indirect
|
||||
golang.org/x/text v0.7.0 // indirect
|
||||
golang.org/x/mod v0.17.0 // indirect
|
||||
golang.org/x/net v0.24.0 // indirect
|
||||
golang.org/x/sys v0.19.0 // indirect
|
||||
golang.org/x/text v0.14.0 // indirect
|
||||
google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect
|
||||
google.golang.org/grpc v1.53.0 // indirect
|
||||
google.golang.org/protobuf v1.28.1 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
google.golang.org/grpc v1.64.0 // indirect
|
||||
google.golang.org/protobuf v1.34.2 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -7,7 +7,7 @@ package main
|
|||
import (
|
||||
"log"
|
||||
|
||||
"github.com/hyperledger/fabric-contract-api-go/contractapi"
|
||||
"github.com/hyperledger/fabric-contract-api-go/v2/contractapi"
|
||||
"github.com/hyperledger/fabric-samples/token-erc-20/chaincode-go/chaincode"
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -3,9 +3,10 @@ package chaincode
|
|||
import (
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/hyperledger/fabric-contract-api-go/contractapi"
|
||||
"github.com/hyperledger/fabric-contract-api-go/v2/contractapi"
|
||||
)
|
||||
|
||||
// Define objectType names for prefix
|
||||
|
|
@ -102,7 +103,7 @@ func (c *TokenERC721Contract) OwnerOf(ctx contractapi.TransactionContextInterfac
|
|||
return "", fmt.Errorf("failed to check if contract is already initialized: %v", err)
|
||||
}
|
||||
if !initialized {
|
||||
return "", fmt.Errorf("Contract options need to be set before calling any function, call Initialize() to initialize contract")
|
||||
return "", errors.New("contract options need to be set before calling any function, call Initialize() to initialize contract")
|
||||
}
|
||||
|
||||
nft, err := _readNFT(ctx, tokenId)
|
||||
|
|
@ -125,7 +126,7 @@ func (c *TokenERC721Contract) Approve(ctx contractapi.TransactionContextInterfac
|
|||
return false, fmt.Errorf("failed to check if contract is already initialized: %v", err)
|
||||
}
|
||||
if !initialized {
|
||||
return false, fmt.Errorf("Contract options need to be set before calling any function, call Initialize() to initialize contract")
|
||||
return false, errors.New("contract options need to be set before calling any function, call Initialize() to initialize contract")
|
||||
}
|
||||
|
||||
sender64, err := ctx.GetClientIdentity().GetID()
|
||||
|
|
@ -152,7 +153,7 @@ func (c *TokenERC721Contract) Approve(ctx contractapi.TransactionContextInterfac
|
|||
return false, fmt.Errorf("failed to get IsApprovedForAll: %v", err)
|
||||
}
|
||||
if owner != sender && !operatorApproval {
|
||||
return false, fmt.Errorf("the sender is not the current owner nor an authorized operator")
|
||||
return false, errors.New("the sender is not the current owner nor an authorized operator")
|
||||
}
|
||||
|
||||
// Update the approved operator of the non-fungible token
|
||||
|
|
@ -188,7 +189,7 @@ func (c *TokenERC721Contract) SetApprovalForAll(ctx contractapi.TransactionConte
|
|||
return false, fmt.Errorf("failed to check if contract is already initialized: %v", err)
|
||||
}
|
||||
if !initialized {
|
||||
return false, fmt.Errorf("Contract options need to be set before calling any function, call Initialize() to initialize contract")
|
||||
return false, errors.New("contract options need to be set before calling any function, call Initialize() to initialize contract")
|
||||
}
|
||||
|
||||
sender64, err := ctx.GetClientIdentity().GetID()
|
||||
|
|
@ -243,7 +244,7 @@ func (c *TokenERC721Contract) IsApprovedForAll(ctx contractapi.TransactionContex
|
|||
return false, fmt.Errorf("failed to check if contract is already initialized: %v", err)
|
||||
}
|
||||
if !initialized {
|
||||
return false, fmt.Errorf("Contract options need to be set before calling any function, call Initialize() to initialize contract")
|
||||
return false, errors.New("contract options need to be set before calling any function, call Initialize() to initialize contract")
|
||||
}
|
||||
|
||||
approvalKey, err := ctx.GetStub().CreateCompositeKey(approvalPrefix, []string{owner, operator})
|
||||
|
|
@ -280,7 +281,7 @@ func (c *TokenERC721Contract) GetApproved(ctx contractapi.TransactionContextInte
|
|||
return "false", fmt.Errorf("failed to check if contract is already initialized: %v", err)
|
||||
}
|
||||
if !initialized {
|
||||
return "false", fmt.Errorf("Contract options need to be set before calling any function, call Initialize() to initialize contract")
|
||||
return "false", errors.New("contract options need to be set before calling any function, call Initialize() to initialize contract")
|
||||
}
|
||||
|
||||
nft, err := _readNFT(ctx, tokenId)
|
||||
|
|
@ -305,7 +306,7 @@ func (c *TokenERC721Contract) TransferFrom(ctx contractapi.TransactionContextInt
|
|||
return false, fmt.Errorf("failed to check if contract is already initialized: %v", err)
|
||||
}
|
||||
if !initialized {
|
||||
return false, fmt.Errorf("Contract options need to be set before calling any function, call Initialize() to initialize contract")
|
||||
return false, errors.New("contract options need to be set before calling any function, call Initialize() to initialize contract")
|
||||
}
|
||||
|
||||
// Get ID of submitting client identity
|
||||
|
|
@ -332,12 +333,12 @@ func (c *TokenERC721Contract) TransferFrom(ctx contractapi.TransactionContextInt
|
|||
return false, fmt.Errorf("failed to get IsApprovedForAll : %v", err)
|
||||
}
|
||||
if owner != sender && operator != sender && !operatorApproval {
|
||||
return false, fmt.Errorf("the sender is not the current owner nor an authorized operator")
|
||||
return false, errors.New("the sender is not the current owner nor an authorized operator")
|
||||
}
|
||||
|
||||
// Check if `from` is the current owner
|
||||
if owner != from {
|
||||
return false, fmt.Errorf("the from is not the current owner")
|
||||
return false, errors.New("the from is not the current owner")
|
||||
}
|
||||
|
||||
// Clear the approved client for this non-fungible token
|
||||
|
|
@ -412,7 +413,7 @@ func (c *TokenERC721Contract) Name(ctx contractapi.TransactionContextInterface)
|
|||
return "", fmt.Errorf("failed to check if contract is already initialized: %v", err)
|
||||
}
|
||||
if !initialized {
|
||||
return "", fmt.Errorf("Contract options need to be set before calling any function, call Initialize() to initialize contract")
|
||||
return "", errors.New("contract options need to be set before calling any function, call Initialize() to initialize contract")
|
||||
}
|
||||
|
||||
bytes, err := ctx.GetStub().GetState(nameKey)
|
||||
|
|
@ -434,7 +435,7 @@ func (c *TokenERC721Contract) Symbol(ctx contractapi.TransactionContextInterface
|
|||
return "", fmt.Errorf("failed to check if contract is already initialized: %v", err)
|
||||
}
|
||||
if !initialized {
|
||||
return "", fmt.Errorf("Contract options need to be set before calling any function, call Initialize() to initialize contract")
|
||||
return "", errors.New("contract options need to be set before calling any function, call Initialize() to initialize contract")
|
||||
}
|
||||
|
||||
bytes, err := ctx.GetStub().GetState(symbolKey)
|
||||
|
|
@ -457,7 +458,7 @@ func (c *TokenERC721Contract) TokenURI(ctx contractapi.TransactionContextInterfa
|
|||
return "", fmt.Errorf("failed to check if contract is already initialized: %v", err)
|
||||
}
|
||||
if !initialized {
|
||||
return "", fmt.Errorf("Contract options need to be set before calling any function, call Initialize() to initialize contract")
|
||||
return "", errors.New("contract options need to be set before calling any function, call Initialize() to initialize contract")
|
||||
}
|
||||
|
||||
nft, err := _readNFT(ctx, tokenId)
|
||||
|
|
@ -519,7 +520,7 @@ func (c *TokenERC721Contract) Initialize(ctx contractapi.TransactionContextInter
|
|||
return false, fmt.Errorf("failed to get clientMSPID: %v", err)
|
||||
}
|
||||
if clientMSPID != "Org1MSP" {
|
||||
return false, fmt.Errorf("client is not authorized to set the name and symbol of the token")
|
||||
return false, errors.New("client is not authorized to set the name and symbol of the token")
|
||||
}
|
||||
|
||||
bytes, err := ctx.GetStub().GetState(nameKey)
|
||||
|
|
@ -527,7 +528,7 @@ func (c *TokenERC721Contract) Initialize(ctx contractapi.TransactionContextInter
|
|||
return false, fmt.Errorf("failed to get Name: %v", err)
|
||||
}
|
||||
if bytes != nil {
|
||||
return false, fmt.Errorf("contract options are already set, client is not authorized to change them")
|
||||
return false, errors.New("contract options are already set, client is not authorized to change them")
|
||||
}
|
||||
|
||||
err = ctx.GetStub().PutState(nameKey, []byte(name))
|
||||
|
|
@ -556,7 +557,7 @@ func (c *TokenERC721Contract) MintWithTokenURI(ctx contractapi.TransactionContex
|
|||
return nil, fmt.Errorf("failed to check if contract is already initialized: %v", err)
|
||||
}
|
||||
if !initialized {
|
||||
return nil, fmt.Errorf("Contract options need to be set before calling any function, call Initialize() to initialize contract")
|
||||
return nil, errors.New("contract options need to be set before calling any function, call Initialize() to initialize contract")
|
||||
}
|
||||
|
||||
// Check minter authorization - this sample assumes Org1 is the issuer with privilege to mint a new token
|
||||
|
|
@ -566,7 +567,7 @@ func (c *TokenERC721Contract) MintWithTokenURI(ctx contractapi.TransactionContex
|
|||
}
|
||||
|
||||
if clientMSPID != "Org1MSP" {
|
||||
return nil, fmt.Errorf("client is not authorized to set the name and symbol of the token")
|
||||
return nil, errors.New("client is not authorized to set the name and symbol of the token")
|
||||
}
|
||||
|
||||
// Get ID of submitting client identity
|
||||
|
|
@ -652,7 +653,7 @@ func (c *TokenERC721Contract) Burn(ctx contractapi.TransactionContextInterface,
|
|||
return false, fmt.Errorf("failed to check if contract is already initialized: %v", err)
|
||||
}
|
||||
if !initialized {
|
||||
return false, fmt.Errorf("Contract options need to be set before calling any function, call Initialize() to initialize contract")
|
||||
return false, errors.New("contract options need to be set before calling any function, call Initialize() to initialize contract")
|
||||
}
|
||||
|
||||
owner64, err := ctx.GetClientIdentity().GetID()
|
||||
|
|
@ -726,7 +727,7 @@ func (c *TokenERC721Contract) ClientAccountBalance(ctx contractapi.TransactionCo
|
|||
return 0, fmt.Errorf("failed to check if contract is already initialized: %v", err)
|
||||
}
|
||||
if !initialized {
|
||||
return 0, fmt.Errorf("Contract options need to be set before calling any function, call Initialize() to initialize contract")
|
||||
return 0, errors.New("contract options need to be set before calling any function, call Initialize() to initialize contract")
|
||||
}
|
||||
|
||||
// Get ID of submitting client identity
|
||||
|
|
@ -757,7 +758,7 @@ func (c *TokenERC721Contract) ClientAccountID(ctx contractapi.TransactionContext
|
|||
return "", fmt.Errorf("failed to check if contract is already initialized: %v", err)
|
||||
}
|
||||
if !initialized {
|
||||
return "", fmt.Errorf("Contract options need to be set before calling any function, call Initialize() to initialize contract")
|
||||
return "", errors.New("contract options need to be set before calling any function, call Initialize() to initialize contract")
|
||||
}
|
||||
|
||||
// Get ID of submitting client identity
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@ import (
|
|||
"encoding/base64"
|
||||
"testing"
|
||||
|
||||
"github.com/hyperledger/fabric-chaincode-go/pkg/cid"
|
||||
"github.com/hyperledger/fabric-chaincode-go/shim"
|
||||
"github.com/hyperledger/fabric-contract-api-go/contractapi"
|
||||
"github.com/hyperledger/fabric-protos-go/ledger/queryresult"
|
||||
"github.com/hyperledger/fabric-chaincode-go/v2/pkg/cid"
|
||||
"github.com/hyperledger/fabric-chaincode-go/v2/shim"
|
||||
"github.com/hyperledger/fabric-contract-api-go/v2/contractapi"
|
||||
"github.com/hyperledger/fabric-protos-go-apiv2/ledger/queryresult"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/mock"
|
||||
|
|
|
|||
|
|
@ -1,39 +1,38 @@
|
|||
module github.com/hyperledger/fabric-samples/token-erc-721/chaincode-go
|
||||
|
||||
go 1.17
|
||||
go 1.21
|
||||
|
||||
require (
|
||||
github.com/hyperledger/fabric-chaincode-go v0.0.0-20230228194215-b84622ba6a7a
|
||||
github.com/hyperledger/fabric-contract-api-go v1.2.1
|
||||
github.com/hyperledger/fabric-protos-go v0.3.0
|
||||
github.com/stretchr/testify v1.8.2
|
||||
github.com/hyperledger/fabric-chaincode-go/v2 v2.0.0-20240618210511-f7903324a8af
|
||||
github.com/hyperledger/fabric-contract-api-go/v2 v2.0.0
|
||||
github.com/hyperledger/fabric-protos-go-apiv2 v0.3.3
|
||||
github.com/stretchr/testify v1.9.0
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/go-openapi/jsonpointer v0.19.5 // indirect
|
||||
github.com/go-openapi/jsonreference v0.20.0 // indirect
|
||||
github.com/go-openapi/spec v0.20.8 // indirect
|
||||
github.com/go-openapi/swag v0.21.1 // indirect
|
||||
github.com/gobuffalo/envy v1.10.1 // indirect
|
||||
github.com/gobuffalo/packd v1.0.1 // indirect
|
||||
github.com/go-openapi/jsonpointer v0.21.0 // indirect
|
||||
github.com/go-openapi/jsonreference v0.21.0 // indirect
|
||||
github.com/go-openapi/spec v0.21.0 // indirect
|
||||
github.com/go-openapi/swag v0.23.0 // indirect
|
||||
github.com/gobuffalo/envy v1.10.2 // indirect
|
||||
github.com/gobuffalo/packd v1.0.2 // indirect
|
||||
github.com/gobuffalo/packr v1.30.1 // indirect
|
||||
github.com/golang/protobuf v1.5.2 // indirect
|
||||
github.com/joho/godotenv v1.4.0 // indirect
|
||||
github.com/joho/godotenv v1.5.1 // indirect
|
||||
github.com/josharian/intern v1.0.0 // indirect
|
||||
github.com/mailru/easyjson v0.7.7 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
github.com/rogpeppe/go-internal v1.8.1 // indirect
|
||||
github.com/stretchr/objx v0.5.0 // indirect
|
||||
github.com/rogpeppe/go-internal v1.12.0 // indirect
|
||||
github.com/stretchr/objx v0.5.2 // indirect
|
||||
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
|
||||
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
|
||||
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
|
||||
golang.org/x/net v0.7.0 // indirect
|
||||
golang.org/x/sys v0.5.0 // indirect
|
||||
golang.org/x/text v0.7.0 // indirect
|
||||
golang.org/x/mod v0.17.0 // indirect
|
||||
golang.org/x/net v0.24.0 // indirect
|
||||
golang.org/x/sys v0.19.0 // indirect
|
||||
golang.org/x/text v0.14.0 // indirect
|
||||
google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect
|
||||
google.golang.org/grpc v1.53.0 // indirect
|
||||
google.golang.org/protobuf v1.28.1 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
google.golang.org/grpc v1.64.0 // indirect
|
||||
google.golang.org/protobuf v1.34.2 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -5,8 +5,8 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"github.com/hyperledger/fabric-contract-api-go/contractapi"
|
||||
"github.com/hyperledger/fabric-contract-api-go/metadata"
|
||||
"github.com/hyperledger/fabric-contract-api-go/v2/contractapi"
|
||||
"github.com/hyperledger/fabric-contract-api-go/v2/metadata"
|
||||
"github.com/hyperledger/fabric-samples/token-erc-721/chaincode-go/chaincode"
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,12 @@
|
|||
package chaincode
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"log"
|
||||
"strconv"
|
||||
|
||||
"github.com/hyperledger/fabric-contract-api-go/contractapi"
|
||||
"github.com/hyperledger/fabric-contract-api-go/v2/contractapi"
|
||||
)
|
||||
|
||||
// SmartContract provides functions for transferring tokens using UTXO transactions
|
||||
|
|
@ -23,7 +24,6 @@ type UTXO struct {
|
|||
// Define key names for options
|
||||
const nameKey = "name"
|
||||
const symbolKey = "symbol"
|
||||
const totalSupplyKey = "totalSupply"
|
||||
|
||||
// Mint creates a new unspent transaction output (UTXO) owned by the minter
|
||||
func (s *SmartContract) Mint(ctx contractapi.TransactionContextInterface, amount int) (*UTXO, error) {
|
||||
|
|
@ -34,7 +34,7 @@ func (s *SmartContract) Mint(ctx contractapi.TransactionContextInterface, amount
|
|||
return nil, fmt.Errorf("failed to check if contract is already initialized: %v", err)
|
||||
}
|
||||
if !initialized {
|
||||
return nil, fmt.Errorf("Contract options need to be set before calling any function, call Initialize() to initialize contract")
|
||||
return nil, errors.New("contract options need to be set before calling any function, call Initialize() to initialize contract")
|
||||
}
|
||||
|
||||
// Check minter authorization - this sample assumes Org1 is the central banker with privilege to mint new tokens
|
||||
|
|
@ -43,7 +43,7 @@ func (s *SmartContract) Mint(ctx contractapi.TransactionContextInterface, amount
|
|||
return nil, fmt.Errorf("failed to get MSPID: %v", err)
|
||||
}
|
||||
if clientMSPID != "Org1MSP" {
|
||||
return nil, fmt.Errorf("client is not authorized to mint new tokens")
|
||||
return nil, errors.New("client is not authorized to mint new tokens")
|
||||
}
|
||||
|
||||
// Get ID of submitting client identity
|
||||
|
|
@ -53,7 +53,7 @@ func (s *SmartContract) Mint(ctx contractapi.TransactionContextInterface, amount
|
|||
}
|
||||
|
||||
if amount <= 0 {
|
||||
return nil, fmt.Errorf("mint amount must be a positive integer")
|
||||
return nil, errors.New("mint amount must be a positive integer")
|
||||
}
|
||||
|
||||
utxo := UTXO{}
|
||||
|
|
@ -63,6 +63,9 @@ func (s *SmartContract) Mint(ctx contractapi.TransactionContextInterface, amount
|
|||
|
||||
// the utxo has a composite key of owner:utxoKey, this enables ClientUTXOs() function to query for an owner's utxos.
|
||||
utxoCompositeKey, err := ctx.GetStub().CreateCompositeKey("utxo", []string{minter, utxo.Key})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = ctx.GetStub().PutState(utxoCompositeKey, []byte(strconv.Itoa(amount)))
|
||||
if err != nil {
|
||||
|
|
@ -83,7 +86,7 @@ func (s *SmartContract) Transfer(ctx contractapi.TransactionContextInterface, ut
|
|||
return nil, fmt.Errorf("failed to check if contract is already initialized: %v", err)
|
||||
}
|
||||
if !initialized {
|
||||
return nil, fmt.Errorf("Contract options need to be set before calling any function, call Initialize() to initialize contract")
|
||||
return nil, errors.New("contract options need to be set before calling any function, call Initialize() to initialize contract")
|
||||
}
|
||||
|
||||
// Get ID of submitting client identity
|
||||
|
|
@ -97,7 +100,7 @@ func (s *SmartContract) Transfer(ctx contractapi.TransactionContextInterface, ut
|
|||
var totalInputAmount int
|
||||
for _, utxoInputKey := range utxoInputKeys {
|
||||
if utxoInputs[utxoInputKey] != nil {
|
||||
return nil, fmt.Errorf("the same utxo input can not be spend twice")
|
||||
return nil, errors.New("the same utxo input can not be spend twice")
|
||||
}
|
||||
|
||||
utxoInputCompositeKey, err := ctx.GetStub().CreateCompositeKey("utxo", []string{clientID, utxoInputKey})
|
||||
|
|
@ -124,6 +127,10 @@ func (s *SmartContract) Transfer(ctx contractapi.TransactionContextInterface, ut
|
|||
}
|
||||
|
||||
totalInputAmount, err = add(totalInputAmount, amount)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
utxoInputs[utxoInputKey] = utxoInput
|
||||
}
|
||||
|
||||
|
|
@ -133,12 +140,15 @@ func (s *SmartContract) Transfer(ctx contractapi.TransactionContextInterface, ut
|
|||
for i, utxoOutput := range utxoOutputs {
|
||||
|
||||
if utxoOutput.Amount <= 0 {
|
||||
return nil, fmt.Errorf("utxo output amount must be a positive integer")
|
||||
return nil, errors.New("utxo output amount must be a positive integer")
|
||||
}
|
||||
|
||||
utxoOutputs[i].Key = fmt.Sprintf("%s.%d", txID, i)
|
||||
|
||||
totalOutputAmount, err = add(totalOutputAmount, utxoOutput.Amount)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
// Validate total inputs equals total outputs
|
||||
|
|
@ -187,7 +197,7 @@ func (s *SmartContract) ClientUTXOs(ctx contractapi.TransactionContextInterface)
|
|||
return nil, fmt.Errorf("failed to check if contract is already initialized: %v", err)
|
||||
}
|
||||
if !initialized {
|
||||
return nil, fmt.Errorf("Contract options need to be set before calling any function, call Initialize() to initialize contract")
|
||||
return nil, errors.New("contract options need to be set before calling any function, call Initialize() to initialize contract")
|
||||
}
|
||||
|
||||
// Get ID of submitting client identity
|
||||
|
|
@ -217,7 +227,7 @@ func (s *SmartContract) ClientUTXOs(ctx contractapi.TransactionContextInterface)
|
|||
}
|
||||
|
||||
if len(compositeKeyParts) != 2 {
|
||||
return nil, fmt.Errorf("expected composite key with two parts (owner:utxoKey)")
|
||||
return nil, errors.New("expected composite key with two parts (owner:utxoKey)")
|
||||
}
|
||||
|
||||
utxoKey := compositeKeyParts[1] // owner is at [0], utxoKey is at[1]
|
||||
|
|
@ -249,7 +259,7 @@ func (s *SmartContract) ClientID(ctx contractapi.TransactionContextInterface) (s
|
|||
return "", fmt.Errorf("failed to check if contract is already initialized: %v", err)
|
||||
}
|
||||
if !initialized {
|
||||
return "", fmt.Errorf("Contract options need to be set before calling any function, call Initialize() to initialize contract")
|
||||
return "", errors.New("contract options need to be set before calling any function, call Initialize() to initialize contract")
|
||||
}
|
||||
|
||||
// Get ID of submitting client identity
|
||||
|
|
@ -272,7 +282,7 @@ func (s *SmartContract) Name(ctx contractapi.TransactionContextInterface) (strin
|
|||
return "", fmt.Errorf("failed to check if contract is already initialized: %v", err)
|
||||
}
|
||||
if !initialized {
|
||||
return "", fmt.Errorf("Contract options need to be set before calling any function, call Initialize() to initialize contract")
|
||||
return "", errors.New("contract options need to be set before calling any function, call Initialize() to initialize contract")
|
||||
}
|
||||
|
||||
bytes, err := ctx.GetStub().GetState(nameKey)
|
||||
|
|
@ -294,7 +304,7 @@ func (s *SmartContract) Symbol(ctx contractapi.TransactionContextInterface) (str
|
|||
return "", fmt.Errorf("failed to check if contract is already initialized: %v", err)
|
||||
}
|
||||
if !initialized {
|
||||
return "", fmt.Errorf("Contract options need to be set before calling any function, call Initialize() to initialize contract")
|
||||
return "", errors.New("contract options need to be set before calling any function, call Initialize() to initialize contract")
|
||||
}
|
||||
|
||||
bytes, err := ctx.GetStub().GetState(symbolKey)
|
||||
|
|
@ -316,7 +326,7 @@ func (s *SmartContract) Initialize(ctx contractapi.TransactionContextInterface,
|
|||
return false, fmt.Errorf("failed to get MSPID: %v", err)
|
||||
}
|
||||
if clientMSPID != "Org1MSP" {
|
||||
return false, fmt.Errorf("client is not authorized to initialize contract")
|
||||
return false, errors.New("client is not authorized to initialize contract")
|
||||
}
|
||||
|
||||
// check contract options are not already set, client is not authorized to change them once intitialized
|
||||
|
|
@ -325,7 +335,7 @@ func (s *SmartContract) Initialize(ctx contractapi.TransactionContextInterface,
|
|||
return false, fmt.Errorf("failed to get Name: %v", err)
|
||||
}
|
||||
if bytes != nil {
|
||||
return false, fmt.Errorf("contract options are already set, client is not authorized to change them")
|
||||
return false, errors.New("contract options are already set, client is not authorized to change them")
|
||||
}
|
||||
|
||||
err = ctx.GetStub().PutState(nameKey, []byte(name))
|
||||
|
|
@ -359,11 +369,10 @@ func checkInitialized(ctx contractapi.TransactionContextInterface) (bool, error)
|
|||
func add(b int, q int) (int, error) {
|
||||
|
||||
// Check overflow
|
||||
var sum int
|
||||
sum = q + b
|
||||
sum := q + b
|
||||
|
||||
if (sum < q) == (b >= 0 && q >= 0) {
|
||||
return 0, fmt.Errorf("Math: addition overflow occurred %d + %d", b, q)
|
||||
return 0, fmt.Errorf("math: addition overflow occurred %d + %d", b, q)
|
||||
}
|
||||
|
||||
return sum, nil
|
||||
|
|
|
|||
|
|
@ -1,32 +1,32 @@
|
|||
module github.com/hyperledger/fabric-samples/token-utxo/chaincode-go
|
||||
|
||||
go 1.17
|
||||
go 1.21
|
||||
|
||||
require github.com/hyperledger/fabric-contract-api-go v1.2.1
|
||||
require github.com/hyperledger/fabric-contract-api-go/v2 v2.0.0
|
||||
|
||||
require (
|
||||
github.com/go-openapi/jsonpointer v0.19.5 // indirect
|
||||
github.com/go-openapi/jsonreference v0.20.0 // indirect
|
||||
github.com/go-openapi/spec v0.20.8 // indirect
|
||||
github.com/go-openapi/swag v0.21.1 // indirect
|
||||
github.com/gobuffalo/envy v1.10.1 // indirect
|
||||
github.com/gobuffalo/packd v1.0.1 // indirect
|
||||
github.com/go-openapi/jsonpointer v0.21.0 // indirect
|
||||
github.com/go-openapi/jsonreference v0.21.0 // indirect
|
||||
github.com/go-openapi/spec v0.21.0 // indirect
|
||||
github.com/go-openapi/swag v0.23.0 // indirect
|
||||
github.com/gobuffalo/envy v1.10.2 // indirect
|
||||
github.com/gobuffalo/packd v1.0.2 // indirect
|
||||
github.com/gobuffalo/packr v1.30.1 // indirect
|
||||
github.com/golang/protobuf v1.5.2 // indirect
|
||||
github.com/hyperledger/fabric-chaincode-go v0.0.0-20230228194215-b84622ba6a7a // indirect
|
||||
github.com/hyperledger/fabric-protos-go v0.3.0 // indirect
|
||||
github.com/joho/godotenv v1.4.0 // indirect
|
||||
github.com/hyperledger/fabric-chaincode-go/v2 v2.0.0-20240618210511-f7903324a8af // indirect
|
||||
github.com/hyperledger/fabric-protos-go-apiv2 v0.3.3 // indirect
|
||||
github.com/joho/godotenv v1.5.1 // indirect
|
||||
github.com/josharian/intern v1.0.0 // indirect
|
||||
github.com/mailru/easyjson v0.7.7 // indirect
|
||||
github.com/rogpeppe/go-internal v1.8.1 // indirect
|
||||
github.com/rogpeppe/go-internal v1.12.0 // indirect
|
||||
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
|
||||
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
|
||||
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
|
||||
golang.org/x/net v0.7.0 // indirect
|
||||
golang.org/x/sys v0.5.0 // indirect
|
||||
golang.org/x/text v0.7.0 // indirect
|
||||
golang.org/x/mod v0.17.0 // indirect
|
||||
golang.org/x/net v0.24.0 // indirect
|
||||
golang.org/x/sys v0.19.0 // indirect
|
||||
golang.org/x/text v0.14.0 // indirect
|
||||
google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect
|
||||
google.golang.org/grpc v1.53.0 // indirect
|
||||
google.golang.org/protobuf v1.28.1 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
google.golang.org/grpc v1.64.0 // indirect
|
||||
google.golang.org/protobuf v1.34.2 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -7,7 +7,7 @@ package main
|
|||
import (
|
||||
"log"
|
||||
|
||||
"github.com/hyperledger/fabric-contract-api-go/contractapi"
|
||||
"github.com/hyperledger/fabric-contract-api-go/v2/contractapi"
|
||||
"github.com/hyperledger/fabric-samples/token-utxo/chaincode-go/chaincode"
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue