温馨提示:本文翻译自stackoverflow.com,查看原文请点击:其他 - How to connect Azure Blockchain Service and Logic app with "When a smart contract event occurs" trig
azure azure-logic-apps azureblockchainservice

其他 - 如何通过“当智能合约事件发生时”触发来连接Azure区块链服务和逻辑应用程序

发布于 2020-04-22 14:31:02

我的工作流程是这样的。

一种

输入日志

{
    "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的连接设置是否正确,并成功进行了设置。

“发生合同合同事件时”事件只会失败,因此我认为问题与智能合同事件设置有关。

查看更多

提问者
久保圭司
被浏览
40
久保圭司 2020-02-06 21:10

消除indexed修正修正的问题。

address indexed _from

address _from