feat: add Go client application for full-stack-asset-transfer-guide#1392
Open
nXtCyberNet wants to merge 1 commit intohyperledger:mainfrom
Open
feat: add Go client application for full-stack-asset-transfer-guide#1392nXtCyberNet wants to merge 1 commit intohyperledger:mainfrom
nXtCyberNet wants to merge 1 commit intohyperledger:mainfrom
Conversation
Signed-off-by: nXtCyberNet <rohantech2005@gmail.com>
bc269f5 to
d42cc27
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes: #1378
Summary
This PR adds a Go implementation of the full-stack-asset-transfer-guide client application, mirroring the existing TypeScript implementation in
trader-typescript.What's Included
A new directory: trader-go
main.go
Entry point. Parses CLI arguments, establishes the gRPC connection, and dispatches commands.
connect.go
Creates the gRPC connection and initializes the Fabric Gateway client.
contract.go
Defines the
AssetTransferstruct that wraps all smart contract calls (CreateAsset,ReadAsset,UpdateAsset,DeleteAsset,TransferAsset,GetAllAssets).commands.go
Command registry mapping CLI command names to handler functions.
commands_impl.go
Implementation of all commands (
create,delete,getAllAssets,listen,read,transact,transfer).config.go
Helper functions for reading environment variables (
ENDPOINT,MSP_ID,CERTIFICATE,PRIVATE_KEY,CHANNEL_NAME,CHAINCODE_NAME).expectedError.go
Defines the
ExpectedErrortype to distinguish known application errors from unexpected failures.go.mod / go.sum
Module definition using
fabric-gateway v1.10.0andgrpc v1.76.0.Usage
The CLI interface is identical to the TypeScript implementation.
Testing
Tested end-to-end in WSL against a live Microfab network with the
asset-transfer-typescriptchaincode.All 7 commands execute successfully.