Files
evm/utils/rpc/requester.go
zeekay 941812cbec Remove node dependency from EVM core
- Copied api and utils/rpc packages from node to remove dependency
- Updated imports to use local packages
- Removed node from go.mod requirements
- Core EVM package now builds without node dependency
- Only runner/main (for testing) still uses node/vms/rpcchainvm

This allows EVM to be used as a library without pulling in the entire node package tree.
2025-12-04 15:06:56 -08:00

48 lines
878 B
Go

// Copyright (C) 2019-2025, Lux Industries, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package rpc // Copied from luxfi/node to remove dependency
import (
"context"
"net/url"
)
var _ EndpointRequester = (*luxEndpointRequester)(nil)
type EndpointRequester interface {
SendRequest(ctx context.Context, method string, params interface{}, reply interface{}, options ...Option) error
}
type luxEndpointRequester struct {
uri string
}
func NewEndpointRequester(uri string) EndpointRequester {
return &luxEndpointRequester{
uri: uri,
}
}
func (e *luxEndpointRequester) SendRequest(
ctx context.Context,
method string,
params interface{},
reply interface{},
options ...Option,
) error {
uri, err := url.Parse(e.uri)
if err != nil {
return err
}
return SendJSONRequest(
ctx,
uri,
method,
params,
reply,
options...,
)
}