1

I'm following a tutorial for Hyperledger Composer on IBM Blockchain I'm stuck in that error

This is the transaction:

{
  "$class": "org.acme.vehicle.auction.Offer",
  "bidPrice": 6000,
  "listing": "resource:org.acme.vehicle.auction.VehicleListing#1304",
  "member": "resource:org.acme.vehicle.auction.Member#alice@email.com"
}

1304 is an id of a VehicleListing and alice@mail.com is an user i've inserted before.

This is the transaction process function:

/**
 * Make an Offer for a VehicleListing
 * @param {org.acme.vehicle.auction.Offer} offer - the offer
 * @transaction
 */
async function makeOffer(offer) { 
    let listing = offer.listing;
    if (listing.state !== 'FOR_SALE') {
        throw new Error('Listing is not FOR SALE');
    }
    if (!listing.offers) {
        listing.offers = [];
    }
    listing.offers.push(offer);


    const vehicleListingRegistry = await getAssetRegistry('org.acme.vehicle.auction.VehicleListing');
    await vehicleListingRegistry.update(listing);
}

and this is the model:

asset VehicleListing identified by listingId {
  o String listingId
  o Double reservePrice
  o String description
  o ListingState state
  o Offer[] offers optional
  --> Vehicle vehicle
}


abstract participant User identified by email {
  o String email
  o String firstname
  o String lastname
}

participant Member extends User {
  o Double balance
} 

transaction Offer {
  o Double bidPrice
  --> VehicleListing listing
  --> Member member
}
Braiam
  • 1
  • 11
  • 47
  • 78

0 Answers0