Skip to content

Commit c857604

Browse files
committed
Changes as per comments
Signed-off-by: sandeep.nishad1 <[email protected]>
1 parent 97d79ca commit c857604

File tree

11 files changed

+38
-36
lines changed

11 files changed

+38
-36
lines changed

core/network/fabric-interop-cc/contracts/interop/handle_external_request.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ func (s *SmartContract) HandleExternalRequest(ctx contractapi.TransactionContext
112112
resp := ""
113113
if viewAddress.CCFunc == "GetHTLCHash" {
114114
if len(viewAddress.Args) > 2 {
115-
errorMessage := fmt.Sprintf("Recieved more arguments than required 1 argument.")
115+
errorMessage := fmt.Sprintf("Recieved more arguments than required 2 argument.")
116116
log.Error(errorMessage)
117117
return "", errors.New(errorMessage)
118118
}
@@ -124,22 +124,22 @@ func (s *SmartContract) HandleExternalRequest(ctx contractapi.TransactionContext
124124
return "", errors.New(errorMessage)
125125
}
126126
resp, err = s.GetHTLCHashByContractId(ctx, viewAddress.Args[0])
127-
} else if viewAddress.CCFunc == "GetHTLCHashPreImageByContractId" {
128-
if len(viewAddress.Args) > 1 {
129-
errorMessage := fmt.Sprintf("Recieved more arguments than required 1 argument.")
127+
} else if viewAddress.CCFunc == "GetHTLCHashPreImage" {
128+
if len(viewAddress.Args) > 2 {
129+
errorMessage := fmt.Sprintf("Recieved more arguments than required 2 argument.")
130130
log.Error(errorMessage)
131131
return "", errors.New(errorMessage)
132132
}
133-
resp, err = s.GetHTLCHashPreImageByContractId(ctx, viewAddress.Args[0])
134-
} else if viewAddress.CCFunc == "GetHTLCHashPreImage" {
135-
if len(viewAddress.Args) > 2 {
133+
resp, err = s.GetHTLCHashPreImage(ctx, viewAddress.Args[0], viewAddress.Args[1])
134+
} else if viewAddress.CCFunc == "GetHTLCHashPreImageByContractId" {
135+
if len(viewAddress.Args) > 1 {
136136
errorMessage := fmt.Sprintf("Recieved more arguments than required 1 argument.")
137137
log.Error(errorMessage)
138138
return "", errors.New(errorMessage)
139139
}
140-
resp, err = s.GetHTLCHashPreImage(ctx, viewAddress.Args[0], viewAddress.Args[1])
140+
resp, err = s.GetHTLCHashPreImageByContractId(ctx, viewAddress.Args[0])
141141
} else {
142-
errorMessage := fmt.Sprintf("Given function can not be invoked in Interop Chaincode.")
142+
errorMessage := fmt.Sprintf("Given function %s can not be invoked in Interop Chaincode.", viewAddress.CCFunc)
143143
err = errors.New(errorMessage)
144144
}
145145
if err != nil {

core/network/fabric-interop-cc/contracts/interop/manage_assets.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -310,11 +310,11 @@ func (s *SmartContract) GetHTLCHash(ctx contractapi.TransactionContextInterface,
310310
func (s *SmartContract) GetHTLCHashByContractId(ctx contractapi.TransactionContextInterface, contractId string) (string, error) {
311311
return assetexchange.GetHTLCHashByContractId(ctx, contractId)
312312
}
313-
func (s *SmartContract) GetHTLCHashPreImageByContractId(ctx contractapi.TransactionContextInterface, contractId string) (string, error) {
314-
return assetexchange.GetHTLCHashPreImageByContractId(ctx, contractId)
315-
}
316313
func (s *SmartContract) GetHTLCHashPreImage(ctx contractapi.TransactionContextInterface, callerChaincodeID, assetAgreementBytesBase64 string) (string, error) {
317314
return assetexchange.GetHTLCHashPreImage(ctx, callerChaincodeID, assetAgreementBytesBase64)
318315
}
316+
func (s *SmartContract) GetHTLCHashPreImageByContractId(ctx contractapi.TransactionContextInterface, contractId string) (string, error) {
317+
return assetexchange.GetHTLCHashPreImageByContractId(ctx, contractId)
318+
}
319319

320320

core/network/fabric-interop-cc/libs/assetexchange/assetSwapContracts.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -954,10 +954,6 @@ func GetHTLCHashByContractId(ctx contractapi.TransactionContextInterface, contra
954954
return getHTLCHashHelper(ctx, assetLockVal.LockInfo)
955955
}
956956

957-
func GetHTLCHashPreImageByContractId(ctx contractapi.TransactionContextInterface, contractId string) (string, error) {
958-
return getHashPreImageHelper(ctx, generateClaimContractIdMapKey(contractId))
959-
}
960-
961957
func GetHTLCHashPreImage(ctx contractapi.TransactionContextInterface, callerChaincodeID, assetAgreementBytesBase64 string) (string, error) {
962958
assetAgreementBytes, err := base64.StdEncoding.DecodeString(assetAgreementBytesBase64)
963959
if err != nil {
@@ -980,6 +976,10 @@ func GetHTLCHashPreImage(ctx contractapi.TransactionContextInterface, callerChai
980976
return getHashPreImageHelper(ctx, claimAssetLockKey)
981977
}
982978

979+
func GetHTLCHashPreImageByContractId(ctx contractapi.TransactionContextInterface, contractId string) (string, error) {
980+
return getHashPreImageHelper(ctx, generateClaimContractIdMapKey(contractId))
981+
}
982+
983983
func getHTLCHashHelper(ctx contractapi.TransactionContextInterface, lockInfo interface{}) (string, error) {
984984
lockInfoVal := HashLock{}
985985
lockInfoBytes, err := json.Marshal(lockInfo)

docs/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ To get started with capturing and publishing documentation see instructions belo
1111

1212
This documentation site is built using [Docusaurus v2](https://v2.docusaurus.io/docs/).
1313

14+
**NOTE:** Required Node.js version >= 12.13.0 or above.
15+
1416
## Preview Locally
1517

1618
To edit and preview locally run a development server:

docs/docs/external/getting-started/enabling-weaver-network/corda.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ val response = InteroperableHelper.interopFlow(
384384
'trade-finance-network', // Local network name (destination)
385385
true, // Boolean indication TLS is enabled.
386386
<relayTlsTrustStorePath> // JKS file path containing relay server TLS CA certificates
387-
<relayTlsTrustStorePassword> // password used to create the JKS file
387+
<relayTlsTrustStorePassword>, // password used to create the JKS file
388388
)
389389
```
390390
OR
@@ -395,7 +395,7 @@ val response = InteroperableHelper.interopFlow(
395395
<trade-finance-relay-url>[:<port>], // Replace with local network's relay address and port
396396
'trade-finance-network', // Local network name (destination)
397397
true, // Boolean indication TLS is enabled.
398-
<tlsCACertPathsForRelay> // colon-separated list of CA certificate file paths
398+
<tlsCACertPathsForRelay>, // colon-separated list of CA certificate file paths
399399
)
400400
```
401401
-->

samples/fabric/fabric-cli/src/data/interop/simpleasset/accessControlTemplate_ca.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@
1616
{
1717
"principal": "<mspid>",
1818
"principalType": "ca",
19-
"resource": "mychannel:simpleasset:GetHTLCHashPreImageByContractId:*",
19+
"resource": "mychannel:simpleasset:GetHTLCHashPreImage:*",
2020
"read": true
2121
},
2222
{
2323
"principal": "<mspid>",
2424
"principalType": "ca",
25-
"resource": "mychannel:simpleasset:GetHTLCHashPreImage:*",
25+
"resource": "mychannel:simpleasset:GetHTLCHashPreImageByContractId:*",
2626
"read": true
2727
}
2828
]

samples/fabric/fabric-cli/src/data/interop/simpleasset/accessControlTemplate_certificate.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@
1616
{
1717
"principal": "<certificate>",
1818
"principalType": "certificate",
19-
"resource": "mychannel:simpleasset:GetHTLCHashPreImageByContractId:*",
19+
"resource": "mychannel:simpleasset:GetHTLCHashPreImage:*",
2020
"read": true
2121
},
2222
{
2323
"principal": "<certificate>",
2424
"principalType": "certificate",
25-
"resource": "mychannel:simpleasset:GetHTLCHashPreImage:*",
25+
"resource": "mychannel:simpleasset:GetHTLCHashPreImageByContractId:*",
2626
"read": true
2727
}
2828
]

samples/fabric/fabric-cli/src/data/interop/simpleasset/verificationPolicyTemplate.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@
1616
}
1717
},
1818
{
19-
"pattern": "mychannel:simpleasset:GetHTLCHashPreImageByContractId:*",
19+
"pattern": "mychannel:simpleasset:GetHTLCHashPreImage:*",
2020
"policy": {
2121
"type": "Signature",
2222
"criteria": []
2323
}
2424
},
2525
{
26-
"pattern": "mychannel:simpleasset:GetHTLCHashPreImage:*",
26+
"pattern": "mychannel:simpleasset:GetHTLCHashPreImageByContractId:*",
2727
"policy": {
2828
"type": "Signature",
2929
"criteria": []

tests/network-setups/corda/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ local file system or from Github Packages.
4545
For local versions, the `get-cordapps` script assumes that _a)_ the repositories
4646
for these are at the same directory level as the `networks-setup` repository,
4747
and _b)_ that the cordapp executables have been built in those repos. The
48-
required CorDapps are in
49-
[corda-interop-app](../../../core/network/corda-interop-app) and
50-
[corda-simple-application](../../../samples/corda/corda-simple-application) and
51-
[fungible-house-token](../../../samples/corda/fungible-house-token)
52-
and the instructions for building these projects can be found in their
53-
respective repos.
48+
required CorDapps are in:
49+
* [corda-interop-app](../../../core/network/corda-interop-app)
50+
* [corda-simple-application](../../../samples/corda/corda-simple-application)
51+
* [fungible-house-token](../../../samples/corda/fungible-house-token)
52+
53+
The instructions for building these projects can be found in their respective folders.
5454

5555
To get the CorDapps from Github Packages you will need to have permission to do so:
5656

tests/network-setups/corda/scripts/get-cordapps.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ elif [ "house" = "$app" ]; then
6262

6363
### Token SDK ###
6464

65-
wget https://software.r3.com/artifactory/corda-lib/com/r3/corda/lib/ci/ci-workflows/1.0/ci-workflows-1.0.jar -P $directory/../shared/artifacts
66-
wget https://software.r3.com/artifactory/corda-lib/com/r3/corda/lib/tokens/tokens-contracts/$tokenVersion/tokens-contracts-$tokenVersion.jar -P $directory/../shared/artifacts
67-
wget https://software.r3.com/artifactory/corda-lib/com/r3/corda/lib/tokens/tokens-workflows/$tokenVersion/tokens-workflows-$tokenVersion.jar -P $directory/../shared/artifacts
65+
(cd $directory/../shared/artifacts && curl -O https://software.r3.com/artifactory/corda-lib/com/r3/corda/lib/ci/ci-workflows/1.0/ci-workflows-1.0.jar) || exit 1
66+
(cd $directory/../shared/artifacts && curl -O https://software.r3.com/artifactory/corda-lib/com/r3/corda/lib/tokens/tokens-contracts/$tokenVersion/tokens-contracts-$tokenVersion.jar) || exit 1
67+
(cd $directory/../shared/artifacts && curl -O https://software.r3.com/artifactory/corda-lib/com/r3/corda/lib/tokens/tokens-workflows/$tokenVersion/tokens-workflows-$tokenVersion.jar) || exit 1
6868

6969
else
7070
echo "Cordapp not found" && exit 1

0 commit comments

Comments
 (0)