@@ -159,14 +159,13 @@ proc ::fabric::deploy {i_peer i_user i_chaincode i_fn i_args {i_retry 0}} {
159
159
" path" : " $i_chaincode "
160
160
},
161
161
" ctorMsg" : {
162
- " function" : " $i_fn " ,
163
162
" args" : [$args ]
164
163
},
165
164
" secureContext" : " $i_user "
166
165
}
167
166
}
168
167
169
- set args [argify $i_args ]
168
+ set args [argify $i_fn $ i_args ]
170
169
set query [subst -nocommand $template ]
171
170
172
171
return [devops $i_peer deploy $query $i_retry ]
@@ -191,14 +190,13 @@ proc ::fabric::devModeDeploy {i_peer i_user i_chaincode i_fn i_args {i_retry 0}}
191
190
" name" : " $i_chaincode "
192
191
},
193
192
" ctorMsg" : {
194
- " function" : " $i_fn " ,
195
193
" args" : [$args ]
196
194
},
197
195
" secureContext" : " $i_user "
198
196
}
199
197
}
200
198
201
- set args [argify $i_args ]
199
+ set args [argify $i_fn $ i_args ]
202
200
set query [subst -nocommand $template ]
203
201
204
202
return [devops $i_peer deploy $query $i_retry ]
@@ -227,15 +225,14 @@ proc ::fabric::invoke {i_peer i_user i_chaincodeName i_fn i_args {i_retry 0}} {
227
225
" name" : " $i_chaincodeName "
228
226
},
229
227
" ctorMsg" : {
230
- " function" : " $i_fn " ,
231
228
" args" : [$args ]
232
229
},
233
230
" secureContext" : " $i_user "
234
231
}
235
232
}
236
233
}
237
234
238
- set args [argify $i_args ]
235
+ set args [argify $i_fn $ i_args ]
239
236
set query [subst -nocommand $template ]
240
237
241
238
return [devops $i_peer invoke $query $i_retry ]
@@ -265,15 +262,14 @@ proc ::fabric::query {i_peer i_user i_chaincodeName i_fn i_args {i_retry 0}} {
265
262
" name" : " $i_chaincodeName "
266
263
},
267
264
" ctorMsg" : {
268
- " function" : " $i_fn " ,
269
265
" args" : [$args ]
270
266
},
271
267
" secureContext" : " $i_user "
272
268
}
273
269
}
274
270
}
275
271
276
- set args [argify $i_args ]
272
+ set args [argify $i_fn $ i_args ]
277
273
set query [subst -nocommand $template ]
278
274
279
275
return [devops $i_peer query $query $i_retry ]
@@ -432,19 +428,21 @@ proc ::fabric::caLogin {i_peer i_user i_secret} {
432
428
433
429
434
430
# ###########################################################################
435
- # argify i_args
431
+ # argify i_fn i_args
436
432
437
- # Convert a Tcl list to a list of quoted arguments with commas to satisfy the
438
- # JSON format. This needs to be done as a string (rather than as a list),
439
- # otherwise it will be {} quoted when substituted.
433
+ # Convert old-style fn + args pair into a list of quoted base64 arguments with
434
+ # commas to satisfy the most recent JSON format of the REST API. This needs to
435
+ # be done as a string (rather than as a list), otherwise it will be {} quoted
436
+ # when substituted.
440
437
441
- proc ::fabric::argify {i_args} {
438
+ proc ::fabric::argify {i_fn i_args} {
442
439
443
- set args " "
440
+ set args [concat $i_fn $i_args ]
441
+ set args64 " "
444
442
set comma " "
445
- foreach arg $i_args {
446
- set args " $args $comma \" $arg \" "
443
+ foreach arg $args {
444
+ set args64 " $args64 $comma \" [ binary encode base64 $arg ] \" "
447
445
set comma ,
448
446
}
449
- return $args
447
+ return $args64
450
448
}
0 commit comments