Не удается развернуть модель бизнес-сети на площадке для композиторов? - PullRequest
0 голосов
/ 01 ноября 2018

Я очень новичок в Hyperledger Fabric works. Я построил бизнес-сеть, а затем создал файл .bna и попытался развернуть его на площадке для композиторов. Затем он показывает мне такую ​​ошибку.

Cannot import an invalid Business Network Definition. Found SyntaxError: Unexpected token (27:6)

Это модальный файл моей сети Business.

namespace org.landreg

abstract concept Address {
  o String addressLine
  o String locality
}

concept DutchAddress {
  o String postalCode regex=/\d{4}[ ]??[A-Z]{2}/
}

enum Gender {
  o FEMALE
  o MALE
}

participant Individual identified by passportNumber{
  o String passportNumber
  o DutchAddress address
  o Gender gender
}

asset  LandTitle identified by id {
  o String id
  o DutchAddress address
  o Integer area range=[1000,]
  o Boolean forSale default=false
  o Double price optional
  --> Individual owner
  --> Individual[] previousOwners
}

abstract transaction UnlockLandTitle {
  -->LandTitle landTitle
}

А это мой файл logic.js.

/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

"use strict";
/**
 * Write your transction processor functions here
 */

const NS = "org.landreg";

/**
 * Sample transaction
 * @param {org.landreg.UnlockLandTitle} //transaction object define in the cto file
 * @transaction
 */
async function unlockLandTitle(tx) {
  //Get asset registery for landTitles
  const landTitleRegistry = await getAssetRegistry(NS + ".LandTitle");

  if (tx.landTitle.forSale) {
    throw new Error(
      `Land Title with id ${tx.landTitle.getIdentifier()} is already unlocked for sale`
    );
  }

  // Unlock asset to be for sale 
  tx.landTitle.forSale = true;

  await landTitleRegistry.update(tx.landTitle);
}

Я ищу, но не смог найти подходящего ответа для своей проблемы. Может ли кто-нибудь помочь мне решить эту проблему? Спасибо.

Примечание: После того, как я получил предложение изменить свой код, добавив экземпляр транзакции в строке @Param, он показывается мне на игровой площадке. Может кто-нибудь дать мне больше решений, чтобы решить эту проблему? Большое спасибо!! enter image description here Проблема:

1 Ответ

0 голосов
/ 01 ноября 2018

Вы забыли написать unlockLandTitle в logic.js файле.

Просто замените эту строку:

* @param {org.landreg.UnlockLandTitle} //transaction object define in the cto file

с

 * @param {org.landreg.UnlockLandTitle} unlockLandTitle //transaction object define in the cto file
...