evm/bsc/client.go
2021-11-08 22:20:31 +04:00

31 lines
702 B
Go

package bsc
import (
"context"
"git.lehouerou.net/laurent/evm"
"github.com/pkg/errors"
)
const (
BinanceRpcUrl = "https://bsc-dataseed.binance.org/"
)
type Client struct {
evm.Client
}
func NewClientWithUrl(ctx context.Context, rpcurl string, privatekey string, options ...evm.ClientOption) (*Client, error) {
ethclient, err := evm.NewClient(ctx, rpcurl, privatekey, NewTokenMapper(), options...)
if err != nil {
return nil, errors.Wrap(err, "creating ethereum client")
}
return &Client{
ethclient,
}, nil
}
func NewClient(ctx context.Context, privatekey string, options ...evm.ClientOption) (*Client, error) {
return NewClientWithUrl(ctx, BinanceRpcUrl, privatekey, options...)
}