ReferenceError:报价未定义-Hyperledger Composer IBM Blockchain

时间:2018-08-07 12:14:14

标签: ibm-cloud hyperledger-composer ibm-blockchain

我正在关注IBM Blockchain上Hyperledger Composer的教程 我陷入了那个错误

这是交易:

{
  "$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是VehicleListing的ID,而alice@mail.com是我之前插入的用户。

这是交易处理功能:

/**
 * 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);
}

这是模型:

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
}

0 个答案:

没有答案