From e23bc6714ebbcc38a421599d05a30e04a9b7f1ae Mon Sep 17 00:00:00 2001 From: "Mark S. Lewis" Date: Thu, 17 Oct 2024 19:31:49 +0100 Subject: [PATCH] Simplify Java client error-handling example The latest fabric-gateway client API release (v1.7.0) includes the gRPC error details in the GatewayExcetion stack trace so it is not necessary to programmatically access them to demonstrate that they are present. This change updates the asset-transfer-basic/application-gateway-java sample to simplify the updateNonExistentAsset example method. It also: - Updates all samples to use the latest fabric-gateway release. - Adds equivalent Maven POM files for fabric-gateway application samples. Signed-off-by: Mark S. Lewis --- .gitignore | 4 +- .../application-gateway-go/assetTransfer.go | 2 +- .../application-gateway-go/go.mod | 14 +-- .../application-gateway-go/go.sum | 32 +++--- .../application-gateway-java/build.gradle | 12 ++- .../application-gateway-java/pom.xml | 96 +++++++++++++++++ .../src/main/java/App.java | 13 +-- .../package.json | 4 +- .../package.json | 4 +- .../samples/assettransfer/AssetTransfer.java | 56 ++++------ asset-transfer-basic/rest-api-go/go.mod | 14 +-- asset-transfer-basic/rest-api-go/go.sum | 32 +++--- .../application-gateway-go/go.mod | 14 +-- .../application-gateway-go/go.sum | 32 +++--- .../application-gateway-java/build.gradle | 8 +- .../application-gateway-java/pom.xml | 101 ++++++++++++++++++ .../package.json | 4 +- .../package.json | 4 +- .../package.json | 4 +- ci/scripts/run-test-network-basic.sh | 2 + ci/scripts/run-test-network-events.sh | 4 +- ci/scripts/run-test-network-off-chain.sh | 8 +- .../applications/conga-cards/package.json | 4 +- .../applications/ping-chaincode/package.json | 4 +- .../applications/rest-api/package.json | 4 +- .../trader-typescript/package.json | 4 +- .../application-go/go.mod | 14 +-- .../application-go/go.sum | 32 +++--- .../application-typescript/package.json | 4 +- off_chain_data/application-java/.gitignore | 3 + .../application-java/app/build.gradle | 10 +- off_chain_data/application-java/app/pom.xml | 101 ++++++++++++++++++ .../application-typescript/package.json | 6 +- 33 files changed, 472 insertions(+), 178 deletions(-) create mode 100644 asset-transfer-basic/application-gateway-java/pom.xml create mode 100644 asset-transfer-events/application-gateway-java/pom.xml create mode 100644 off_chain_data/application-java/app/pom.xml diff --git a/.gitignore b/.gitignore index 6310950142..7338812b6a 100644 --- a/.gitignore +++ b/.gitignore @@ -13,9 +13,11 @@ vendor/ .idea # Dependency directories node_modules/ +package-lock.json # Ignore Gradle build output directory build -package-lock.json +# Ignore Maven build output directory +target # Eclipse .classpath diff --git a/asset-transfer-basic/application-gateway-go/assetTransfer.go b/asset-transfer-basic/application-gateway-go/assetTransfer.go index 99830212ca..348d2341e6 100755 --- a/asset-transfer-basic/application-gateway-go/assetTransfer.go +++ b/asset-transfer-basic/application-gateway-go/assetTransfer.go @@ -280,7 +280,7 @@ func exampleErrorHandling(contract *client.Contract) { for _, detail := range details { switch detail := detail.(type) { case *gateway.ErrorDetail: - fmt.Printf("- address: %s, mspId: %s, message: %s\n", detail.Address, detail.MspId, detail.Message) + fmt.Printf("- address: %s; mspId: %s; message: %s\n", detail.Address, detail.MspId, detail.Message) } } } diff --git a/asset-transfer-basic/application-gateway-go/go.mod b/asset-transfer-basic/application-gateway-go/go.mod index c7fd63d0db..7261969cc8 100644 --- a/asset-transfer-basic/application-gateway-go/go.mod +++ b/asset-transfer-basic/application-gateway-go/go.mod @@ -3,17 +3,17 @@ module assetTransfer go 1.22.0 require ( - github.com/hyperledger/fabric-gateway v1.6.0 - github.com/hyperledger/fabric-protos-go-apiv2 v0.3.3 - google.golang.org/grpc v1.67.0 + github.com/hyperledger/fabric-gateway v1.7.0 + github.com/hyperledger/fabric-protos-go-apiv2 v0.3.4 + google.golang.org/grpc v1.67.1 ) require ( github.com/miekg/pkcs11 v1.1.1 // indirect - golang.org/x/crypto v0.27.0 // indirect + golang.org/x/crypto v0.28.0 // indirect golang.org/x/net v0.28.0 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/text v0.18.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/text v0.19.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 // indirect - google.golang.org/protobuf v1.34.2 // indirect + google.golang.org/protobuf v1.35.1 // indirect ) diff --git a/asset-transfer-basic/application-gateway-go/go.sum b/asset-transfer-basic/application-gateway-go/go.sum index b86c0a8c72..01eab6a839 100644 --- a/asset-transfer-basic/application-gateway-go/go.sum +++ b/asset-transfer-basic/application-gateway-go/go.sum @@ -2,31 +2,31 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 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/hyperledger/fabric-gateway v1.6.0 h1:mPdXFSHdEjT0cmhsqKBfFMTVyBvfJXlO3Neicp/c27E= -github.com/hyperledger/fabric-gateway v1.6.0/go.mod h1:qHdJcgC6UrTxfYH+YIyAhPUkeNri0gPpyP/6xmiYrZo= -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/hyperledger/fabric-gateway v1.7.0 h1:bd1quU8qYPYqYO69m1tPIDSjB+D+u/rBJfE1eWFcpjY= +github.com/hyperledger/fabric-gateway v1.7.0/go.mod h1:TItDGnq71eJcgz5TW+m5Sq3kWGp0AEI1HPCNxj0Eu7k= +github.com/hyperledger/fabric-protos-go-apiv2 v0.3.4 h1:YJrd+gMaeY0/vsN0aS0QkEKTivGoUnSRIXxGJ7KI+Pc= +github.com/hyperledger/fabric-protos-go-apiv2 v0.3.4/go.mod h1:bau/6AJhvEcu9GKKYHlDXAxXKzYNfhP6xu2GXuxEcFk= github.com/miekg/pkcs11 v1.1.1 h1:Ugu9pdy6vAYku5DEpVWVFPYnzV+bxB+iRdbuFSu7TvU= github.com/miekg/pkcs11 v1.1.1/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +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.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= -go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= -golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= -golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= +golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw= +golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U= golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 h1:e7S5W7MGGLaSu8j3YjdezkZ+m1/Nm0uRVRMEMGk26Xs= google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= -google.golang.org/grpc v1.67.0 h1:IdH9y6PF5MPSdAntIcpjQ+tXO41pcQsfZV2RxtQgVcw= -google.golang.org/grpc v1.67.0/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= -google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= -google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= +google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E= +google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= +google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= +google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/asset-transfer-basic/application-gateway-java/build.gradle b/asset-transfer-basic/application-gateway-java/build.gradle index 552d10f2f2..7db92de801 100644 --- a/asset-transfer-basic/application-gateway-java/build.gradle +++ b/asset-transfer-basic/application-gateway-java/build.gradle @@ -8,10 +8,10 @@ plugins { // Apply the application plugin to add support for building a CLI application. id 'application' - } + ext { - javaMainClass = "application.java.App" + javaMainClass = "application.java.App" } repositories { @@ -19,9 +19,11 @@ repositories { } dependencies { - implementation 'org.hyperledger.fabric:fabric-gateway:1.6.0' - compileOnly 'io.grpc:grpc-api:1.68.0' - runtimeOnly 'io.grpc:grpc-netty-shaded:1.68.0' + implementation 'org.hyperledger.fabric:fabric-gateway:1.7.0' + implementation platform('com.google.protobuf:protobuf-bom:4.28.2') + implementation platform('io.grpc:grpc-bom:1.67.1') + compileOnly 'io.grpc:grpc-api' + runtimeOnly 'io.grpc:grpc-netty-shaded' implementation 'com.google.code.gson:gson:2.11.0' } diff --git a/asset-transfer-basic/application-gateway-java/pom.xml b/asset-transfer-basic/application-gateway-java/pom.xml new file mode 100644 index 0000000000..76c7dc7b20 --- /dev/null +++ b/asset-transfer-basic/application-gateway-java/pom.xml @@ -0,0 +1,96 @@ + + + 4.0.0 + + org.hyperledger.fabric.example + asset-transfer-basic + 1.0-SNAPSHOT + + + UTF-8 + 11 + + + + + + com.google.protobuf + protobuf-bom + 4.28.2 + pom + import + + + io.grpc + grpc-bom + 1.67.1 + pom + import + + + + + + + org.hyperledger.fabric + fabric-gateway + 1.7.0 + + + io.grpc + grpc-api + + + io.grpc + grpc-netty-shaded + runtime + + + + + + + + + maven-clean-plugin + 3.4.0 + + + + maven-resources-plugin + 3.3.1 + + + maven-compiler-plugin + 3.13.0 + + + maven-surefire-plugin + 3.3.0 + + + maven-jar-plugin + 3.4.2 + + + maven-install-plugin + 3.1.2 + + + maven-deploy-plugin + 3.1.2 + + + + maven-site-plugin + 3.12.1 + + + maven-project-info-reports-plugin + 3.6.1 + + + + + diff --git a/asset-transfer-basic/application-gateway-java/src/main/java/App.java b/asset-transfer-basic/application-gateway-java/src/main/java/App.java index 6934648cbe..57285ef8cb 100644 --- a/asset-transfer-basic/application-gateway-java/src/main/java/App.java +++ b/asset-transfer-basic/application-gateway-java/src/main/java/App.java @@ -231,20 +231,11 @@ private void updateNonExistentAsset() { System.out.println("******** FAILED to return an error"); } catch (EndorseException | SubmitException | CommitStatusException e) { - System.out.println("*** Successfully caught the error: "); + System.out.println("*** Successfully caught the error:"); e.printStackTrace(System.out); System.out.println("Transaction ID: " + e.getTransactionId()); - - var details = e.getDetails(); - if (!details.isEmpty()) { - System.out.println("Error Details:"); - for (var detail : details) { - System.out.println("- address: " + detail.getAddress() + ", mspId: " + detail.getMspId() - + ", message: " + detail.getMessage()); - } - } } catch (CommitException e) { - System.out.println("*** Successfully caught the error: " + e); + System.out.println("*** Successfully caught the error:"); e.printStackTrace(System.out); System.out.println("Transaction ID: " + e.getTransactionId()); System.out.println("Status code: " + e.getCode()); diff --git a/asset-transfer-basic/application-gateway-javascript/package.json b/asset-transfer-basic/application-gateway-javascript/package.json index 7debd6cb3c..896e633998 100644 --- a/asset-transfer-basic/application-gateway-javascript/package.json +++ b/asset-transfer-basic/application-gateway-javascript/package.json @@ -14,8 +14,8 @@ "author": "Hyperledger", "license": "Apache-2.0", "dependencies": { - "@grpc/grpc-js": "^1.11.3", - "@hyperledger/fabric-gateway": "^1.6.0" + "@grpc/grpc-js": "^1.12.2", + "@hyperledger/fabric-gateway": "^1.7.0" }, "devDependencies": { "@eslint/js": "^9.5.0", diff --git a/asset-transfer-basic/application-gateway-typescript/package.json b/asset-transfer-basic/application-gateway-typescript/package.json index a0e5eaea44..5327cb7698 100644 --- a/asset-transfer-basic/application-gateway-typescript/package.json +++ b/asset-transfer-basic/application-gateway-typescript/package.json @@ -19,8 +19,8 @@ "author": "Hyperledger", "license": "Apache-2.0", "dependencies": { - "@grpc/grpc-js": "^1.11.3", - "@hyperledger/fabric-gateway": "^1.6.0" + "@grpc/grpc-js": "^1.12.2", + "@hyperledger/fabric-gateway": "^1.7.0" }, "devDependencies": { "@eslint/js": "^9.3.0", diff --git a/asset-transfer-basic/chaincode-java/src/main/java/org/hyperledger/fabric/samples/assettransfer/AssetTransfer.java b/asset-transfer-basic/chaincode-java/src/main/java/org/hyperledger/fabric/samples/assettransfer/AssetTransfer.java index 41c55ddc79..68e3b13962 100644 --- a/asset-transfer-basic/chaincode-java/src/main/java/org/hyperledger/fabric/samples/assettransfer/AssetTransfer.java +++ b/asset-transfer-basic/chaincode-java/src/main/java/org/hyperledger/fabric/samples/assettransfer/AssetTransfer.java @@ -53,14 +53,12 @@ private enum AssetTransferErrors { */ @Transaction(intent = Transaction.TYPE.SUBMIT) public void InitLedger(final Context ctx) { - ChaincodeStub stub = ctx.getStub(); - - CreateAsset(ctx, "asset1", "blue", 5, "Tomoko", 300); - CreateAsset(ctx, "asset2", "red", 5, "Brad", 400); - CreateAsset(ctx, "asset3", "green", 10, "Jin Soo", 500); - CreateAsset(ctx, "asset4", "yellow", 10, "Max", 600); - CreateAsset(ctx, "asset5", "black", 15, "Adrian", 700); - CreateAsset(ctx, "asset6", "white", 15, "Michel", 700); + putAsset(ctx, new Asset("asset1", "blue", 5, "Tomoko", 300)); + putAsset(ctx, new Asset("asset2", "red", 5, "Brad", 400)); + putAsset(ctx, new Asset("asset3", "green", 10, "Jin Soo", 500)); + putAsset(ctx, new Asset("asset4", "yellow", 10, "Max", 600)); + putAsset(ctx, new Asset("asset5", "black", 15, "Adrian", 700)); + putAsset(ctx, new Asset("asset6", "white", 15, "Michel", 700)); } @@ -78,7 +76,6 @@ public void InitLedger(final Context ctx) { @Transaction(intent = Transaction.TYPE.SUBMIT) public Asset CreateAsset(final Context ctx, final String assetID, final String color, final int size, final String owner, final int appraisedValue) { - ChaincodeStub stub = ctx.getStub(); if (AssetExists(ctx, assetID)) { String errorMessage = String.format("Asset %s already exists", assetID); @@ -86,10 +83,13 @@ public Asset CreateAsset(final Context ctx, final String assetID, final String c throw new ChaincodeException(errorMessage, AssetTransferErrors.ASSET_ALREADY_EXISTS.toString()); } - Asset asset = new Asset(assetID, color, size, owner, appraisedValue); + return putAsset(ctx, new Asset(assetID, color, size, owner, appraisedValue)); + } + + private Asset putAsset(final Context ctx, final Asset asset) { // Use Genson to convert the Asset into string, sort it alphabetically and serialize it into a json string String sortedJson = genson.serialize(asset); - stub.putStringState(assetID, sortedJson); + ctx.getStub().putStringState(asset.getAssetID(), sortedJson); return asset; } @@ -103,8 +103,7 @@ public Asset CreateAsset(final Context ctx, final String assetID, final String c */ @Transaction(intent = Transaction.TYPE.EVALUATE) public Asset ReadAsset(final Context ctx, final String assetID) { - ChaincodeStub stub = ctx.getStub(); - String assetJSON = stub.getStringState(assetID); + String assetJSON = ctx.getStub().getStringState(assetID); if (assetJSON == null || assetJSON.isEmpty()) { String errorMessage = String.format("Asset %s does not exist", assetID); @@ -112,8 +111,7 @@ public Asset ReadAsset(final Context ctx, final String assetID) { throw new ChaincodeException(errorMessage, AssetTransferErrors.ASSET_NOT_FOUND.toString()); } - Asset asset = genson.deserialize(assetJSON, Asset.class); - return asset; + return genson.deserialize(assetJSON, Asset.class); } /** @@ -130,7 +128,6 @@ public Asset ReadAsset(final Context ctx, final String assetID) { @Transaction(intent = Transaction.TYPE.SUBMIT) public Asset UpdateAsset(final Context ctx, final String assetID, final String color, final int size, final String owner, final int appraisedValue) { - ChaincodeStub stub = ctx.getStub(); if (!AssetExists(ctx, assetID)) { String errorMessage = String.format("Asset %s does not exist", assetID); @@ -138,11 +135,7 @@ public Asset UpdateAsset(final Context ctx, final String assetID, final String c throw new ChaincodeException(errorMessage, AssetTransferErrors.ASSET_NOT_FOUND.toString()); } - Asset newAsset = new Asset(assetID, color, size, owner, appraisedValue); - // Use Genson to convert the Asset into string, sort it alphabetically and serialize it into a json string - String sortedJson = genson.serialize(newAsset); - stub.putStringState(assetID, sortedJson); - return newAsset; + return putAsset(ctx, new Asset(assetID, color, size, owner, appraisedValue)); } /** @@ -153,15 +146,13 @@ public Asset UpdateAsset(final Context ctx, final String assetID, final String c */ @Transaction(intent = Transaction.TYPE.SUBMIT) public void DeleteAsset(final Context ctx, final String assetID) { - ChaincodeStub stub = ctx.getStub(); - if (!AssetExists(ctx, assetID)) { String errorMessage = String.format("Asset %s does not exist", assetID); System.out.println(errorMessage); throw new ChaincodeException(errorMessage, AssetTransferErrors.ASSET_NOT_FOUND.toString()); } - stub.delState(assetID); + ctx.getStub().delState(assetID); } /** @@ -173,8 +164,7 @@ public void DeleteAsset(final Context ctx, final String assetID) { */ @Transaction(intent = Transaction.TYPE.EVALUATE) public boolean AssetExists(final Context ctx, final String assetID) { - ChaincodeStub stub = ctx.getStub(); - String assetJSON = stub.getStringState(assetID); + String assetJSON = ctx.getStub().getStringState(assetID); return (assetJSON != null && !assetJSON.isEmpty()); } @@ -189,8 +179,7 @@ public boolean AssetExists(final Context ctx, final String assetID) { */ @Transaction(intent = Transaction.TYPE.SUBMIT) public String TransferAsset(final Context ctx, final String assetID, final String newOwner) { - ChaincodeStub stub = ctx.getStub(); - String assetJSON = stub.getStringState(assetID); + String assetJSON = ctx.getStub().getStringState(assetID); if (assetJSON == null || assetJSON.isEmpty()) { String errorMessage = String.format("Asset %s does not exist", assetID); @@ -200,10 +189,7 @@ public String TransferAsset(final Context ctx, final String assetID, final Strin Asset asset = genson.deserialize(assetJSON, Asset.class); - Asset newAsset = new Asset(asset.getAssetID(), asset.getColor(), asset.getSize(), newOwner, asset.getAppraisedValue()); - // Use a Genson to conver the Asset into string, sort it alphabetically and serialize it into a json string - String sortedJson = genson.serialize(newAsset); - stub.putStringState(assetID, sortedJson); + putAsset(ctx, new Asset(asset.getAssetID(), asset.getColor(), asset.getSize(), newOwner, asset.getAppraisedValue())); return asset.getOwner(); } @@ -218,7 +204,7 @@ public String TransferAsset(final Context ctx, final String assetID, final Strin public String GetAllAssets(final Context ctx) { ChaincodeStub stub = ctx.getStub(); - List queryResults = new ArrayList(); + List queryResults = new ArrayList<>(); // To retrieve all assets from the ledger use getStateByRange with empty startKey & endKey. // Giving empty startKey & endKey is interpreted as all the keys from beginning to end. @@ -232,8 +218,6 @@ public String GetAllAssets(final Context ctx) { queryResults.add(asset); } - final String response = genson.serialize(queryResults); - - return response; + return genson.serialize(queryResults); } } diff --git a/asset-transfer-basic/rest-api-go/go.mod b/asset-transfer-basic/rest-api-go/go.mod index 9e2c49fff2..8324149c07 100644 --- a/asset-transfer-basic/rest-api-go/go.mod +++ b/asset-transfer-basic/rest-api-go/go.mod @@ -3,17 +3,17 @@ module rest-api-go go 1.22.0 require ( - github.com/hyperledger/fabric-gateway v1.6.0 - google.golang.org/grpc v1.67.0 + github.com/hyperledger/fabric-gateway v1.7.0 + google.golang.org/grpc v1.67.1 ) require ( - github.com/hyperledger/fabric-protos-go-apiv2 v0.3.3 // indirect + github.com/hyperledger/fabric-protos-go-apiv2 v0.3.4 // indirect github.com/miekg/pkcs11 v1.1.1 // indirect - golang.org/x/crypto v0.27.0 // indirect + golang.org/x/crypto v0.28.0 // indirect golang.org/x/net v0.28.0 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/text v0.18.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/text v0.19.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 // indirect - google.golang.org/protobuf v1.34.2 // indirect + google.golang.org/protobuf v1.35.1 // indirect ) diff --git a/asset-transfer-basic/rest-api-go/go.sum b/asset-transfer-basic/rest-api-go/go.sum index b86c0a8c72..01eab6a839 100644 --- a/asset-transfer-basic/rest-api-go/go.sum +++ b/asset-transfer-basic/rest-api-go/go.sum @@ -2,31 +2,31 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 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/hyperledger/fabric-gateway v1.6.0 h1:mPdXFSHdEjT0cmhsqKBfFMTVyBvfJXlO3Neicp/c27E= -github.com/hyperledger/fabric-gateway v1.6.0/go.mod h1:qHdJcgC6UrTxfYH+YIyAhPUkeNri0gPpyP/6xmiYrZo= -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/hyperledger/fabric-gateway v1.7.0 h1:bd1quU8qYPYqYO69m1tPIDSjB+D+u/rBJfE1eWFcpjY= +github.com/hyperledger/fabric-gateway v1.7.0/go.mod h1:TItDGnq71eJcgz5TW+m5Sq3kWGp0AEI1HPCNxj0Eu7k= +github.com/hyperledger/fabric-protos-go-apiv2 v0.3.4 h1:YJrd+gMaeY0/vsN0aS0QkEKTivGoUnSRIXxGJ7KI+Pc= +github.com/hyperledger/fabric-protos-go-apiv2 v0.3.4/go.mod h1:bau/6AJhvEcu9GKKYHlDXAxXKzYNfhP6xu2GXuxEcFk= github.com/miekg/pkcs11 v1.1.1 h1:Ugu9pdy6vAYku5DEpVWVFPYnzV+bxB+iRdbuFSu7TvU= github.com/miekg/pkcs11 v1.1.1/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +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.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= -go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= -golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= -golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= +golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw= +golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U= golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 h1:e7S5W7MGGLaSu8j3YjdezkZ+m1/Nm0uRVRMEMGk26Xs= google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= -google.golang.org/grpc v1.67.0 h1:IdH9y6PF5MPSdAntIcpjQ+tXO41pcQsfZV2RxtQgVcw= -google.golang.org/grpc v1.67.0/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= -google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= -google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= +google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E= +google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= +google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= +google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/asset-transfer-events/application-gateway-go/go.mod b/asset-transfer-events/application-gateway-go/go.mod index c1f160e2b3..65128cfdb9 100644 --- a/asset-transfer-events/application-gateway-go/go.mod +++ b/asset-transfer-events/application-gateway-go/go.mod @@ -3,17 +3,17 @@ module assetTransfer go 1.22.0 require ( - github.com/hyperledger/fabric-gateway v1.6.0 - google.golang.org/grpc v1.67.0 + github.com/hyperledger/fabric-gateway v1.7.0 + google.golang.org/grpc v1.67.1 ) require ( - github.com/hyperledger/fabric-protos-go-apiv2 v0.3.3 // indirect + github.com/hyperledger/fabric-protos-go-apiv2 v0.3.4 // indirect github.com/miekg/pkcs11 v1.1.1 // indirect - golang.org/x/crypto v0.27.0 // indirect + golang.org/x/crypto v0.28.0 // indirect golang.org/x/net v0.28.0 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/text v0.18.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/text v0.19.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 // indirect - google.golang.org/protobuf v1.34.2 // indirect + google.golang.org/protobuf v1.35.1 // indirect ) diff --git a/asset-transfer-events/application-gateway-go/go.sum b/asset-transfer-events/application-gateway-go/go.sum index b86c0a8c72..01eab6a839 100644 --- a/asset-transfer-events/application-gateway-go/go.sum +++ b/asset-transfer-events/application-gateway-go/go.sum @@ -2,31 +2,31 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 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/hyperledger/fabric-gateway v1.6.0 h1:mPdXFSHdEjT0cmhsqKBfFMTVyBvfJXlO3Neicp/c27E= -github.com/hyperledger/fabric-gateway v1.6.0/go.mod h1:qHdJcgC6UrTxfYH+YIyAhPUkeNri0gPpyP/6xmiYrZo= -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/hyperledger/fabric-gateway v1.7.0 h1:bd1quU8qYPYqYO69m1tPIDSjB+D+u/rBJfE1eWFcpjY= +github.com/hyperledger/fabric-gateway v1.7.0/go.mod h1:TItDGnq71eJcgz5TW+m5Sq3kWGp0AEI1HPCNxj0Eu7k= +github.com/hyperledger/fabric-protos-go-apiv2 v0.3.4 h1:YJrd+gMaeY0/vsN0aS0QkEKTivGoUnSRIXxGJ7KI+Pc= +github.com/hyperledger/fabric-protos-go-apiv2 v0.3.4/go.mod h1:bau/6AJhvEcu9GKKYHlDXAxXKzYNfhP6xu2GXuxEcFk= github.com/miekg/pkcs11 v1.1.1 h1:Ugu9pdy6vAYku5DEpVWVFPYnzV+bxB+iRdbuFSu7TvU= github.com/miekg/pkcs11 v1.1.1/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +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.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= -go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= -golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= -golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= +golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw= +golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U= golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 h1:e7S5W7MGGLaSu8j3YjdezkZ+m1/Nm0uRVRMEMGk26Xs= google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= -google.golang.org/grpc v1.67.0 h1:IdH9y6PF5MPSdAntIcpjQ+tXO41pcQsfZV2RxtQgVcw= -google.golang.org/grpc v1.67.0/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= -google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= -google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= +google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E= +google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= +google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= +google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/asset-transfer-events/application-gateway-java/build.gradle b/asset-transfer-events/application-gateway-java/build.gradle index 432c9c5bd0..e07431227b 100644 --- a/asset-transfer-events/application-gateway-java/build.gradle +++ b/asset-transfer-events/application-gateway-java/build.gradle @@ -8,9 +8,11 @@ repositories { } dependencies { - implementation 'org.hyperledger.fabric:fabric-gateway:1.6.0' - compileOnly 'io.grpc:grpc-api:1.68.0' - runtimeOnly 'io.grpc:grpc-netty-shaded:1.68.0' + implementation 'org.hyperledger.fabric:fabric-gateway:1.7.0' + implementation platform('com.google.protobuf:protobuf-bom:4.28.2') + implementation platform('io.grpc:grpc-bom:1.67.1') + compileOnly 'io.grpc:grpc-api' + runtimeOnly 'io.grpc:grpc-netty-shaded' implementation 'com.google.code.gson:gson:2.11.0' } diff --git a/asset-transfer-events/application-gateway-java/pom.xml b/asset-transfer-events/application-gateway-java/pom.xml new file mode 100644 index 0000000000..e959e925ae --- /dev/null +++ b/asset-transfer-events/application-gateway-java/pom.xml @@ -0,0 +1,101 @@ + + + 4.0.0 + + org.hyperledger.fabric.example + asset-transfer-events + 1.0-SNAPSHOT + + + UTF-8 + 11 + + + + + + com.google.protobuf + protobuf-bom + 4.28.2 + pom + import + + + io.grpc + grpc-bom + 1.67.1 + pom + import + + + + + + + org.hyperledger.fabric + fabric-gateway + 1.7.0 + + + io.grpc + grpc-api + + + io.grpc + grpc-netty-shaded + runtime + + + com.google.code.gson + gson + 2.11.0 + + + + + + + + + maven-clean-plugin + 3.4.0 + + + + maven-resources-plugin + 3.3.1 + + + maven-compiler-plugin + 3.13.0 + + + maven-surefire-plugin + 3.3.0 + + + maven-jar-plugin + 3.4.2 + + + maven-install-plugin + 3.1.2 + + + maven-deploy-plugin + 3.1.2 + + + + maven-site-plugin + 3.12.1 + + + maven-project-info-reports-plugin + 3.6.1 + + + + + diff --git a/asset-transfer-events/application-gateway-typescript/package.json b/asset-transfer-events/application-gateway-typescript/package.json index 471371fa5f..24ca024e3d 100755 --- a/asset-transfer-events/application-gateway-typescript/package.json +++ b/asset-transfer-events/application-gateway-typescript/package.json @@ -19,8 +19,8 @@ "author": "Hyperledger", "license": "Apache-2.0", "dependencies": { - "@grpc/grpc-js": "^1.11.3", - "@hyperledger/fabric-gateway": "^1.6.0" + "@grpc/grpc-js": "^1.12.2", + "@hyperledger/fabric-gateway": "^1.7.0" }, "devDependencies": { "@eslint/js": "^9.3.0", diff --git a/asset-transfer-private-data/application-gateway-typescript/package.json b/asset-transfer-private-data/application-gateway-typescript/package.json index 6c909e4aff..96d609bf97 100644 --- a/asset-transfer-private-data/application-gateway-typescript/package.json +++ b/asset-transfer-private-data/application-gateway-typescript/package.json @@ -19,8 +19,8 @@ "author": "Hyperledger", "license": "Apache-2.0", "dependencies": { - "@grpc/grpc-js": "^1.11.3", - "@hyperledger/fabric-gateway": "^1.6.0" + "@grpc/grpc-js": "^1.12.2", + "@hyperledger/fabric-gateway": "^1.7.0" }, "devDependencies": { "@eslint/js": "^9.3.0", diff --git a/asset-transfer-secured-agreement/application-gateway-typescript/package.json b/asset-transfer-secured-agreement/application-gateway-typescript/package.json index b3b32a9c10..adcec8400b 100644 --- a/asset-transfer-secured-agreement/application-gateway-typescript/package.json +++ b/asset-transfer-secured-agreement/application-gateway-typescript/package.json @@ -19,8 +19,8 @@ "author": "Hyperledger", "license": "Apache-2.0", "dependencies": { - "@grpc/grpc-js": "^1.11.3", - "@hyperledger/fabric-gateway": "^1.6.0" + "@grpc/grpc-js": "^1.12.2", + "@hyperledger/fabric-gateway": "^1.7.0" }, "devDependencies": { "@eslint/js": "^9.3.0", diff --git a/ci/scripts/run-test-network-basic.sh b/ci/scripts/run-test-network-basic.sh index 026d26c803..238e16df58 100755 --- a/ci/scripts/run-test-network-basic.sh +++ b/ci/scripts/run-test-network-basic.sh @@ -77,6 +77,8 @@ deployChaincode pushd ../asset-transfer-basic/application-gateway-java print "Executing Gradle Run" ./gradlew run +print "Executing Maven Run" +mvn --batch-mode --no-transfer-progress compile exec:java -Dexec.mainClass=App popd diff --git a/ci/scripts/run-test-network-events.sh b/ci/scripts/run-test-network-events.sh index cf7fb2374e..ee4fe75f69 100755 --- a/ci/scripts/run-test-network-events.sh +++ b/ci/scripts/run-test-network-events.sh @@ -48,7 +48,9 @@ stopNetwork createNetwork print "Initializing Java gateway application" pushd ../asset-transfer-events/application-gateway-java -print "Executing application" +print "Executing Gradle application" ./gradlew run +print "Executing Maven application" +mvn --batch-mode --no-transfer-progress compile exec:java -Dexec.mainClass=App popd stopNetwork diff --git a/ci/scripts/run-test-network-off-chain.sh b/ci/scripts/run-test-network-off-chain.sh index 497aef26e5..872cda415a 100755 --- a/ci/scripts/run-test-network-off-chain.sh +++ b/ci/scripts/run-test-network-off-chain.sh @@ -53,9 +53,15 @@ deployChaincode print "Initializing off-chain data application" pushd ../off_chain_data/application-java rm -f app/checkpoint.json app/store.log -print "Running the output app" +print "Running the Gradle app" SIMULATED_FAILURE_COUNT=1 ./gradlew run --quiet --args='getAllAssets transact getAllAssets listen' SIMULATED_FAILURE_COUNT=1 ./gradlew run --quiet --args=listen +pushd app +rm -f checkpoint.json store.log +print "Executing Maven application" +SIMULATED_FAILURE_COUNT=1 mvn --batch-mode --no-transfer-progress compile exec:java -Dexec.mainClass=App -Dexec.args='getAllAssets transact getAllAssets listen' +SIMULATED_FAILURE_COUNT=1 mvn --batch-mode --no-transfer-progress compile exec:java -Dexec.mainClass=App -Dexec.args=listen +popd popd stopNetwork diff --git a/full-stack-asset-transfer-guide/applications/conga-cards/package.json b/full-stack-asset-transfer-guide/applications/conga-cards/package.json index 2a93cbea5c..8c6d8b2ca6 100644 --- a/full-stack-asset-transfer-guide/applications/conga-cards/package.json +++ b/full-stack-asset-transfer-guide/applications/conga-cards/package.json @@ -19,8 +19,8 @@ "author": "Hyperledger", "license": "Apache-2.0", "dependencies": { - "@grpc/grpc-js": "^1.11.3", - "@hyperledger/fabric-gateway": "^1.6.0", + "@grpc/grpc-js": "^1.12.2", + "@hyperledger/fabric-gateway": "^1.7.0", "axios": "^1.7.7", "source-map-support": "^0.5.21" }, diff --git a/full-stack-asset-transfer-guide/applications/ping-chaincode/package.json b/full-stack-asset-transfer-guide/applications/ping-chaincode/package.json index d14753e8be..a9ee257107 100644 --- a/full-stack-asset-transfer-guide/applications/ping-chaincode/package.json +++ b/full-stack-asset-transfer-guide/applications/ping-chaincode/package.json @@ -18,8 +18,8 @@ "author": "Hyperledger", "license": "Apache-2.0", "dependencies": { - "@grpc/grpc-js": "^1.11.3", - "@hyperledger/fabric-gateway": "^1.6.0", + "@grpc/grpc-js": "^1.12.2", + "@hyperledger/fabric-gateway": "^1.7.0", "dotenv": "^16.4.5", "env-var": "^7.5.0", "js-yaml": "^4.1.0" diff --git a/full-stack-asset-transfer-guide/applications/rest-api/package.json b/full-stack-asset-transfer-guide/applications/rest-api/package.json index 01e63cca82..487127abf2 100644 --- a/full-stack-asset-transfer-guide/applications/rest-api/package.json +++ b/full-stack-asset-transfer-guide/applications/rest-api/package.json @@ -29,8 +29,8 @@ "typescript": "~5.2.2" }, "dependencies": { - "@grpc/grpc-js": "^1.11.3", - "@hyperledger/fabric-gateway": "^1.6.0", + "@grpc/grpc-js": "^1.12.2", + "@hyperledger/fabric-gateway": "^1.7.0", "body-parser": "^1.20.3", "cors": "^2.8.5", "express": "^4.21.0" diff --git a/full-stack-asset-transfer-guide/applications/trader-typescript/package.json b/full-stack-asset-transfer-guide/applications/trader-typescript/package.json index 1ede36714b..2535195977 100644 --- a/full-stack-asset-transfer-guide/applications/trader-typescript/package.json +++ b/full-stack-asset-transfer-guide/applications/trader-typescript/package.json @@ -19,8 +19,8 @@ "author": "Hyperledger", "license": "Apache-2.0", "dependencies": { - "@grpc/grpc-js": "^1.11.3", - "@hyperledger/fabric-gateway": "^1.6.0" + "@grpc/grpc-js": "^1.12.2", + "@hyperledger/fabric-gateway": "^1.7.0" }, "devDependencies": { "@eslint/js": "^9.3.0", diff --git a/hardware-security-module/application-go/go.mod b/hardware-security-module/application-go/go.mod index fbe3c2c965..0e7955518d 100644 --- a/hardware-security-module/application-go/go.mod +++ b/hardware-security-module/application-go/go.mod @@ -3,17 +3,17 @@ module github.com/hyperledger/fabric-samples/hardware-security-module/applicatio go 1.22.0 require ( - github.com/hyperledger/fabric-gateway v1.6.0 - google.golang.org/grpc v1.67.0 + github.com/hyperledger/fabric-gateway v1.7.0 + google.golang.org/grpc v1.67.1 ) require ( - github.com/hyperledger/fabric-protos-go-apiv2 v0.3.3 // indirect + github.com/hyperledger/fabric-protos-go-apiv2 v0.3.4 // indirect github.com/miekg/pkcs11 v1.1.1 // indirect - golang.org/x/crypto v0.27.0 // indirect + golang.org/x/crypto v0.28.0 // indirect golang.org/x/net v0.28.0 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/text v0.18.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/text v0.19.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 // indirect - google.golang.org/protobuf v1.34.2 // indirect + google.golang.org/protobuf v1.35.1 // indirect ) diff --git a/hardware-security-module/application-go/go.sum b/hardware-security-module/application-go/go.sum index b86c0a8c72..01eab6a839 100644 --- a/hardware-security-module/application-go/go.sum +++ b/hardware-security-module/application-go/go.sum @@ -2,31 +2,31 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 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/hyperledger/fabric-gateway v1.6.0 h1:mPdXFSHdEjT0cmhsqKBfFMTVyBvfJXlO3Neicp/c27E= -github.com/hyperledger/fabric-gateway v1.6.0/go.mod h1:qHdJcgC6UrTxfYH+YIyAhPUkeNri0gPpyP/6xmiYrZo= -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/hyperledger/fabric-gateway v1.7.0 h1:bd1quU8qYPYqYO69m1tPIDSjB+D+u/rBJfE1eWFcpjY= +github.com/hyperledger/fabric-gateway v1.7.0/go.mod h1:TItDGnq71eJcgz5TW+m5Sq3kWGp0AEI1HPCNxj0Eu7k= +github.com/hyperledger/fabric-protos-go-apiv2 v0.3.4 h1:YJrd+gMaeY0/vsN0aS0QkEKTivGoUnSRIXxGJ7KI+Pc= +github.com/hyperledger/fabric-protos-go-apiv2 v0.3.4/go.mod h1:bau/6AJhvEcu9GKKYHlDXAxXKzYNfhP6xu2GXuxEcFk= github.com/miekg/pkcs11 v1.1.1 h1:Ugu9pdy6vAYku5DEpVWVFPYnzV+bxB+iRdbuFSu7TvU= github.com/miekg/pkcs11 v1.1.1/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +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.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= -go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= -golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= -golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= +golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw= +golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U= golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 h1:e7S5W7MGGLaSu8j3YjdezkZ+m1/Nm0uRVRMEMGk26Xs= google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= -google.golang.org/grpc v1.67.0 h1:IdH9y6PF5MPSdAntIcpjQ+tXO41pcQsfZV2RxtQgVcw= -google.golang.org/grpc v1.67.0/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= -google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= -google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= +google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E= +google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= +google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= +google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/hardware-security-module/application-typescript/package.json b/hardware-security-module/application-typescript/package.json index 9702887ad9..f4c577fbc8 100644 --- a/hardware-security-module/application-typescript/package.json +++ b/hardware-security-module/application-typescript/package.json @@ -17,8 +17,8 @@ "author": "", "license": "Apache-2.0", "dependencies": { - "@grpc/grpc-js": "^1.11.3", - "@hyperledger/fabric-gateway": "^1.6.0" + "@grpc/grpc-js": "^1.12.2", + "@hyperledger/fabric-gateway": "^1.7.0" }, "devDependencies": { "@eslint/js": "^9.3.0", diff --git a/off_chain_data/application-java/.gitignore b/off_chain_data/application-java/.gitignore index ebecdaa603..1a24196cd5 100644 --- a/off_chain_data/application-java/.gitignore +++ b/off_chain_data/application-java/.gitignore @@ -10,3 +10,6 @@ build # Files generated by the application at runtime checkpoint.json store.log + +# Ignore Maven build output directory +target diff --git a/off_chain_data/application-java/app/build.gradle b/off_chain_data/application-java/app/build.gradle index 68433f186b..42f015e41d 100644 --- a/off_chain_data/application-java/app/build.gradle +++ b/off_chain_data/application-java/app/build.gradle @@ -14,10 +14,12 @@ repositories { } dependencies { - implementation 'org.hyperledger.fabric:fabric-gateway:1.6.0' - implementation 'org.hyperledger.fabric:fabric-protos:0.3.3' - compileOnly 'io.grpc:grpc-api:1.68.0' - runtimeOnly 'io.grpc:grpc-netty-shaded:1.68.0' + implementation 'org.hyperledger.fabric:fabric-gateway:1.7.0' + implementation platform('com.google.protobuf:protobuf-bom:4.28.2') + implementation 'org.hyperledger.fabric:fabric-protos:0.3.4' + implementation platform('io.grpc:grpc-bom:1.67.1') + compileOnly 'io.grpc:grpc-api' + runtimeOnly 'io.grpc:grpc-netty-shaded' implementation 'com.google.code.gson:gson:2.11.0' } diff --git a/off_chain_data/application-java/app/pom.xml b/off_chain_data/application-java/app/pom.xml new file mode 100644 index 0000000000..11c2564dbe --- /dev/null +++ b/off_chain_data/application-java/app/pom.xml @@ -0,0 +1,101 @@ + + + 4.0.0 + + org.hyperledger.fabric.example + off-chain-data + 1.0-SNAPSHOT + + + UTF-8 + 11 + + + + + + com.google.protobuf + protobuf-bom + 4.28.2 + pom + import + + + io.grpc + grpc-bom + 1.67.1 + pom + import + + + + + + + org.hyperledger.fabric + fabric-gateway + 1.7.0 + + + io.grpc + grpc-api + + + io.grpc + grpc-netty-shaded + runtime + + + com.google.code.gson + gson + 2.11.0 + + + + + + + + + maven-clean-plugin + 3.4.0 + + + + maven-resources-plugin + 3.3.1 + + + maven-compiler-plugin + 3.13.0 + + + maven-surefire-plugin + 3.3.0 + + + maven-jar-plugin + 3.4.2 + + + maven-install-plugin + 3.1.2 + + + maven-deploy-plugin + 3.1.2 + + + + maven-site-plugin + 3.12.1 + + + maven-project-info-reports-plugin + 3.6.1 + + + + + diff --git a/off_chain_data/application-typescript/package.json b/off_chain_data/application-typescript/package.json index 57baefa630..9b2b2cd7ce 100644 --- a/off_chain_data/application-typescript/package.json +++ b/off_chain_data/application-typescript/package.json @@ -18,9 +18,9 @@ "author": "Hyperledger", "license": "Apache-2.0", "dependencies": { - "@grpc/grpc-js": "^1.11.3", - "@hyperledger/fabric-gateway": "^1.6.0", - "@hyperledger/fabric-protos": "^0.3.3" + "@grpc/grpc-js": "^1.12.2", + "@hyperledger/fabric-gateway": "^1.7.0", + "@hyperledger/fabric-protos": "^0.3.4" }, "devDependencies": { "@eslint/js": "^9.3.0",