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

Проблема:

Я создал и развернул бизнес-сеть в https://composer-playground.mybluemix.net. Там я могу создать участника и активы, как я ожидал. Но кнопка «Отправить транзакцию» отключена.

Это мой файл .cto. Где я написал модель бизнес-сети.

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

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

1 Ответ

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

Проблема в файле Model(.cto).

Вы не можете использовать abstract с транзакцией , просто удалите ключевое слово abstract.

transaction UnlockLandTitle {
   --> LandTitle landTitle
} 
...