mirror of
https://github.com/luxfi/evm.git
synced 2026-09-24 00:27:44 +00:00
- 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.
48 lines
878 B
Go
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...,
|
|
)
|
|
}
|