Skip to content
This repository was archived by the owner on Feb 9, 2021. It is now read-only.

Commit aecaced

Browse files
committed
Import release v0.9.0
This is a legacy import of the release originally managed in pure github. You may find the history of this release in the archives here: https://github.com/hyperledger-archives/fabric-chaintool/releases/tag/v0.9.0 Change-Id: I7f35c837293f235a2ad6fc560b4f22beabd9868b Signed-off-by: Gregory Haskins <gregory.haskins@gmail.com>
1 parent f92acb3 commit aecaced

File tree

7 files changed

+30
-30
lines changed

7 files changed

+30
-30
lines changed

documentation/platforms/golang/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ queries {
7373
```
7474
requires a function signature that looks like:
7575
```
76-
func (t *ChaincodeExample) CheckBalance(stub *shim.ChaincodeStub, param *example02.Entity) (*example02.BalanceResult, error) {}
76+
func (t *ChaincodeExample) CheckBalance(stub shim.ChaincodeStubInterface, param *example02.Entity) (*example02.BalanceResult, error) {}
7777
```
78-
Every callback requires a shim.ChaincodeStub pointer as its first parameter, followed by an input parameter and return parameter as declared in the interface definition. Functions that return _void_ simply return a single _error_ rather than _(type, error)_.
78+
Every callback requires a shim.ChaincodeStubInterface as its first parameter, followed by an input parameter and return parameter as declared in the interface definition. Functions that return _void_ simply return a single _error_ rather than _(type, error)_.
7979
## Generated Code File Structure
8080
### Overview
8181
All generated code is placed in directories rooted at $PROJECT_ROOT/build which, as mentioned earlier, is implicitly included in the $GOPATH. Interfaces are emitted to $PROJECT_ROOT/build/src/hyperledger/cci/..., and general chaincode support stubs are emitted to $PROJECT_ROOT/build/src/hyperledger/ccs.

examples/example02/app/src/chaincode/chaincode_example02.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ type ChaincodeExample struct {
3636
}
3737

3838
// Called to initialize the chaincode
39-
func (t *ChaincodeExample) Init(stub *shim.ChaincodeStub, param *appinit.Init) error {
39+
func (t *ChaincodeExample) Init(stub shim.ChaincodeStubInterface, param *appinit.Init) error {
4040

4141
var err error
4242

@@ -57,7 +57,7 @@ func (t *ChaincodeExample) Init(stub *shim.ChaincodeStub, param *appinit.Init) e
5757
}
5858

5959
// Transaction makes payment of X units from A to B
60-
func (t *ChaincodeExample) MakePayment(stub *shim.ChaincodeStub, param *example02.PaymentParams) error {
60+
func (t *ChaincodeExample) MakePayment(stub shim.ChaincodeStubInterface, param *example02.PaymentParams) error {
6161

6262
var err error
6363

@@ -93,7 +93,7 @@ func (t *ChaincodeExample) MakePayment(stub *shim.ChaincodeStub, param *example0
9393
}
9494

9595
// Deletes an entity from state
96-
func (t *ChaincodeExample) DeleteAccount(stub *shim.ChaincodeStub, param *example02.Entity) error {
96+
func (t *ChaincodeExample) DeleteAccount(stub shim.ChaincodeStubInterface, param *example02.Entity) error {
9797

9898
// Delete the key from the state in ledger
9999
err := stub.DelState(param.Id)
@@ -105,7 +105,7 @@ func (t *ChaincodeExample) DeleteAccount(stub *shim.ChaincodeStub, param *exampl
105105
}
106106

107107
// Query callback representing the query of a chaincode
108-
func (t *ChaincodeExample) CheckBalance(stub *shim.ChaincodeStub, param *example02.Entity) (*example02.BalanceResult, error) {
108+
func (t *ChaincodeExample) CheckBalance(stub shim.ChaincodeStubInterface, param *example02.Entity) (*example02.BalanceResult, error) {
109109
var err error
110110

111111
// Get the state from the ledger
@@ -134,11 +134,11 @@ func main() {
134134
//-------------------------------------------------
135135
// Helpers
136136
//-------------------------------------------------
137-
func (t *ChaincodeExample) PutState(stub *shim.ChaincodeStub, party *appinit.Party) error {
137+
func (t *ChaincodeExample) PutState(stub shim.ChaincodeStubInterface, party *appinit.Party) error {
138138
return stub.PutState(party.Entity, []byte(strconv.Itoa(int(party.Value))))
139139
}
140140

141-
func (t *ChaincodeExample) GetState(stub *shim.ChaincodeStub, entity string) (int, error) {
141+
func (t *ChaincodeExample) GetState(stub shim.ChaincodeStubInterface, entity string) (int, error) {
142142
bytes, err := stub.GetState(entity)
143143
if err != nil {
144144
return 0, errors.New("Failed to get state")

examples/invoker/src/chaincode/chaincode.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ type ChaincodeExample struct {
3333
}
3434

3535
// Called to initialize the chaincode
36-
func (t *ChaincodeExample) Init(stub *shim.ChaincodeStub, param *appinit.Init) error {
36+
func (t *ChaincodeExample) Init(stub shim.ChaincodeStubInterface, param *appinit.Init) error {
3737

3838
var err error
3939

@@ -47,7 +47,7 @@ func (t *ChaincodeExample) Init(stub *shim.ChaincodeStub, param *appinit.Init) e
4747
}
4848

4949
// Transaction makes payment of X units from A to B
50-
func (t *ChaincodeExample) MakePayment(stub *shim.ChaincodeStub, param *example02.PaymentParams) error {
50+
func (t *ChaincodeExample) MakePayment(stub shim.ChaincodeStubInterface, param *example02.PaymentParams) error {
5151

5252
var err error
5353

@@ -61,7 +61,7 @@ func (t *ChaincodeExample) MakePayment(stub *shim.ChaincodeStub, param *example0
6161
}
6262

6363
// Deletes an entity from state
64-
func (t *ChaincodeExample) DeleteAccount(stub *shim.ChaincodeStub, param *example02.Entity) error {
64+
func (t *ChaincodeExample) DeleteAccount(stub shim.ChaincodeStubInterface, param *example02.Entity) error {
6565

6666
var err error
6767

@@ -75,7 +75,7 @@ func (t *ChaincodeExample) DeleteAccount(stub *shim.ChaincodeStub, param *exampl
7575
}
7676

7777
// Query callback representing the query of a chaincode
78-
func (t *ChaincodeExample) CheckBalance(stub *shim.ChaincodeStub, param *example02.Entity) (*example02.BalanceResult, error) {
78+
func (t *ChaincodeExample) CheckBalance(stub shim.ChaincodeStubInterface, param *example02.Entity) (*example02.BalanceResult, error) {
7979

8080
var err error
8181

examples/parameterless/src/chaincode/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ type ChaincodeExample struct {
3333
}
3434

3535
// Called to initialize the chaincode
36-
func (t *ChaincodeExample) Init(stub *shim.ChaincodeStub, param *appinit.Init) error {
36+
func (t *ChaincodeExample) Init(stub shim.ChaincodeStubInterface, param *appinit.Init) error {
3737

3838
return nil
3939
}
4040

41-
func (t *ChaincodeExample) TestParameterless(stub *shim.ChaincodeStub) (*app.MyReturnType, error) {
41+
func (t *ChaincodeExample) TestParameterless(stub shim.ChaincodeStubInterface) (*app.MyReturnType, error) {
4242
return nil, nil
4343
}
4444

examples/sample_syscc/sample_syscc.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import (
2828
type SampleSysCC struct {
2929
}
3030

31-
func (t *SampleSysCC) Init(stub *shim.ChaincodeStub, function string, args []string) ([]byte, error) {
31+
func (t *SampleSysCC) Init(stub shim.ChaincodeStubInterface, function string, args []string) ([]byte, error) {
3232
var key, val string // Entities
3333

3434
if len(args) != 2 {
@@ -48,7 +48,7 @@ func (t *SampleSysCC) Init(stub *shim.ChaincodeStub, function string, args []str
4848
}
4949

5050
// Transaction makes payment of X units from A to B
51-
func (t *SampleSysCC) Invoke(stub *shim.ChaincodeStub, function string, args []string) ([]byte, error) {
51+
func (t *SampleSysCC) Invoke(stub shim.ChaincodeStubInterface, function string, args []string) ([]byte, error) {
5252
var key, val string // Entities
5353

5454
if len(args) != 2 {
@@ -75,7 +75,7 @@ func (t *SampleSysCC) Invoke(stub *shim.ChaincodeStub, function string, args []s
7575
}
7676

7777
// Query callback representing the query of a chaincode
78-
func (t *SampleSysCC) Query(stub *shim.ChaincodeStub, function string, args []string) ([]byte, error) {
78+
func (t *SampleSysCC) Query(stub shim.ChaincodeStubInterface, function string, args []string) ([]byte, error) {
7979
if function != "getval" {
8080
return nil, errors.New("Invalid query function name. Expecting \"getval\"")
8181
}

project.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
(defproject chaintool "0.8.1"
1+
(defproject chaintool "0.9.0"
22
:description "hyperledger chaincode tool"
33
:url "https://github.com/ghaskins/chaintool"
44
:license {:name "Apache License"

resources/generators/golang.stg

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ var txnre = regexp.MustCompile("([a-zA-Z0-9.]*)/txn/([0-9]*)")
3535
var queryre = regexp.MustCompile("([a-zA-Z0-9.]*)/query/([0-9]*)")
3636

3737
// Initialization function, called only once
38-
func (self *stubHandler) Init(stub *shim.ChaincodeStub, function string, args []string) ([]byte, error) {
38+
func (self *stubHandler) Init(stub shim.ChaincodeStubInterface, function string, args []string) ([]byte, error) {
3939

4040
if len(args) != 1 {
4141
return nil, errors.New("Expected exactly one argument")
@@ -146,8 +146,8 @@ import (
146146
)
147147

148148
type Dispatcher interface {
149-
DispatchTxn(stub *shim.ChaincodeStub, function int, params string) ([]byte, error)
150-
DispatchQuery(stub *shim.ChaincodeStub, function int, params string) ([]byte, error)
149+
DispatchTxn(stub shim.ChaincodeStubInterface, function int, params string) ([]byte, error)
150+
DispatchQuery(stub shim.ChaincodeStubInterface, function int, params string) ([]byte, error)
151151
}
152152

153153
type Factory interface {
@@ -206,7 +206,7 @@ var facts = &meta.Facts {
206206
type ChaincodeMetaData struct {
207207
}
208208

209-
func (self *ChaincodeMetaData) GetInterfaces(stub *shim.ChaincodeStub, params *meta.GetInterfacesParams) (*meta.Interfaces, error) {
209+
func (self *ChaincodeMetaData) GetInterfaces(stub shim.ChaincodeStubInterface, params *meta.GetInterfacesParams) (*meta.Interfaces, error) {
210210

211211
response := &meta.Interfaces{}
212212
for name, data := range interfaces {
@@ -222,7 +222,7 @@ func (self *ChaincodeMetaData) GetInterfaces(stub *shim.ChaincodeStub, params *m
222222
return response, nil
223223
}
224224

225-
func (self *ChaincodeMetaData) GetInterface(stub *shim.ChaincodeStub, params *meta.GetInterfaceParams) (*meta.InterfaceDescriptor, error) {
225+
func (self *ChaincodeMetaData) GetInterface(stub shim.ChaincodeStubInterface, params *meta.GetInterfaceParams) (*meta.InterfaceDescriptor, error) {
226226

227227
intf, ok := interfaces[params.Name]
228228
if !ok {
@@ -232,7 +232,7 @@ func (self *ChaincodeMetaData) GetInterface(stub *shim.ChaincodeStub, params *me
232232
return &meta.InterfaceDescriptor{Data: intf}, nil
233233
}
234234

235-
func (self *ChaincodeMetaData) GetFacts(stub *shim.ChaincodeStub, params *meta.GetFactsParams) (*meta.Facts, error) {
235+
func (self *ChaincodeMetaData) GetFacts(stub shim.ChaincodeStubInterface, params *meta.GetFactsParams) (*meta.Facts, error) {
236236

237237
return facts, nil
238238
}
@@ -284,7 +284,7 @@ func (self *factoryImpl) Create(intf interface{}) (api.Dispatcher, error) {
284284
return &stubImpl{intf: intf.(CCInterface)}, nil
285285
}
286286

287-
func (self *stubImpl) DispatchTxn(stub *shim.ChaincodeStub, function int, params string) ([]byte, error) {
287+
func (self *stubImpl) DispatchTxn(stub shim.ChaincodeStubInterface, function int, params string) ([]byte, error) {
288288
// Handle different functions
289289
switch {
290290
<dispatchfunctions(true, intf, intf.transactions)>
@@ -293,7 +293,7 @@ func (self *stubImpl) DispatchTxn(stub *shim.ChaincodeStub, function int, params
293293
}
294294
}
295295

296-
func (self *stubImpl) DispatchQuery(stub *shim.ChaincodeStub, function int, params string) ([]byte, error) {
296+
func (self *stubImpl) DispatchQuery(stub shim.ChaincodeStubInterface, function int, params string) ([]byte, error) {
297297
// Handle different functions
298298
switch {
299299
<dispatchfunctions(true, intf, intf.queries)>
@@ -352,7 +352,7 @@ dispatchfunctions(txn, intf, functions) ::= "<functions.values:{x | <dispatchfun
352352

353353
declarefunctions(intf, functions) ::=
354354
<<
355-
<functions.values:{x | <x.name>(*shim.ChaincodeStub<if(x.param)>, *<x.param><endif>) <if(x.rettype)>(*<x.rettype>, error)<else>error<endif> }; separator="\n">
355+
<functions.values:{x | <x.name>(shim.ChaincodeStubInterface<if(x.param)>, *<x.param><endif>) <if(x.rettype)>(*<x.rettype>, error)<else>error<endif> }; separator="\n">
356356
>>
357357

358358
dispatchfunction(txn, intf, func) ::=
@@ -363,7 +363,7 @@ case function == <func.index>:
363363

364364
implementhandler(txn) ::=
365365
<<
366-
func (self *stubHandler) <if(txn)>Invoke<else>Query<endif>(stub *shim.ChaincodeStub, function string, args []string) ([]byte, error) {
366+
func (self *stubHandler) <if(txn)>Invoke<else>Query<endif>(stub shim.ChaincodeStubInterface, function string, args []string) ([]byte, error) {
367367

368368
var params string;
369369

@@ -383,7 +383,7 @@ func (self *stubHandler) <if(txn)>Invoke<else>Query<endif>(stub *shim.ChaincodeS
383383
implementserver(intf, func) ::=
384384
<<
385385

386-
func (self *stubImpl) proxy<func.name>(stub *shim.ChaincodeStub, _params string) ([]byte, error) {
386+
func (self *stubImpl) proxy<func.name>(stub shim.ChaincodeStubInterface, _params string) ([]byte, error) {
387387

388388
var err error;
389389

@@ -421,7 +421,7 @@ func (self *stubImpl) proxy<func.name>(stub *shim.ChaincodeStub, _params string)
421421
implementclient(txn, intf, func) ::=
422422
<<
423423

424-
func <func.name>(stub *shim.ChaincodeStub, chaincodeName string<if(func.param)>, params *<func.param><endif>) <\\>
424+
func <func.name>(stub shim.ChaincodeStubInterface, chaincodeName string<if(func.param)>, params *<func.param><endif>) <\\>
425425
<if(func.rettype)>(*<func.rettype>, error)<else>error<endif> {
426426

427427
args := make([]string, 1)

0 commit comments

Comments
 (0)