Skip to content

Commit b3f786f

Browse files
authored
Merge pull request #61 from hyperledger/contract-location
Add contractLocation field to transaction output
2 parents 8f3be12 + 1f0341c commit b3f786f

File tree

4 files changed

+12
-5
lines changed

4 files changed

+12
-5
lines changed

pkg/apitypes/managed_tx.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,9 @@ type ReplyHeaders struct {
161161
// latest status change. Full status for a transaction must be retrieved with
162162
// /transactions/{txid}
163163
type TransactionUpdateReply struct {
164-
Headers ReplyHeaders `json:"headers"`
165-
Status TxStatus `json:"status"`
166-
ProtocolID string `json:"protocolId"`
167-
TransactionHash string `json:"transactionHash,omitempty"`
164+
Headers ReplyHeaders `json:"headers"`
165+
Status TxStatus `json:"status"`
166+
ProtocolID string `json:"protocolId"`
167+
TransactionHash string `json:"transactionHash,omitempty"`
168+
ContractLocation *fftypes.JSONAny `json:"contractLocation,omitempty"`
168169
}

pkg/ffcapi/transaction_receipt.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright © 2022 Kaleido, Inc.
1+
// Copyright © 2023 Kaleido, Inc.
22
//
33
// SPDX-License-Identifier: Apache-2.0
44
//
@@ -31,4 +31,5 @@ type TransactionReceiptResponse struct {
3131
Success bool `json:"success"`
3232
ProtocolID string `json:"protocolId"`
3333
ExtraInfo *fftypes.JSONAny `json:"extraInfo"`
34+
ContractLocation *fftypes.JSONAny `json:"contractLocation"`
3435
}

pkg/fftm/policyloop.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,10 @@ func (m *manager) sendWSReply(mtx *apitypes.ManagedTX) {
300300
TransactionHash: mtx.TransactionHash,
301301
}
302302

303+
if mtx.Receipt != nil && mtx.Receipt.ContractLocation != nil {
304+
wsr.ContractLocation = mtx.Receipt.ContractLocation
305+
}
306+
303307
if mtx.Receipt != nil {
304308
wsr.ProtocolID = mtx.Receipt.ProtocolID
305309
} else {

pkg/fftm/policyloop_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ func TestPolicyLoopE2EOk(t *testing.T) {
9292
BlockHash: fftypes.NewRandB32().String(),
9393
ProtocolID: fmt.Sprintf("%.12d/%.6d", fftypes.NewFFBigInt(12345).Int64(), fftypes.NewFFBigInt(10).Int64()),
9494
Success: true,
95+
ContractLocation: fftypes.JSONAnyPtr(`{"address": "0x24746b95d118b2b4e8d07b06b1bad988fbf9415d"}`),
9596
})
9697
n.Transaction.Confirmed(context.Background(), []confirmations.BlockInfo{})
9798
}).Return(nil)

0 commit comments

Comments
 (0)