mirror of
https://github.com/status-im/status-go.git
synced 2026-08-31 09:01:16 +00:00
Part of the Go project layout migration, item 31. Pure move plus import-path rewrite across 687 files. No API or behaviour change. The services keep their grouping under pkg/services/<name> rather than being promoted to pkg/<name>: 27 top-level directories in pkg/ would read worse than what we have, and the grouping is what makes "an RPC service" identifiable at a glance. Paths that follow the move: the logosstorage test target and generate step, the two wallet token-list tools, the migration-order check (and the pre-rebase hook symlinked to it), and the storage env helper. refs #7067
31 lines
739 B
Go
31 lines
739 B
Go
package eth
|
|
|
|
import (
|
|
"context"
|
|
|
|
accounts "github.com/status-im/status-go/internal/accounts-management"
|
|
"github.com/status-im/status-go/internal/rpc"
|
|
)
|
|
|
|
type API struct {
|
|
client *rpc.Client
|
|
accountsManager *accounts.AccountsManager
|
|
}
|
|
|
|
func NewAPI(client *rpc.Client, accountsManager *accounts.AccountsManager) *API {
|
|
return &API{
|
|
client: client,
|
|
accountsManager: accountsManager,
|
|
}
|
|
}
|
|
|
|
// EstimateGas estimates gas for a given payload on a chain.
|
|
func (a *API) EstimateGas(ctx context.Context, chainID uint64, payload any) (result string, err error) {
|
|
client, err := a.client.EthClient(chainID)
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
err = client.CallContext(ctx, &result, "eth_estimateGas", payload)
|
|
return
|
|
}
|