Hyperledger Composer:使用 JQuery 和 HTML 创建交易
Hyperledger Composer : Create Transaction using JQuery and HTML
我正在使用 html 和 jquery 为示例业务网络创建前端。到目前为止,我能够使用前端创建资产、搜索和删除资产。
我在使用交易创建资产时遇到问题。
这是商业模式文件
namespace org.acme.chequebook
asset Cheque identified by chequeNumber {
o String chequeNumber
}
transaction CreateCheque{
o String chequeNumber
}
这是脚本
$("#myChequeCreateButton").click(function(){
var obj={
"$class": "org.acme.chequebook.CreateCheque",
"chequeNumber":$("#inputChequeNumber").val(),
"transactionId":"",
"timestamp":"",
}
$.post('http://localhost:3000/api/CreateCheque',obj).done(function(res){
}).fail(function(res){
})
})
我了解到 transactionId 和 timestamp 是在交易执行时自动分配的。所以我很困惑我应该如何处理它。
当我尝试提交此 事务时 它产生以下错误
jquery.min.js:2 POST http://localhost:3000/api/CreateCheque 422 (Unprocessable Entity)
确认答案是简单地删除字段 "transactionId" 和 "timestamp"
我正在使用 html 和 jquery 为示例业务网络创建前端。到目前为止,我能够使用前端创建资产、搜索和删除资产。
我在使用交易创建资产时遇到问题。
这是商业模式文件
namespace org.acme.chequebook
asset Cheque identified by chequeNumber {
o String chequeNumber
}
transaction CreateCheque{
o String chequeNumber
}
这是脚本
$("#myChequeCreateButton").click(function(){
var obj={
"$class": "org.acme.chequebook.CreateCheque",
"chequeNumber":$("#inputChequeNumber").val(),
"transactionId":"",
"timestamp":"",
}
$.post('http://localhost:3000/api/CreateCheque',obj).done(function(res){
}).fail(function(res){
})
})
我了解到 transactionId 和 timestamp 是在交易执行时自动分配的。所以我很困惑我应该如何处理它。
当我尝试提交此 事务时 它产生以下错误
jquery.min.js:2 POST http://localhost:3000/api/CreateCheque 422 (Unprocessable Entity)
确认答案是简单地删除字段 "transactionId" 和 "timestamp"