Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(examples/cbdc): fix mismatch of fabric identities #2912

Merged
merged 1 commit into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
{
"info": {
{ "info": {
"description": "this file contains data to be used for testing purposes only. It should not be changed. It should remain consistent with the crypto material in the fabric chaincode"
},
"accounts": {
"userA": {
"ethAddress": "0x1A86D6f4b5D30A07D1a94bb232eF916AFe5DbDbc",
"privateKey": "0xb47c3ba5a816dbbb2271db721e76e6c80e58fe54972d26a42f00bc97a92a2535",
"fabricID": "x509::/OU=client/OU=org1/OU=department1/CN=userA::/C=US/ST=North Carolina/L=Durham/O=org1.example.com/CN=ca.org1.example.com"
"fabricID": "x509::/OU=org1/OU=client/OU=department1/CN=userA::/C=US/ST=North Carolina/L=Durham/O=org1.example.com/CN=ca.org1.example.com"
},
"bridge": {
"ethAddress": "0xf28d5769171bfbD2B3628d722e58129a6aE15022",
"privateKey": "0x2917bd3b0dced512d3555f171a0979fedd37bb0593883089396d9b893aa0505d",
"fabricID": "x509::/OU=client/OU=org2/OU=department1/CN=bridge::/C=UK/ST=Hampshire/L=Hursley/O=org2.example.com/CN=ca.org2.example.com"
"fabricID": "x509::/OU=org2/OU=client/OU=department1/CN=bridge::/C=UK/ST=Hampshire/L=Hursley/O=org2.example.com/CN=ca.org2.example.com"
},
"userB": {
"ethAddress": "0xB264c626D7D09789AbfD2a431A28a054366e7b63",
"privateKey": "0xfe95d40663e60e9a8a2e1f4153c9e207ac26d928e8a5631647735d91e93be402",
"fabricID": "x509::/OU=client/OU=org1/OU=department1/CN=userB::/C=US/ST=North Carolina/L=Durham/O=org1.example.com/CN=ca.org1.example.com"
"fabricID": "x509::/OU=org1/OU=client/OU=department1/CN=userB::/C=US/ST=North Carolina/L=Durham/O=org1.example.com/CN=ca.org1.example.com"
}
},
"gateways": {
Expand All @@ -37,4 +36,4 @@
"id": "d741fb4a-c95c-4205-8afa-758a9423234f"
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ import * as sinonChai from "sinon-chai";
const bridgedOutAmountKey = "amountBridgedOut";

const USER_A_FABRIC_ID =
"x509::/OU=client/OU=org1/OU=department1/CN=userA::/C=US/ST=North Carolina/L=Durham/O=org1.example.com/CN=ca.org1.example.com";
"x509::/OU=org1/OU=client/OU=department1/CN=userA::/C=US/ST=North Carolina/L=Durham/O=org1.example.com/CN=ca.org1.example.com";

const USER_A_ETH_ADDRESS =
"x509::/OU=client/OU=org1/OU=department1/CN=userA::/C=US/ST=North Carolina/L=Durham/O=org1.example.com/CN=ca.org1.example.com";
"x509::/OU=org1/OU=client/OU=department1/CN=userA::/C=US/ST=North Carolina/L=Durham/O=org1.example.com/CN=ca.org1.example.com";

chai.should();
chai.use(chaiAsPromised);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@
"userA": {
"ethAddress": "0x1A86D6f4b5D30A07D1a94bb232eF916AFe5DbDbc",
"privateKey": "0xb47c3ba5a816dbbb2271db721e76e6c80e58fe54972d26a42f00bc97a92a2535",
"fabricID": "x509::/OU=client/OU=org1/OU=department1/CN=userA::/C=US/ST=North Carolina/L=Durham/O=org1.example.com/CN=ca.org1.example.com"
"fabricID": "x509::/OU=org1/OU=client/OU=department1/CN=userA::/C=US/ST=North Carolina/L=Durham/O=org1.example.com/CN=ca.org1.example.com"
},
"bridge": {
"ethAddress": "0xf28d5769171bfbD2B3628d722e58129a6aE15022",
"privateKey": "0x2917bd3b0dced512d3555f171a0979fedd37bb0593883089396d9b893aa0505d",
"fabricID": "x509::/OU=client/OU=org2/OU=department1/CN=bridge::/C=UK/ST=Hampshire/L=Hursley/O=org2.example.com/CN=ca.org2.example.com"
"fabricID": "x509::/OU=org2/OU=client/OU=department1/CN=bridge::/C=UK/ST=Hampshire/L=Hursley/O=org2.example.com/CN=ca.org2.example.com"
},
"userB": {
"ethAddress": "0xB264c626D7D09789AbfD2a431A28a054366e7b63",
"privateKey": "0xfe95d40663e60e9a8a2e1f4153c9e207ac26d928e8a5631647735d91e93be402",
"fabricID": "x509::/OU=client/OU=org1/OU=department1/CN=userB::/C=US/ST=North Carolina/L=Durham/O=org1.example.com/CN=ca.org1.example.com"
"fabricID": "x509::/OU=org1/OU=client/OU=department1/CN=userB::/C=US/ST=North Carolina/L=Durham/O=org1.example.com/CN=ca.org1.example.com"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -373,10 +373,12 @@ class TokenERC20Contract extends Contract {
* @param {Integer} amount amount of tokens to be minted
* @returns {Object} The balance
*/
async Mint(ctx, amount, minter) {
async Mint(ctx, amount) {
//check contract options are already set first to execute the function
await this.CheckInitialized(ctx);

const minter = ctx.clientIdentity.getID();

// Check minter authorization - this sample assumes Org1 is the central banker with privilege to mint new tokens
const clientMSPID = ctx.clientIdentity.getMSPID();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,12 @@ 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(), fabricID],
params: [amount.toString()],
methodName: "Mint",
invocationType: "FabricContractInvocationType.SEND",
signingCredential: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@
"userA": {
"ethAddress": "0x1A86D6f4b5D30A07D1a94bb232eF916AFe5DbDbc",
"privateKey": "0xb47c3ba5a816dbbb2271db721e76e6c80e58fe54972d26a42f00bc97a92a2535",
"fabricID": "x509::/OU=client/OU=org1/OU=department1/CN=userA::/C=US/ST=North Carolina/L=Durham/O=org1.example.com/CN=ca.org1.example.com"
"fabricID": "x509::/OU=org1/OU=client/OU=department1/CN=userA::/C=US/ST=North Carolina/L=Durham/O=org1.example.com/CN=ca.org1.example.com"
},
"bridge": {
"ethAddress": "0xf28d5769171bfbD2B3628d722e58129a6aE15022",
"privateKey": "0x2917bd3b0dced512d3555f171a0979fedd37bb0593883089396d9b893aa0505d",
"fabricID": "x509::/OU=client/OU=org2/OU=department1/CN=bridge::/C=UK/ST=Hampshire/L=Hursley/O=org2.example.com/CN=ca.org2.example.com"
"fabricID": "x509::/OU=org2/OU=client/OU=department1/CN=bridge::/C=UK/ST=Hampshire/L=Hursley/O=org2.example.com/CN=ca.org2.example.com"
},
"userB": {
"ethAddress": "0xB264c626D7D09789AbfD2a431A28a054366e7b63",
"privateKey": "0xfe95d40663e60e9a8a2e1f4153c9e207ac26d928e8a5631647735d91e93be402",
"fabricID": "x509::/OU=client/OU=org1/OU=department1/CN=userB::/C=US/ST=North Carolina/L=Durham/O=org1.example.com/CN=ca.org1.example.com"
"fabricID": "x509::/OU=org1/OU=client/OU=department1/CN=userB::/C=US/ST=North Carolina/L=Durham/O=org1.example.com/CN=ca.org1.example.com"
}
},
"gateways": {
Expand Down
Loading