Skip to content

Commit 20d8abd

Browse files
committed
- updated syntax
1 parent bcbc8f9 commit 20d8abd

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ npm install ibm-blockchain-js
3434

3535
```js
3636
// The functions below need to exist in your actual chaincode GoLang file(s)
37-
chaincode.query.read('a', cb); //will read variable "a" from current chaincode state
38-
chaincode.invoke.write('a', "test", cb) //will write to variable "a"
39-
chaincode.invoke.remove('a', cb) //will delete variable "a"
40-
chaincode.invoke.init_marbles(ARGS, cb); //calls my custom chaincode function init_marbles() and passes it ARGS
37+
chaincode.query.read(['a'], cb); //will read variable "a" from current chaincode state
38+
chaincode.invoke.write(['a', 'test'], cb); //will write to variable "a"
39+
chaincode.invoke.remove(['a'], cb); //will delete variable "a"
40+
chaincode.invoke.init_marbles([ARGS], cb); //calls my custom chaincode function init_marbles() and passes it ARGS
4141
```
4242

4343
## Example
@@ -70,8 +70,8 @@ npm install ibm-blockchain-js
7070
},
7171
chaincode:{
7272
zip_url: 'https://github.com/ibm-blockchain/marbles-chaincode/archive/master.zip',
73-
unzip_dir: 'marbles-chaincode-master/part2',
74-
git_url: 'https://github.com/ibm-blockchain/marbles-chaincode/part2'
73+
unzip_dir: 'marbles-chaincode-master/part2_v1.0.0',
74+
git_url: 'https://github.com/ibm-blockchain/marbles-chaincode/part2_v1.0.0'
7575
}
7676
};
7777

@@ -96,7 +96,7 @@ npm install ibm-blockchain-js
9696
// Step 5 ==================================
9797
function cb_deployed(err){
9898
console.log('sdk has deployed code and waited');
99-
chaincode.query.read('a');
99+
chaincode.query.read(['a']);
100100
}
101101
```
102102

@@ -115,7 +115,7 @@ Examples:
115115
chaincode.read('a');
116116

117117
//new code
118-
chaincode.query.read('a');
118+
chaincode.query.read(['a']);
119119
```
120120

121121
**invoke changes** - name change
@@ -189,8 +189,8 @@ Options Parameter:
189189
},
190190
chaincode:{
191191
zip_url: 'https://github.com/ibm-blockchain/marbles-chaincode/archive/master.zip', //http/https of a link to download zip
192-
unzip_dir: 'marbles-chaincode-master/part2', //name/path to folder that contains the chaincode you want to deploy (path relative to unzipped root)
193-
git_url: 'https://github.com/ibm-blockchain/marbles-chaincode/part2', //git https URL. should point to the desired chaincode repo AND directory
192+
unzip_dir: 'marbles-chaincode-master/part2_v1.0.0', //name/path to folder that contains the chaincode you want to deploy (path relative to unzipped root)
193+
git_url: 'https://github.com/ibm-blockchain/marbles-chaincode/part2_v1.0.0', //git https URL. should point to the desired chaincode repo AND directory
194194

195195
deployed_name: null //[optional] this is the hashed name of a deployed chaincode. if you want to run with chaincode that is already deployed set it now, else it will be set when you deploy with the sdk
196196
}
@@ -209,8 +209,8 @@ Example
209209
```js
210210
var options = {
211211
zip_url: 'https://github.com/ibm-blockchain/marbles-chaincode/archive/master.zip', //http/https of a link to download zip
212-
unzip_dir: 'marbles-chaincode-master/part2', //name/path to folder that contains the chaincode you want to deploy (path relative to unzipped root)
213-
git_url: 'https://github.com/ibm-blockchain/marbles-chaincode/part2', //git https URL. should point to the desired chaincode repo AND directory
212+
unzip_dir: 'marbles-chaincode-master/part2_v1.0.0', //name/path to folder that contains the chaincode you want to deploy (path relative to unzipped root)
213+
git_url: 'https://github.com/ibm-blockchain/marbles-chaincode/part2_v1.0.0', //git https URL. should point to the desired chaincode repo AND directory
214214

215215
deployed_name: null //[optional] this is the hashed name of a deployed chaincode. if you want to run with chaincode that is already deployed set it now, else it will be set when you deploy with the sdk
216216
};
@@ -467,7 +467,7 @@ I found it handy in niche cases, but it will probably be unhelpful to most devel
467467
{
468468
"query": []
469469
},
470-
"git_url": 'https://github.com/ibm-blockchain/marbles-chaincode/part2'
470+
"git_url": 'https://github.com/ibm-blockchain/marbles-chaincode/part2_v1.0.0'
471471
"peers": [{
472472
"name": "vp1-xxx.xxx.xxx.xxx",
473473
"api_host": "xxx.xxx.xxx.xxx",
@@ -481,7 +481,7 @@ I found it handy in niche cases, but it will probably be unhelpful to most devel
481481
"enrollId": "user_type1_xxx",
482482
"enrollSecret": "xxx"
483483
}],
484-
"unzip_dir": 'marbles-chaincode-master/part2',
484+
"unzip_dir": 'marbles-chaincode-master/part2_v1.0.0',
485485
"zip_url": 'https://github.com/ibm-blockchain/marbles-chaincode/archive/master.zip',
486486
"options": {}
487487
}

index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ ibc.prototype.block_stats = function(id, cb){
511511
//============================================================================================================================
512512
//read() - read generic variable from chaincode state - ! [legacy. do not use it anymore 4/1/2016]
513513
//============================================================================================================================
514-
function read(name, enrollId, cb){
514+
function read(args, enrollId, cb){
515515
if(typeof enrollId === 'function'){ //if cb is in 2nd param use known enrollId
516516
cb = enrollId;
517517
enrollId = ibc.chaincode.details.peers[ibc.selectedPeer].enrollID;
@@ -531,7 +531,7 @@ function read(name, enrollId, cb){
531531
},
532532
ctorMsg: {
533533
function: 'query',
534-
args: [name]
534+
args: args
535535
},
536536
secureContext: enrollId
537537
}
@@ -556,7 +556,7 @@ ibc.prototype.register = function(index, enrollID, enrollSecret, maxRetry, cb) {
556556
};
557557

558558
function register(index, enrollID, enrollSecret, maxRetry, attempt, cb){
559-
console.log(maxRetry, '[ibc-js] Registering ', ibc.chaincode.details.peers[index].name, ' w/enrollID - ' + enrollID);
559+
console.log('[ibc-js] Registering ', ibc.chaincode.details.peers[index].name, ' w/enrollID - ' + enrollID);
560560
var options = {
561561
path: '/registrar',
562562
host: ibc.chaincode.details.peers[index].api_host,

0 commit comments

Comments
 (0)