diff --git a/asset-transfer-private-data/chaincode-go/chaincode/asset_transfer.go b/asset-transfer-private-data/chaincode-go/chaincode/asset_transfer.go index 2d04a2b1..58817a56 100644 --- a/asset-transfer-private-data/chaincode-go/chaincode/asset_transfer.go +++ b/asset-transfer-private-data/chaincode-go/chaincode/asset_transfer.go @@ -167,7 +167,7 @@ func (s *SmartContract) CreateAsset(ctx contractapi.TransactionContextInterface) // AgreeToTransfer is used by the potential buyer of the asset to agree to the // asset value. The agreed to appraisal value is stored in the buying orgs -// org specifc collection, while the the buyer client ID is stored in the asset collection +// org specifc collection, while the buyer client ID is stored in the asset collection // using a composite key func (s *SmartContract) AgreeToTransfer(ctx contractapi.TransactionContextInterface) error { diff --git a/asset-transfer-private-data/chaincode-java/src/main/java/org/hyperledger/fabric/samples/privatedata/AssetTransfer.java b/asset-transfer-private-data/chaincode-java/src/main/java/org/hyperledger/fabric/samples/privatedata/AssetTransfer.java index f0f1a54c..3bc17862 100644 --- a/asset-transfer-private-data/chaincode-java/src/main/java/org/hyperledger/fabric/samples/privatedata/AssetTransfer.java +++ b/asset-transfer-private-data/chaincode-java/src/main/java/org/hyperledger/fabric/samples/privatedata/AssetTransfer.java @@ -339,7 +339,7 @@ public final class AssetTransfer implements ContractInterface { /** * AgreeToTransfer is used by the potential buyer of the asset to agree to the * asset value. The agreed to appraisal value is stored in the buying orgs - * org specifc collection, while the the buyer client ID is stored in the asset collection + * org specifc collection, while the buyer client ID is stored in the asset collection * using a composite key * Uses transient map with key asset_value * diff --git a/asset-transfer-private-data/chaincode-typescript/src/assetTransfer.ts b/asset-transfer-private-data/chaincode-typescript/src/assetTransfer.ts index 09f93565..fab116bd 100644 --- a/asset-transfer-private-data/chaincode-typescript/src/assetTransfer.ts +++ b/asset-transfer-private-data/chaincode-typescript/src/assetTransfer.ts @@ -61,7 +61,7 @@ export class AssetTransfer extends Contract { // AgreeToTransfer is used by the potential buyer of the asset to agree to the // asset value. The agreed to appraisal value is stored in the buying orgs - // org specifc collection, while the the buyer client ID is stored in the asset collection + // org specifc collection, while the buyer client ID is stored in the asset collection // using a composite key @Transaction() public async AgreeToTransfer(ctx: Context): Promise { diff --git a/auction-dutch/chaincode-go-auditor/smart-contract/auction.go b/auction-dutch/chaincode-go-auditor/smart-contract/auction.go index e0151f8a..c56daedd 100644 --- a/auction-dutch/chaincode-go-auditor/smart-contract/auction.go +++ b/auction-dutch/chaincode-go-auditor/smart-contract/auction.go @@ -148,7 +148,7 @@ func (s *SmartContract) RevealBid(ctx contractapi.TransactionContextInterface, a transientBidJSON, ok := transientMap["bid"] if !ok { - return fmt.Errorf("bid key not found in the transient map") + return errors.New("bid key not found in the transient map") } // get implicit collection name of organization ID diff --git a/auction-dutch/chaincode-go-auditor/smart-contract/auctionQueries.go b/auction-dutch/chaincode-go-auditor/smart-contract/auctionQueries.go index cee05d2c..45b84762 100644 --- a/auction-dutch/chaincode-go-auditor/smart-contract/auctionQueries.go +++ b/auction-dutch/chaincode-go-auditor/smart-contract/auctionQueries.go @@ -6,6 +6,7 @@ package auction import ( "encoding/json" + "errors" "fmt" "github.com/hyperledger/fabric-chaincode-go/v2/shim" @@ -20,7 +21,7 @@ func (s *SmartContract) QueryAuction(ctx contractapi.TransactionContextInterface return nil, fmt.Errorf("failed to get auction object %v: %v", auctionID, err) } if auctionJSON == nil { - return nil, fmt.Errorf("auction does not exist") + return nil, errors.New("auction does not exist") } var auction *Auction diff --git a/auction-dutch/chaincode-go/smart-contract/auction.go b/auction-dutch/chaincode-go/smart-contract/auction.go index e71ae843..90a9097b 100644 --- a/auction-dutch/chaincode-go/smart-contract/auction.go +++ b/auction-dutch/chaincode-go/smart-contract/auction.go @@ -8,6 +8,7 @@ import ( "bytes" "crypto/sha256" "encoding/json" + "errors" "fmt" "sort" @@ -129,7 +130,7 @@ func (s *SmartContract) Bid(ctx contractapi.TransactionContextInterface, auction bidJSON, ok := transientMap["bid"] if !ok { - return "", fmt.Errorf("bid key not found in the transient map") + return "", errors.New("bid key not found in the transient map") } // get the implicit collection name using the bidder's organization ID diff --git a/auction-dutch/chaincode-go/smart-contract/auctionQueries.go b/auction-dutch/chaincode-go/smart-contract/auctionQueries.go index 67d42f61..d5024fb4 100644 --- a/auction-dutch/chaincode-go/smart-contract/auctionQueries.go +++ b/auction-dutch/chaincode-go/smart-contract/auctionQueries.go @@ -6,6 +6,7 @@ package auction import ( "encoding/json" + "errors" "fmt" "github.com/hyperledger/fabric-chaincode-go/v2/shim" @@ -20,7 +21,7 @@ func (s *SmartContract) QueryAuction(ctx contractapi.TransactionContextInterface return nil, fmt.Errorf("failed to get auction object %v: %v", auctionID, err) } if auctionJSON == nil { - return nil, fmt.Errorf("auction does not exist") + return nil, errors.New("auction does not exist") } var auction *Auction diff --git a/test-network/CHAINCODE_AS_A_SERVICE_TUTORIAL.md b/test-network/CHAINCODE_AS_A_SERVICE_TUTORIAL.md index 6482a64b..3e0bde81 100644 --- a/test-network/CHAINCODE_AS_A_SERVICE_TUTORIAL.md +++ b/test-network/CHAINCODE_AS_A_SERVICE_TUTORIAL.md @@ -14,7 +14,7 @@ We need to use the latest 2.4.1 release as this contains some improvements to ma - The `ccaasbuilder` applications are included in the binary tgz archive download for use in other circumstances. The `sampleconfig/core.yaml` is updated as well to refer to 'ccaasbuilder' - The 2.4.1 Java Chaincode release has been updated to remove the need to write a custom bootstrap main class, similar to the Node.js Chaincode. It is intended that this will be added to the go chaincode as well. -## End-to-end with the the test-network +## End-to-end with the test-network The `test-network` and some of the chaincodes have been updated to support running chaincode-as-a-service. The commands below assume that you've got the latest fabric-samples cloned, along with the latest Fabric docker images. @@ -181,7 +181,7 @@ For Java please note: In the traditional approach, each peer that the chaincode is approved on will have a container running the chaincode. With the '-as-a-service' approach we need to achieve the same architecture. As the `connection.json` contains the address of the running chaincode container, it can be updated to ensure that each peer connects to a different container. However the as the `connection.json` in the chaincode package, Fabric mandates that the package id is consistent amongst all peers in an organization. To achieve that -the the external builder supports a template capability. The context from this template is taken from an environment variable set on each Peer. `CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG` +the external builder supports a template capability. The context from this template is taken from an environment variable set on each Peer. `CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG` We can define the address to be a template in the `connection.json` diff --git a/token-erc-20/README.md b/token-erc-20/README.md index 0bc5b0c3..80314787 100644 --- a/token-erc-20/README.md +++ b/token-erc-20/README.md @@ -273,7 +273,7 @@ cp "${PWD}/organizations/peerOrganizations/org1.example.com/msp/config.yaml" "${ The minter intends to approve 500 tokens to be transferred by the spender, but first the spender needs to provide their own client ID as the payment address. -Open a 3rd terminal to represent the spender in Org1 and navigate to fabric-samples/test-network. Set the the environment variables for the Org1 spender user. +Open a 3rd terminal to represent the spender in Org1 and navigate to fabric-samples/test-network. Set the environment variables for the Org1 spender user. ``` export PATH=${PWD}/../bin:${PWD}:$PATH diff --git a/token-erc-20/chaincode-go/chaincode/token_contract.go b/token-erc-20/chaincode-go/chaincode/token_contract.go index 388da934..677ee443 100644 --- a/token-erc-20/chaincode-go/chaincode/token_contract.go +++ b/token-erc-20/chaincode-go/chaincode/token_contract.go @@ -43,7 +43,7 @@ func (s *SmartContract) Mint(ctx contractapi.TransactionContextInterface, amount return fmt.Errorf("failed to check if contract is already initialized: %v", err) } if !initialized { - return fmt.Errorf("Contract options need to be set before calling any function, call Initialize() to initialize contract") + return errors.New("Contract options need to be set before calling any function, call Initialize() to initialize contract") } // Check minter authorization - this sample assumes Org1 is the central banker with privilege to mint new tokens @@ -52,7 +52,7 @@ func (s *SmartContract) Mint(ctx contractapi.TransactionContextInterface, amount return fmt.Errorf("failed to get MSPID: %v", err) } if clientMSPID != "Org1MSP" { - return fmt.Errorf("client is not authorized to mint new tokens") + return errors.New("client is not authorized to mint new tokens") } // Get ID of submitting client identity @@ -62,7 +62,7 @@ func (s *SmartContract) Mint(ctx contractapi.TransactionContextInterface, amount } if amount <= 0 { - return fmt.Errorf("mint amount must be a positive integer") + return errors.New("mint amount must be a positive integer") } currentBalanceBytes, err := ctx.GetStub().GetState(minter) @@ -141,7 +141,7 @@ func (s *SmartContract) Burn(ctx contractapi.TransactionContextInterface, amount return fmt.Errorf("failed to check if contract is already initialized: %v", err) } if !initialized { - return fmt.Errorf("Contract options need to be set before calling any function, call Initialize() to initialize contract") + return errors.New("Contract options need to be set before calling any function, call Initialize() to initialize contract") } // Check minter authorization - this sample assumes Org1 is the central banker with privilege to burn new tokens clientMSPID, err := ctx.GetClientIdentity().GetMSPID() @@ -149,7 +149,7 @@ func (s *SmartContract) Burn(ctx contractapi.TransactionContextInterface, amount return fmt.Errorf("failed to get MSPID: %v", err) } if clientMSPID != "Org1MSP" { - return fmt.Errorf("client is not authorized to mint new tokens") + return errors.New("client is not authorized to mint new tokens") } // Get ID of submitting client identity @@ -719,7 +719,7 @@ func checkInitialized(ctx contractapi.TransactionContextInterface) (bool, error) // sub two number checking for overflow func sub(b int, q int) (int, error) { - // sub two number checking + // sub two number checking if q <= 0 { return 0, fmt.Errorf("Error: the subtraction number is %d, it should be greater than 0", q) } diff --git a/token-erc-721/README.md b/token-erc-721/README.md index 2fc60f0e..d6e13983 100644 --- a/token-erc-721/README.md +++ b/token-erc-721/README.md @@ -274,7 +274,7 @@ cp ${PWD}/organizations/peerOrganizations/org1.example.com/msp/config.yaml ${PWD The minter intends to approve a non-fungible token to be transferred by the operator, but first the operator needs to provide their own client ID as the payment address. -Open a 3rd terminal to represent the operator in Org1 and navigate to fabric-samples/test-network. Set the the environment variables for the Org1 operator user. +Open a 3rd terminal to represent the operator in Org1 and navigate to fabric-samples/test-network. Set the environment variables for the Org1 operator user. ``` export PATH=${PWD}/../bin:${PWD}:$PATH @@ -304,7 +304,7 @@ And then request the approval for the operator to transfer the token. ``` # Issue a new token -peer chaincode invoke $TARGET_TLS_OPTIONS -C mychannel -n token_erc721 -c '{"function":"MintWithTokenURI","Args":["102", "https://example.com/nft102.json"]}' --waitForEvent +peer chaincode invoke $TARGET_TLS_OPTIONS -C mychannel -n token_erc721 -c '{"function":"MintWithTokenURI","Args":["102", "https://example.com/nft102.json"]}' --waitForEvent # The owner approves export OPERATOR="x509::/C=US/ST=North Carolina/O=Hyperledger/OU=client/CN=operator::/C=US/ST=North Carolina/L=Durham/O=org1.example.com/CN=ca.org1.example.com" diff --git a/token-erc-721/chaincode-java/src/main/java/org/hyperledger/fabric/samples/erc721/ERC721TokenContract.java b/token-erc-721/chaincode-java/src/main/java/org/hyperledger/fabric/samples/erc721/ERC721TokenContract.java index 5aa2c159..322b84e5 100644 --- a/token-erc-721/chaincode-java/src/main/java/org/hyperledger/fabric/samples/erc721/ERC721TokenContract.java +++ b/token-erc-721/chaincode-java/src/main/java/org/hyperledger/fabric/samples/erc721/ERC721TokenContract.java @@ -445,7 +445,7 @@ public class ERC721TokenContract implements ContractInterface { } /** - * Get the the NFT details by token id. + * Get the NFT details by token id. * * @param ctx the transaction context * @param tokenId Unique ID of a non-fungible token diff --git a/token-utxo/README.md b/token-utxo/README.md index 1d9adb04..6517b622 100644 --- a/token-utxo/README.md +++ b/token-utxo/README.md @@ -44,7 +44,7 @@ Now you are ready to call the deployed smart contract via peer CLI calls. But le The smart contract supports UTXO ownership based on individual client identities from organizations that are members of the channel. In our scenario, the minter of the tokens will be a member of Org1, while the recipient will belong to Org2. To highlight the connection between the `GetClientIdentity().GetID()` API and the information within a user's certificate, we will register two new identities using the Org1 and Org2 Certificate Authorities (CA's), and then use the CA's to generate each identity's certificate and private key. -First, we need to set the following environment variables to use the the Fabric CA client (and subsequent commands) +First, we need to set the following environment variables to use the Fabric CA client (and subsequent commands) ``` export PATH=${PWD}/../bin:${PWD}:$PATH export FABRIC_CFG_PATH=$PWD/../config/