fabric-samples/full-stack-asset-transfer-guide/applications/trader-typescript
Mark S. Lewis 3eaabe789c Fix build failure in full-stack-asset-transfer
A typo in the 10-appdev-e2e.sh script caused the shell to exit with an error status, and the killall command appears to match some key processes in the runner so removing.

Also:
- Update sample application and smart contract to Node 18, using the latest fabric-contact-api release.
- Use release versions of Fabric v2.5 and update tool versions in workflow set up.
- Use GitHub Action to install just instead of curl of install script.

Signed-off-by: Mark S. Lewis <mark_lewis@uk.ibm.com>
2023-04-27 16:07:36 -04:00
..
src Run FSAT tests with 2.5 images, binaries, and trigger on all builds for regression coverage (#919) 2023-01-27 09:49:52 -05:00
.eslintrc.js Moves the Full Stack Asset Transfer Development Guide to fabric-samples (#852) 2022-11-10 10:40:27 -05:00
.gitignore Moves the Full Stack Asset Transfer Development Guide to fabric-samples (#852) 2022-11-10 10:40:27 -05:00
.npmrc Moves the Full Stack Asset Transfer Development Guide to fabric-samples (#852) 2022-11-10 10:40:27 -05:00
package.json Fix build failure in full-stack-asset-transfer 2023-04-27 16:07:36 -04:00
README.md Moves the Full Stack Asset Transfer Development Guide to fabric-samples (#852) 2022-11-10 10:40:27 -05:00
tsconfig.json Fix build failure in full-stack-asset-transfer 2023-04-27 16:07:36 -04:00

Trader sample client application

This is a simple client application for the asset-transfer smart contract, built using the Fabric Gateway client API for Fabric v2.4+.

Prerequisites

The client application requires Node.js 16 or later.

Set up

The following steps prepare the client application for execution:

  1. Ensure the asset-transfer smart contract is deployed to a running Fabric network.
  2. Run npm install to download dependencies and compile the application code.

Note: After making any code changes to the application, be sure to recompile the application code. This can be done by explicitly running npm install again, or you can leave npm run build:watch running in a terminal window to automatically rebuild the application on any code change.

The client application uses environment variables to supply configuration options. You must set the following environment variables when running the application:

  • ENDPOINT - endpoint address for the Gateway service to which the client will connect in the form hostname:port. Depending on your environment, this can be the address of a specific peer within the user's organization, or an ingress endpoint that dispatches to any available peer in the user's organization.
  • MSP_ID - member service provider ID for the user's organization.
  • CERTIFICATE - PEM file containing the user's X.509 certificate.
  • PRIVATE_KEY - PEM file containing the user's private key.

The following environment variables are optional and can be set if required by your environment:

  • CHANNEL_NAME - Channel to which the chaincode is deployed. (Default: mychannel)
  • CHAINCODE_NAME - Channel to which the chaincode is deployed. (Default: asset-transfer)
  • TLS_CERT - PEM file containing the CA certificate used to authenticate the TLS connection to the Gateway peer. Only required if using a TLS connection and a private CA.
  • HOST_ALIAS - the name of the Gateway peer as it appears in its TLS certificate. Only required if the endpoint address used by the client does not match the address in the Gateway peer's TLS certificate.

Run

The sample application is run as a command-line application, and is lauched using npm start <command> [<arg> ...]. The following commands are available:

  • npm start create <assetId> <ownerName> <color> to create a new asset.
  • npm start delete <assetId> to delete an existing asset.
  • npm start getAllAssets to list all assets.
  • npm start listen to listen for chaincode events emitted by transaction functions. Interrupt the listener using Control-C.
  • npm start read <assetId> to view an existing asset.
  • npm start transact to create some random assets and perform some random operations on those assets.
  • npm start transfer <assetId> <ownerName> <ownerMspId> to transfer an asset to a new owner within an organization MSP ID.