client

package
v0.4.0-RC1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 11, 2024 License: AGPL-3.0, AGPL-3.0-or-later Imports: 11 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	NodeClient
	RestClient
}

Client is for the outside test.

func NewClient

func NewClient(ctx context.Context, cfg Config) (*Client, error)

NewClient returns a new client.

type Config

type Config struct {
	L1NodeURL    string         `mapstructure:"L1NodeURL"`
	L2NodeURL    string         `mapstructure:"L2NodeURL"`
	BridgeURL    string         `mapstructure:"BridgeURL"`
	L1BridgeAddr common.Address `mapstructure:"L1BridgeAddr"`
	L2BridgeAddr common.Address `mapstructure:"L2BridgeAddr"`
}

Config is a client config

type NetworkSID

type NetworkSID string

NetworkSID is used to identify the network.

type NodeClient

type NodeClient struct {
	// contains filtered or unexported fields
}

NodeClient is for the ethclient.

func (NodeClient) ApproveERC20

func (c NodeClient) ApproveERC20(ctx context.Context, erc20Addr, spender common.Address, amount *big.Int, auth *bind.TransactOpts, network NetworkSID) error

ApproveERC20 approves erc20 tokens.

func (NodeClient) DeployERC20

func (c NodeClient) DeployERC20(ctx context.Context, name, symbol string, auth *bind.TransactOpts, network NetworkSID) (common.Address, error)

DeployERC20 deploys erc20 smc.

func (NodeClient) GetChainID

func (c NodeClient) GetChainID(ctx context.Context, network NetworkSID) (*big.Int, error)

GetChainID returns a chain ID of the dedicated node.

func (NodeClient) MintERC20

func (c NodeClient) MintERC20(ctx context.Context, erc20Addr common.Address, amount *big.Int, auth *bind.TransactOpts, network NetworkSID) error

MintERC20 mint erc20 tokens.

func (NodeClient) SendBridgeAsset

func (c NodeClient) SendBridgeAsset(ctx context.Context, tokenAddr common.Address, amount *big.Int,
	destNetwork uint32, destAddr *common.Address, metadata []byte, auth *bind.TransactOpts, network NetworkSID,
) error

SendBridgeAsset sends a bridge asset transaction.

func (NodeClient) SendBridgeMessage

func (c NodeClient) SendBridgeMessage(ctx context.Context, destNetwork uint32, destAddr common.Address, metadata []byte,
	auth *bind.TransactOpts, network NetworkSID,
) error

SendBridgeMessage sends a bridge message transaction.

func (NodeClient) SendClaim

func (c NodeClient) SendClaim(ctx context.Context, deposit *pb.Deposit, smtProof, smtRollupProof [mtHeight][32]byte, globalExitRoot *etherman.GlobalExitRoot,
	auth *bind.TransactOpts, network NetworkSID,
) error

SendClaim send a claim transaction.

type RestClient

type RestClient struct {
	// contains filtered or unexported fields
}

RestClient is a client for the rest api.

func NewRestClient

func NewRestClient(url string) *RestClient

NewRestClient creates new rest api client.

func (RestClient) GetBridge

func (c RestClient) GetBridge(networkID uint32, depositCnt uint64) (*pb.Deposit, error)

GetBridge returns the specific bridge info.

func (RestClient) GetBridges

func (c RestClient) GetBridges(destAddr string, offset, limit uint) ([]*pb.Deposit, uint64, error)

GetBridges returns bridge list for the specific destination address.

func (RestClient) GetClaims

func (c RestClient) GetClaims(destAddr string, offset, limit uint) ([]*pb.Claim, uint64, error)

GetClaims returns claim list for the specific destination address.

func (RestClient) GetMerkleProof

func (c RestClient) GetMerkleProof(networkID uint32, depositCnt uint64) (*pb.Proof, error)

GetMerkleProof returns the merkle proof for the specific bridge transaction.

func (RestClient) GetVersion

func (c RestClient) GetVersion() (string, error)

GetVersion returns the api version.

func (RestClient) GetWrappedToken

func (c RestClient) GetWrappedToken(origNet uint32, origTokenAddr string) (*pb.TokenWrapped, error)

GetWrappedToken returns the wrapped token address.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL