Categorygithub.com/ivanzzeth/ethclient
repositorypackage
0.1.18
Repository: https://github.com/ivanzzeth/ethclient.git
Documentation: pkg.go.dev

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# README

ethclient

Description

Extension ethclient.

Prerequisites

golang

Feautres

  • Schedule message
  • Sequence message
  • Protect message
  • Nonce management
  • Multiple rpc url supported

Quick Start

package main

import (
	"fmt"
	"time"

	"github.com/ivanzzeth/ethclient"
	"github.com/ivanzzeth/ethclient/message"
	"github.com/ivanzzeth/ethclient/tests/helper"
)

func main() {
	client, err := ethclient.Dial("http://localhost:8545")
	if err != nil {
		panic(err)
	}
	defer client.Close()

	go func() {
		client.ScheduleMsg((&message.Request{
			From:      helper.Addr,
			To:        &helper.Addr,
			StartTime: time.Now().Add(5 * time.Second).UnixNano(),
		}).SetRandomId())

		client.ScheduleMsg((&message.Request{
			From: helper.Addr,
			To:   &helper.Addr,
			// StartTime:      time.Now().Add(5 * time.Second).UnixNano(),
			ExpirationTime: time.Now().UnixNano() - int64(5*time.Second),
		}).SetRandomId())

		client.ScheduleMsg((&message.Request{
			From:           helper.Addr,
			To:             &helper.Addr,
			ExpirationTime: time.Now().Add(10 * time.Second).UnixNano(),
			Interval:       2 * time.Second,
		}).SetRandomId())

		time.Sleep(20 * time.Second)
		client.CloseSendMsg()
	}()

	for resp := range client.Response() {
		fmt.Println("execution resp: ", resp)
	}
}

Setup local node for testing

you should install foundry before running the script below:

./cmd/run_test_node.sh

License

The ethclient library is licensed under the GNU General Public License v3.0, also included in our repository in the COPYING.LESSER file.