我正在尝试使用事务创建资产,但它会抛出错误:
Error: Invalid or missing identifier for Type Temp in namespace org.acme.mynetwork
昨天我更新了我的节点包,但是它无法正常工作。任何领导都将不胜感激。
型号:
namespace org.acme.mynetwork
asset Temp identified by id {
o String id
}
transaction Test {}
脚本:
/**
* blah
* @param {org.acme.mynetwork.Test} blah
* @transaction
*/
async function Test() {
let factory = getFactory()
let registry = await getAssetRegistry("org.acme.mynetwork.Temp")
let resource = factory.newResource("org.acme.mynetwork","Temp",1) //Error
await registry.add(resource)
}
访问控制
rule Default {
description: "Allow all participants access to all resources"
participant: "ANY"
operation: ALL
resource: "org.acme.mynetwork.*"
action: ALLOW
}
rule SystemACL {
description: "System ACL to permit all access"
participant: "ANY"
operation: ALL
resource: "org.hyperledger.composer.system.**"
action: ALLOW
}
感谢。
答案 0 :(得分:3)
您的标识符是字符串
因此(在https://composer-playground-next.mybluemix.net/
在线编辑器v0.18.x中进行了测试 /**
* blah
* @param {org.acme.trading.Test} blah
* @transaction
*/
async function Test() {
let factory = getFactory();
let registry = await getAssetRegistry("org.acme.trading.Temp");
let resource = factory.newResource("org.acme.trading","Temp", 't1');
await registry.add(resource);
}