0
我正在嘗試進行一項Composer交易,該交易指定了作爲交易參數引入的資產,它將搜索另一種具有一些通用參數的資產類型。搜索交易中的特定資產
型號:
namespace org.acme.sample
abstract asset Generic identified by ID {
o String ID
--> Owner owner
}
asset Asset1 extends Generic{
o Boolean done
}
asset Asset2 extends Generic{
}
participant Owner identified by ownerID{
o String ownerID
o String ownerName
}
transaction Transaction {
--> Asset2 in
}
因此,鑑於這種模式,我想要做的是以下(這樣的事情,至少):
function Transaction (tx){
var aux = query('org.acme.sample.Asset1', {owner.ownerID : tx.in.owner.ownerID})
aux.done = true
return getAssetRegistry('org.acme.sample.Asset1')
.then(function (assetRegistry) {
return assetRegistry.update(aux);
})
}
這是更接近僞代碼比其他任何東西都好(我不認爲查詢是這樣工作的,但那是我的很大不確定性) 讓我們假設查詢足夠精確以找到一個有效資產。
理論上,這會在輔助資產1中放置一個與參數中給定的資產2相同的所有者ID,並且它將更改其完成的布爾值。問題是,我嘗試的所有東西都無法工作,我不知道如何在事務內部使用這樣的查詢(我也試着做一個單獨的查詢,但我沒有使它工作)。
我希望別人的能幫助我:d
你需要閱讀查詢文件和描述你」已經嘗試過,您收到的錯誤包括指向您的代碼的鏈接,以便我們可以爲您提供幫助。 –