Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add contractLocation field to transaction output #61

Merged
merged 2 commits into from
Feb 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions pkg/apitypes/managed_tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,9 @@ type ReplyHeaders struct {
// latest status change. Full status for a transaction must be retrieved with
// /transactions/{txid}
type TransactionUpdateReply struct {
Headers ReplyHeaders `json:"headers"`
Status TxStatus `json:"status"`
ProtocolID string `json:"protocolId"`
TransactionHash string `json:"transactionHash,omitempty"`
Headers ReplyHeaders `json:"headers"`
Status TxStatus `json:"status"`
ProtocolID string `json:"protocolId"`
TransactionHash string `json:"transactionHash,omitempty"`
ContractLocation *fftypes.JSONAny `json:"contractLocation,omitempty"`
}
3 changes: 2 additions & 1 deletion pkg/ffcapi/transaction_receipt.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright © 2022 Kaleido, Inc.
// Copyright © 2023 Kaleido, Inc.
//
// SPDX-License-Identifier: Apache-2.0
//
Expand Down Expand Up @@ -31,4 +31,5 @@ type TransactionReceiptResponse struct {
Success bool `json:"success"`
ProtocolID string `json:"protocolId"`
ExtraInfo *fftypes.JSONAny `json:"extraInfo"`
ContractLocation *fftypes.JSONAny `json:"contractLocation"`
}
4 changes: 4 additions & 0 deletions pkg/fftm/policyloop.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,10 @@ func (m *manager) sendWSReply(mtx *apitypes.ManagedTX) {
TransactionHash: mtx.TransactionHash,
}

if mtx.Receipt != nil && mtx.Receipt.ContractLocation != nil {
wsr.ContractLocation = mtx.Receipt.ContractLocation
}

if mtx.Receipt != nil {
wsr.ProtocolID = mtx.Receipt.ProtocolID
} else {
Expand Down
1 change: 1 addition & 0 deletions pkg/fftm/policyloop_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ func TestPolicyLoopE2EOk(t *testing.T) {
BlockHash: fftypes.NewRandB32().String(),
ProtocolID: fmt.Sprintf("%.12d/%.6d", fftypes.NewFFBigInt(12345).Int64(), fftypes.NewFFBigInt(10).Int64()),
Success: true,
ContractLocation: fftypes.JSONAnyPtr(`{"address": "0x24746b95d118b2b4e8d07b06b1bad988fbf9415d"}`),
})
n.Transaction.Confirmed(context.Background(), []confirmations.BlockInfo{})
}).Return(nil)
Expand Down