如何使用 "When a smart contract event occurs" 触发器连接 Azure 区块链服务和逻辑应用程序
How to connect Azure Blockchain Service and Logic app with "When a smart contract event occurs" trigger
我的工作流程是这样的。
输入日志
{
"method": "get",
"queries": {
"abi": "[\n {\n \"inputs\": [],\n \"payable\": false,\n \"stateMutability\": \"nonpayable\",\n \"type\": \"constructor\"\n },\n {\n \"anonymous\": false,\n \"inputs\": [\n {\n \"indexed\": true,\n \"internalType\": \"address\",\n \"name\": \"_from\",\n \"type\": \"address\"\n },\n {\n \"indexed\": true,\n \"internalType\": \"address\",\n \"name\": \"_to\",\n \"type\": \"address\"\n },\n {\n \"indexed\": false,\n \"internalType\": \"uint256\",\n \"name\": \"_value\",\n \"type\": \"uint256\"\n }\n ],\n \"name\": \"Transfer\",\n \"type\": \"event\"\n },\n {\n \"constant\": false,\n \"inputs\": [\n {\n \"internalType\": \"address\",\n \"name\": \"receiver\",\n \"type\": \"address\"\n },\n {\n \"internalType\": \"uint256\",\n \"name\": \"amount\",\n \"type\": \"uint256\"\n }\n ],\n \"name\": \"sendCoin\",\n \"outputs\": [\n {\n \"internalType\": \"bool\",\n \"name\": \"sufficient\",\n \"type\": \"bool\"\n }\n ],\n \"payable\": false,\n \"stateMutability\": \"nonpayable\",\n \"type\": \"function\"\n },\n {\n \"constant\": true,\n \"inputs\": [\n {\n \"internalType\": \"address\",\n \"name\": \"addr\",\n \"type\": \"address\"\n }\n ],\n \"name\": \"getBalanceInEth\",\n \"outputs\": [\n {\n \"internalType\": \"uint256\",\n \"name\": \"\",\n \"type\": \"uint256\"\n }\n ],\n \"payable\": false,\n \"stateMutability\": \"view\",\n \"type\": \"function\"\n },\n {\n \"constant\": true,\n \"inputs\": [\n {\n \"internalType\": \"address\",\n \"name\": \"addr\",\n \"type\": \"address\"\n }\n ],\n \"name\": \"getBalance\",\n \"outputs\": [\n {\n \"internalType\": \"uint256\",\n \"name\": \"\",\n \"type\": \"uint256\"\n }\n ],\n \"payable\": false,\n \"stateMutability\": \"view\",\n \"type\": \"function\"\n }\n ]",
"contractAddress": "0x03985eF62D7776bc5047A9Ee531aA0e7dbb5962c",
"eventName": "Transfer"
},
"path": "/contract/OnNewEvent",
"host": {
"connection": {
"name": "/subscriptions/90660d8a-4446-4255-a65f-9b0ff071c1df/resourceGroups/diggluegroup/providers/Microsoft.Web/connections/blockchainethereum-1"
}
}
}
输出日志
{
"statusCode": 500,
"headers": {
"Pragma": "no-cache",
"x-ms-request-id": "ba5917f1-3323-4c95-8898-b142e76c7f89",
"Strict-Transport-Security": "max-age=31536000; includeSubDomains",
"X-Content-Type-Options": "nosniff",
"X-Frame-Options": "DENY",
"Timing-Allow-Origin": "*",
"x-ms-apihub-cached-response": "true",
"Cache-Control": "no-store, no-cache",
"Date": "Thu, 06 Feb 2020 10:56:34 GMT",
"Set-Cookie": "ARRAffinity=7fec6b3d494d502cd339a098a470860ddaf458b68c32b8ce8e190c362de93b94;Path=/;HttpOnly;Domain=blockchainethereum-eus.azconn-eus-01.p.azurewebsites.net",
"Content-Length": "481",
"Content-Type": "application/json",
"Expires": "-1"
},
"body": {
"error": {
"code": 500,
"source": "logic-apis-eastus.azure-apim.net",
"clientRequestId": "ba5917f1-3323-4c95-8898-b142e76c7f89",
"message": "BadGateway",
"innerError": {
"status": 500,
"message": "Source array was not long enough. Check srcIndex and length, and the array's lower bounds.\r\nclientRequestId: ba5917f1-3323-4c95-8898-b142e76c7f89",
"source": "blockchainethereum-eus.azconn-eus-01.p.azurewebsites.net"
}
}
}
}
我知道没有足够的信息可以知道问题出在哪里,但是任何人都可以给出一些关于问题可能出在哪里的提示。
我从 RPC 创建交易并且肯定会触发智能合约事件。
我通过其他 Logic 应用程序检查 SQL 的连接设置是否正确,结果成功了。
'When a samrt contract event occurs' Event only fails,所以我认为问题与智能合约事件设置有关。
删除 indexed
修正问题。
address indexed _from
到
address _from
这里是 blog post 如何 "Publishing and Subscribing to Azure Blockchain Services events using Azure Logic Apps"。希望对您有所帮助。
我已请求处理 indexed
修改器以支持。
我的工作流程是这样的。
输入日志
{
"method": "get",
"queries": {
"abi": "[\n {\n \"inputs\": [],\n \"payable\": false,\n \"stateMutability\": \"nonpayable\",\n \"type\": \"constructor\"\n },\n {\n \"anonymous\": false,\n \"inputs\": [\n {\n \"indexed\": true,\n \"internalType\": \"address\",\n \"name\": \"_from\",\n \"type\": \"address\"\n },\n {\n \"indexed\": true,\n \"internalType\": \"address\",\n \"name\": \"_to\",\n \"type\": \"address\"\n },\n {\n \"indexed\": false,\n \"internalType\": \"uint256\",\n \"name\": \"_value\",\n \"type\": \"uint256\"\n }\n ],\n \"name\": \"Transfer\",\n \"type\": \"event\"\n },\n {\n \"constant\": false,\n \"inputs\": [\n {\n \"internalType\": \"address\",\n \"name\": \"receiver\",\n \"type\": \"address\"\n },\n {\n \"internalType\": \"uint256\",\n \"name\": \"amount\",\n \"type\": \"uint256\"\n }\n ],\n \"name\": \"sendCoin\",\n \"outputs\": [\n {\n \"internalType\": \"bool\",\n \"name\": \"sufficient\",\n \"type\": \"bool\"\n }\n ],\n \"payable\": false,\n \"stateMutability\": \"nonpayable\",\n \"type\": \"function\"\n },\n {\n \"constant\": true,\n \"inputs\": [\n {\n \"internalType\": \"address\",\n \"name\": \"addr\",\n \"type\": \"address\"\n }\n ],\n \"name\": \"getBalanceInEth\",\n \"outputs\": [\n {\n \"internalType\": \"uint256\",\n \"name\": \"\",\n \"type\": \"uint256\"\n }\n ],\n \"payable\": false,\n \"stateMutability\": \"view\",\n \"type\": \"function\"\n },\n {\n \"constant\": true,\n \"inputs\": [\n {\n \"internalType\": \"address\",\n \"name\": \"addr\",\n \"type\": \"address\"\n }\n ],\n \"name\": \"getBalance\",\n \"outputs\": [\n {\n \"internalType\": \"uint256\",\n \"name\": \"\",\n \"type\": \"uint256\"\n }\n ],\n \"payable\": false,\n \"stateMutability\": \"view\",\n \"type\": \"function\"\n }\n ]",
"contractAddress": "0x03985eF62D7776bc5047A9Ee531aA0e7dbb5962c",
"eventName": "Transfer"
},
"path": "/contract/OnNewEvent",
"host": {
"connection": {
"name": "/subscriptions/90660d8a-4446-4255-a65f-9b0ff071c1df/resourceGroups/diggluegroup/providers/Microsoft.Web/connections/blockchainethereum-1"
}
}
}
输出日志
{
"statusCode": 500,
"headers": {
"Pragma": "no-cache",
"x-ms-request-id": "ba5917f1-3323-4c95-8898-b142e76c7f89",
"Strict-Transport-Security": "max-age=31536000; includeSubDomains",
"X-Content-Type-Options": "nosniff",
"X-Frame-Options": "DENY",
"Timing-Allow-Origin": "*",
"x-ms-apihub-cached-response": "true",
"Cache-Control": "no-store, no-cache",
"Date": "Thu, 06 Feb 2020 10:56:34 GMT",
"Set-Cookie": "ARRAffinity=7fec6b3d494d502cd339a098a470860ddaf458b68c32b8ce8e190c362de93b94;Path=/;HttpOnly;Domain=blockchainethereum-eus.azconn-eus-01.p.azurewebsites.net",
"Content-Length": "481",
"Content-Type": "application/json",
"Expires": "-1"
},
"body": {
"error": {
"code": 500,
"source": "logic-apis-eastus.azure-apim.net",
"clientRequestId": "ba5917f1-3323-4c95-8898-b142e76c7f89",
"message": "BadGateway",
"innerError": {
"status": 500,
"message": "Source array was not long enough. Check srcIndex and length, and the array's lower bounds.\r\nclientRequestId: ba5917f1-3323-4c95-8898-b142e76c7f89",
"source": "blockchainethereum-eus.azconn-eus-01.p.azurewebsites.net"
}
}
}
}
我知道没有足够的信息可以知道问题出在哪里,但是任何人都可以给出一些关于问题可能出在哪里的提示。
我从 RPC 创建交易并且肯定会触发智能合约事件。
我通过其他 Logic 应用程序检查 SQL 的连接设置是否正确,结果成功了。
'When a samrt contract event occurs' Event only fails,所以我认为问题与智能合约事件设置有关。
删除 indexed
修正问题。
address indexed _from
到
address _from
这里是 blog post 如何 "Publishing and Subscribing to Azure Blockchain Services events using Azure Logic Apps"。希望对您有所帮助。
我已请求处理 indexed
修改器以支持。