diff --git a/go.mod b/go.mod index 498e8bf..241058e 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/hashicorp/golang-lru v0.5.4 github.com/hyperledger/firefly-common v1.2.1 github.com/hyperledger/firefly-signer v1.1.4 - github.com/hyperledger/firefly-transaction-manager v1.2.2 + github.com/hyperledger/firefly-transaction-manager v1.2.3 github.com/sirupsen/logrus v1.9.0 github.com/spf13/cobra v1.4.0 github.com/stretchr/testify v1.8.1 diff --git a/go.sum b/go.sum index 000cb23..355296c 100644 --- a/go.sum +++ b/go.sum @@ -868,8 +868,8 @@ github.com/hyperledger/firefly-common v1.2.1 h1:h35T5Ask/ixlW70KZxHpPsO5QfdnKBFE github.com/hyperledger/firefly-common v1.2.1/go.mod h1:aqaq2ZUzSlkwVC/TF+pwUkHxGDLYSE2DzdozZ1MIMeM= github.com/hyperledger/firefly-signer v1.1.4 h1:Qpu1GLRWfsU3srtodGYqJ2LmZErYYJPstRLUlyh+zCg= github.com/hyperledger/firefly-signer v1.1.4/go.mod h1:4h2MN910A2knrWGYCT+aWjBDlhptgQn/9WcT1N/Ct8s= -github.com/hyperledger/firefly-transaction-manager v1.2.2 h1:X0YhLUkDGiqLgti9EhvO7qAzOxvXfw7sWpGNOmfOJ1o= -github.com/hyperledger/firefly-transaction-manager v1.2.2/go.mod h1:6WC9uQKtucZcEFcCPlUdan5gwuas8FbVYQoGUlYhJ/A= +github.com/hyperledger/firefly-transaction-manager v1.2.3 h1:Ah/kRBzc93kfbaK7PA8P8He6H2WTfs1wtWqupW7kzhM= +github.com/hyperledger/firefly-transaction-manager v1.2.3/go.mod h1:6WC9uQKtucZcEFcCPlUdan5gwuas8FbVYQoGUlYhJ/A= github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= diff --git a/internal/ethereum/get_receipt.go b/internal/ethereum/get_receipt.go index 4a65026..7f179fd 100644 --- a/internal/ethereum/get_receipt.go +++ b/internal/ethereum/get_receipt.go @@ -1,4 +1,4 @@ -// Copyright © 2022 Kaleido, Inc. +// Copyright © 2023 Kaleido, Inc. // // SPDX-License-Identifier: Apache-2.0 // @@ -117,13 +117,20 @@ func (c *ethConnector) TransactionReceipt(ctx context.Context, req *ffcapi.Trans if ethReceipt.TransactionIndex != nil { txIndex = ethReceipt.TransactionIndex.BigInt().Int64() } - return &ffcapi.TransactionReceiptResponse{ + receiptResponse := &ffcapi.TransactionReceiptResponse{ BlockNumber: (*fftypes.FFBigInt)(ethReceipt.BlockNumber), TransactionIndex: fftypes.NewFFBigInt(txIndex), BlockHash: ethReceipt.BlockHash.String(), Success: isSuccess, ProtocolID: ProtocolIDForReceipt((*fftypes.FFBigInt)(ethReceipt.BlockNumber), fftypes.NewFFBigInt(txIndex)), ExtraInfo: fftypes.JSONAnyPtrBytes(fullReceipt), - }, "", nil + } + if ethReceipt.ContractAddress != nil { + location, _ := json.Marshal(map[string]string{ + "address": ethReceipt.ContractAddress.String(), + }) + receiptResponse.ContractLocation = fftypes.JSONAnyPtrBytes(location) + } + return receiptResponse, "", nil } diff --git a/internal/ethereum/get_receipt_test.go b/internal/ethereum/get_receipt_test.go index 30b965c..fd08ce3 100644 --- a/internal/ethereum/get_receipt_test.go +++ b/internal/ethereum/get_receipt_test.go @@ -39,7 +39,7 @@ const sampleGetReceipt = `{ const sampleJSONRPCReceipt = `{ "blockHash": "0x6197ef1a58a2a592bb447efb651f0db7945de21aa8048801b250bd7b7431f9b6", "blockNumber": "0x7b9", - "contractAddress": null, + "contractAddress": "0x87ae94ab290932c4e6269648bb47c86978af4436", "cumulativeGasUsed": "0x8414", "effectiveGasPrice": "0x0", "from": "0x2b1c769ef5ad304a4889f2a07a6617cd935849ae",