Skip to content

Commit a2cf588

Browse files
authored
Merge pull request #308 from emilic/edmilic/add-block-height-to-txresult
Add BlockHeight to TransactionResult
2 parents 900f9f9 + e9f2dcd commit a2cf588

5 files changed

Lines changed: 17 additions & 12 deletions

File tree

access/grpc/convert.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,7 @@ func transactionResultToMessage(result flow.TransactionResult) (*access.Transact
500500
ErrorMessage: errorMsg,
501501
Events: eventMessages,
502502
BlockId: identifierToMessage(result.BlockID),
503+
BlockHeight: result.BlockHeight,
503504
}, nil
504505
}
505506

@@ -529,9 +530,10 @@ func messageToTransactionResult(m *access.TransactionResultResponse, options []j
529530
}
530531

531532
return flow.TransactionResult{
532-
Status: flow.TransactionStatus(m.GetStatus()),
533-
Error: err,
534-
Events: events,
535-
BlockID: flow.BytesToID(m.GetBlockId()),
533+
Status: flow.TransactionStatus(m.GetStatus()),
534+
Error: err,
535+
Events: events,
536+
BlockID: flow.BytesToID(m.GetBlockId()),
537+
BlockHeight: m.BlockHeight,
536538
}, nil
537539
}

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ require (
77
github.com/ethereum/go-ethereum v1.9.13
88
github.com/onflow/cadence v0.24.2-0.20220627202951-5a06fec82b4a
99
github.com/onflow/flow-go/crypto v0.24.3
10-
github.com/onflow/flow/protobuf/go/flow v0.2.5
10+
github.com/onflow/flow/protobuf/go/flow v0.3.1
1111
github.com/onflow/sdks v0.4.4
1212
github.com/pkg/errors v0.9.1
1313
github.com/stretchr/testify v1.7.5

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,8 +289,8 @@ github.com/onflow/cadence v0.24.2-0.20220627202951-5a06fec82b4a h1:Wr7+zfFj7ehr3
289289
github.com/onflow/cadence v0.24.2-0.20220627202951-5a06fec82b4a/go.mod h1:g19FlFrcQsiegiZDe6wYtUCBO8O1hM1x/+l68aVO07k=
290290
github.com/onflow/flow-go/crypto v0.24.3 h1:5puosmiy853m1GPmBLJr4PiLVcCzE4n5o60hRPo9kYA=
291291
github.com/onflow/flow-go/crypto v0.24.3/go.mod h1:dkVL98P6GHR48iD9zCB6XlnkJX8IQd00FKgt1reV90w=
292-
github.com/onflow/flow/protobuf/go/flow v0.2.5 h1:IzkN5f3w/qFN2Mshc1I0yNgnT+YbFE5Htz/h8t/VL4c=
293-
github.com/onflow/flow/protobuf/go/flow v0.2.5/go.mod h1:gQxYqCfkI8lpnKsmIjwtN2mV/N2PIwc1I+RUK4HPIc8=
292+
github.com/onflow/flow/protobuf/go/flow v0.3.1 h1:4I8ykG6naR3n8Or6eXrZDaGVaoztb3gP2KJ6XKyDufg=
293+
github.com/onflow/flow/protobuf/go/flow v0.3.1/go.mod h1:gQxYqCfkI8lpnKsmIjwtN2mV/N2PIwc1I+RUK4HPIc8=
294294
github.com/onflow/sdks v0.4.4 h1:aJPGJJLAN+mlBWAQxsyuJXeRRMFeLwU6Mp4e/YL6bdU=
295295
github.com/onflow/sdks v0.4.4/go.mod h1:F0dj0EyHC55kknLkeD10js4mo14yTdMotnWMslPirrU=
296296
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=

test/entities.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,7 @@ func (g *TransactionResults) New() flow.TransactionResult {
421421
eventA := g.events.New()
422422
eventB := g.events.New()
423423
blockID := newIdentifier(1)
424+
blockHeight := uint64(42)
424425

425426
return flow.TransactionResult{
426427
Status: flow.TransactionStatusSealed,
@@ -429,6 +430,7 @@ func (g *TransactionResults) New() flow.TransactionResult {
429430
eventA,
430431
eventB,
431432
},
432-
BlockID: blockID,
433+
BlockID: blockID,
434+
BlockHeight: blockHeight,
433435
}
434436
}

transaction.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -609,10 +609,11 @@ func (s signaturesList) canonicalForm() []transactionSignatureCanonicalForm {
609609
}
610610

611611
type TransactionResult struct {
612-
Status TransactionStatus
613-
Error error
614-
Events []Event
615-
BlockID Identifier
612+
Status TransactionStatus
613+
Error error
614+
Events []Event
615+
BlockID Identifier
616+
BlockHeight uint64
616617
}
617618

618619
// TransactionStatus represents the status of a transaction.

0 commit comments

Comments
 (0)