diff --git a/api/gateway/chain/internal/service/gateway/commands/transfer/deps.go b/api/gateway/chain/internal/service/gateway/commands/transfer/deps.go index 92a5596..a24df33 100644 --- a/api/gateway/chain/internal/service/gateway/commands/transfer/deps.go +++ b/api/gateway/chain/internal/service/gateway/commands/transfer/deps.go @@ -2,6 +2,7 @@ package transfer import ( "context" + "time" "github.com/tech/sendico/gateway/chain/internal/service/gateway/rpcclient" "github.com/tech/sendico/gateway/chain/internal/service/gateway/shared" diff --git a/api/gateway/chain/internal/service/gateway/commands/transfer/fee.go b/api/gateway/chain/internal/service/gateway/commands/transfer/fee.go index aec9c8c..cdf69bf 100644 --- a/api/gateway/chain/internal/service/gateway/commands/transfer/fee.go +++ b/api/gateway/chain/internal/service/gateway/commands/transfer/fee.go @@ -85,7 +85,7 @@ func (c *estimateTransferFeeCommand) Execute(ctx context.Context, req *chainv1.E return gsresponse.InvalidArgument[chainv1.EstimateTransferFeeResponse](c.deps.Logger, mservice.ChainGateway, err) } - feeMoney, err := estimateNetworkFee(ctx, c.deps.Logger, networkCfg, sourceWallet, destinationAddress, amount) + feeMoney, err := estimateNetworkFee(ctx, c.deps.Logger, networkCfg, c.deps.RPCTimeout, sourceWallet, destinationAddress, amount) if err != nil { c.deps.Logger.Warn("fee estimation failed", zap.Error(err)) return gsresponse.Auto[chainv1.EstimateTransferFeeResponse](c.deps.Logger, mservice.ChainGateway, err) @@ -98,7 +98,7 @@ func (c *estimateTransferFeeCommand) Execute(ctx context.Context, req *chainv1.E return gsresponse.Success(resp) } -func estimateNetworkFee(ctx context.Context, logger mlogger.Logger, network shared.Network, wallet *model.ManagedWallet, destination string, amount *moneyv1.Money) (*moneyv1.Money, error) { +func estimateNetworkFee(ctx context.Context, logger mlogger.Logger, network shared.Network, timeout time.Duration, wallet *model.ManagedWallet, destination string, amount *moneyv1.Money) (*moneyv1.Money, error) { rpcURL := strings.TrimSpace(network.RPCURL) if rpcURL == "" { return nil, merrors.InvalidArgument("network rpc url not configured") @@ -122,7 +122,6 @@ func estimateNetworkFee(ctx context.Context, logger mlogger.Logger, network shar } defer client.Close() - timeout := c.deps.RPCTimeout if timeout <= 0 { timeout = 15 * time.Second }