Skip to content

Commit

Permalink
docs(examples/cbdc): fix mismatch of Fabric identities in GET, POST r…
Browse files Browse the repository at this point in the history
…equests

The state keys were not being generated correctly for some reason
It was working before without code changes so my best guess is that
the Fabric ledger/SDK versions were changed and that's what tripped it
up somehow.

Fixes hyperledger-cacti#2739

[skip ci]

Co-authored-by: Peter Somogyvari <[email protected]>

Signed-off-by: André Augusto <[email protected]>
Signed-off-by: Peter Somogyvari <[email protected]>
  • Loading branch information
AndreAugusto11 authored and sandeepnRES committed Oct 18, 2023
1 parent df4fb2f commit 43980b0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ class TokenERC20Contract extends Contract {
* @param {Integer} amount amount of tokens to be minted
* @returns {Object} The balance
*/
async Mint(ctx, amount) {
async Mint(ctx, amount, minter) {
//check contract options are already set first to execute the function
await this.CheckInitialized(ctx);

Expand All @@ -384,9 +384,6 @@ class TokenERC20Contract extends Contract {
throw new Error("client is not authorized to mint new tokens");
}

// Get ID of submitting client identity
const minter = ctx.clientIdentity.getID();

const amountInt = parseInt(amount);
if (amountInt <= 0) {
throw new Error("mint amount must be a positive integer");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@ export async function getFabricBalance(frontendUser) {
}

export async function mintTokensFabric(frontendUser, amount) {
const fabricID = getFabricId(frontendUser);

const response = await axios.post(
"http://localhost:4000/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/run-transaction",
{
contractName: FABRIC_CONTRACT_CBDC_ERC20_NAME,
channelName: FABRIC_CHANNEL_NAME,
params: [amount.toString()],
params: [amount.toString(), fabricID],
methodName: "Mint",
invocationType: "FabricContractInvocationType.SEND",
signingCredential: {
Expand Down

0 comments on commit 43980b0

Please sign in to comment.