Skip to content

Commit b14c2cf

Browse files
Merge pull request #82 from kaleido-io/estimate-gas-api
Add GasEstimate FFCAPI call
2 parents 0e61106 + 4dcf6a6 commit b14c2cf

File tree

3 files changed

+65
-2
lines changed

3 files changed

+65
-2
lines changed

mocks/ffcapimocks/api.go

+34-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/ffcapi/api.go

+4-1
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
//
@@ -40,6 +40,9 @@ type API interface {
4040
// NextNonceForSigner is used when there are no outstanding transactions for a given signing identity, to determine the next nonce to use for submission of a transaction
4141
NextNonceForSigner(ctx context.Context, req *NextNonceForSignerRequest) (*NextNonceForSignerResponse, ErrorReason, error)
4242

43+
// GasEstimate provides an estimate of the gas required for the given transaction
44+
GasEstimate(ctx context.Context, req *TransactionInput) (*GasEstimateResponse, ErrorReason, error)
45+
4346
// GasPriceEstimate provides a blockchain specific gas price estimate
4447
GasPriceEstimate(ctx context.Context, req *GasPriceEstimateRequest) (*GasPriceEstimateResponse, ErrorReason, error)
4548

pkg/ffcapi/gas_estimate.go

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Copyright © 2023 Kaleido, Inc.
2+
//
3+
// SPDX-License-Identifier: Apache-2.0
4+
//
5+
// Licensed under the Apache License, Version 2.0 (the "License");
6+
// you may not use this file except in compliance with the License.
7+
// You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing, software
12+
// distributed under the License is distributed on an "AS IS" BASIS,
13+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
// See the License for the specific language governing permissions and
15+
// limitations under the License.
16+
17+
package ffcapi
18+
19+
import "github.com/hyperledger/firefly-common/pkg/fftypes"
20+
21+
type GasEstimateRequest struct {
22+
TransactionInput
23+
}
24+
25+
type GasEstimateResponse struct {
26+
GasEstimate *fftypes.FFBigInt `json:"gasEstimate"`
27+
}

0 commit comments

Comments
 (0)