sdk

package module
v1.0.14 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2021 License: LGPL-3.0 Imports: 28 Imported by: 78

README

Documentation Build Status

Conflux Golang API

The Conflux Golang API allows any Golang client to interact with a local or remote Conflux node based on JSON-RPC 2.0 protocol. With Conflux Golang API, user can easily manage accounts, send transactions, deploy smart contracts and query blockchain information.

Install

go get github.com/Conflux-Chain/go-conflux-sdk

You can also add the Conflux Golang API into vendor folder.

govendor fetch github.com/Conflux-Chain/go-conflux-sdk

Usage

api document

Manage Accounts

Use AccountManager struct to manage accounts at local machine.

  • Create/Import/Update/Delete an account.
  • List all accounts.
  • Unlock/Lock an account.
  • Sign a transaction.

Query Conflux Information

Use Client struct to query Conflux blockchain information, such as block, epoch, transaction, receipt. Following is an example to query the current epoch number:

package main

import (
	"fmt"

	conflux "github.com/Conflux-Chain/go-conflux-sdk"
)

func main() {
	client, err := conflux.NewClient("http://52.175.52.111:12537")
	if err != nil {
		fmt.Println("failed to create client:", err)
		return
	}
	defer client.Close()

	epoch, err := client.GetEpochNumber()
	if err != nil {
		fmt.Println("failed to get epoch number:", err)
		return
	}

	fmt.Println("Current epoch number:", epoch)
}

Send Transaction

To send a transaction, you need to sign the transaction at local machine, and send the signed transaction to local or remote Conflux node.

  • Sign a transaction with unlocked account:

    AccountManager.SignTransaction(tx UnsignedTransaction)

  • Sign a transaction with passphrase for locked account:

    AccountManager.SignTransactionWithPassphrase(tx UnsignedTransaction, passphrase string)

  • Send a unsigned transaction

    Client.SendTransaction(tx types.UnsignedTransaction)

  • Send a encoded transaction

    Client.SendRawTransaction(rawData []byte)

  • Encode a encoded unsigned transaction with signature and send transaction

    Client.SignEncodedTransactionAndSend(encodedTx []byte, v byte, r, s []byte)

To send multiple transactions at a time, you can unlock the account at first, then send multiple transactions without passphrase. To send a single transaction, you can just only send the transaction with passphrase.

Deploy/Invoke Smart Contract

The simpiest and recommend way is to use conflux-abigen to generate contract binding to deploy and invoke with contract

[Depreated] However you also can use Client.DeployContract to deploy a contract or use Client.GetContract to get a contract by deployed address. Then you can use the contract instance to operate contract, there are GetData/Call/SendTransaction. Please see api document for detail.

Contract Example [Depreated]

Please reference contract example for all source code

package main

import (
	"encoding/hex"
	"fmt"
	"io/ioutil"
	"math/big"
	"time"

	sdk "github.com/Conflux-Chain/go-conflux-sdk"
	"github.com/Conflux-Chain/go-conflux-sdk/utils"
	"github.com/ethereum/go-ethereum/common"
)

func main() {

	//init client
	client, err := sdk.NewClient("https://test.confluxrpc.com", sdk.ClientOption{
		KeystorePath: "../context/keystore",
	})
	utils.PanicIfErr(err, "failed to new client")

	// unlock default account
	client.AccountManager.TimedUnlockDefault("hello", 300*time.Second)

	//deploy contract
	abi := your contract abi
	bytecode := your contract bytecode

	result := client.DeployContract(nil, abi, bytecode, big.NewInt(100000), "biu", uint8(10), "BIU")
	<-result.DoneChannel
	utils.PanicIfErr(result.Error, "failed to deploy contract")

	contract := result.DeployedContract
	fmt.Printf("deploy contract by client.DeployContract done\ncontract address: %+v\ntxhash:%v\n\n", contract.Address, result.TransactionHash)

	// or get contract by deployed address
	// deployedAt := client.MustNewAddress("cfxtest:acgkhpdz61g11parejzbftznnt8gds15mp4wg54j5c")
	// contract, err := client.GetContract(abi, &deployedAt)

	//get data for send/call contract method
	user := client.MustNewAddress("cfxtest:aap9kthvctunvf030rbkk9k7zbzyz12dajp1u3sp4g")
	data, err := contract.GetData("balanceOf", user.MustGetCommonAddress())
	utils.PanicIfErr(err, "failed to get data")
	fmt.Printf("get data of method balanceOf: 0x%x\n\n", data)

	//call contract method
	//Note: the output struct type need match method output type of ABI, go type "*big.Int" match abi type "uint256", go type "struct{Balance *big.Int}" match abi tuple type "(balance uint256)"
	balance := &struct{ Balance *big.Int }{}
	err = contract.Call(nil, balance, "balanceOf", user.MustGetCommonAddress())
	utils.PanicIfErr(err, "failed to get balance")
	fmt.Printf("balance of address %v in contract is: %+v\n\n", user, balance)

	//send transction for contract method
	to := client.MustNewAddress("cfxtest:acgkhpdz61g11parejzbftznnt8gds15mp4wg54j5c")
	txhash, err := contract.SendTransaction(nil, "transfer", to.MustGetCommonAddress(), big.NewInt(10))
	utils.PanicIfErr(err, "failed to transfer")
	fmt.Printf("transfer %v erc20 token to %v done, tx hash: %v\n\n", 10, to, txhash)

	//get event log and decode it
	fmt.Println("wait for transaction be packed...")
	receipt, err := client.WaitForTransationReceipt(txhash, time.Second*2)
	utils.PanicIfErr(err, "failed to get tx receipt")
	fmt.Printf("get receipt: %+v\n\n", receipt)

	// decode Transfer Event
	var Transfer struct {
		From  common.Address
		To    common.Address
		Value *big.Int
	}

	err = contract.DecodeEvent(&Transfer, "Transfer", receipt.Logs[0])
	utils.PanicIfErr(err, "failed to decode event")
	fmt.Printf("decoded transfer event: {From: 0x%x, To: 0x%x, Value: %v} ", Transfer.From, Transfer.To, Transfer.Value)
}

Subscribe Epochs/BlockHeads/Logs

Please find Publish-Subscribe API documentation from https://developer.confluxnetwork.org/conflux-doc/docs/pubsub

It should be noted that when subscribing logs, a SubscribeLogs object is received. It has two fields Log and ChainRerog, one of them must be nil and the other not. When Log is not nil, it means that a Log is received. When field ChainReorg is not nil, that means chainreorg is occurred. That represents the log related to epoch greater than or equal to ChainReog.RevertTo will become invalid, and the dapp needs to be dealt with at the business level.

Use middleware to hook rpc request

Client applies method UseCallRpcMiddleware to set middleware for hooking callRpc method which is the core of all single rpc related methods. And UseBatchCallRpcMiddleware to set middleware for hooking batchCallRPC.

For example, use CallRpcConsoleMiddleware to log for rpc requests.

client.UseCallRpcMiddleware(middleware.CallRpcConsoleMiddleware)

Also you could

  • customize middleware
  • use multiple middleware

Notice that the middleware chain exectuion order is like onion, for example, use middleware A first and then middleware B

client.UseCallRpcMiddleware(A)
client.UseCallRpcMiddleware(B)

the middleware execution order is

B --> A --> client.callRpc --> A --> B

Appendix

Mapping of solidity types to go types

This is a mapping table for map solidity types to go types when using contract methods GetData/Call/SendTransaction/DecodeEvent

solidity types go types
address common.Address
uint8,uint16,uint32,uint64 uint8,uint16,uint32,uint64
uint24,uint40,uint48,uint56,uint72...uint256 *big.Int
int8,int16,int32,int64 int8,int16,int32,int64
int24,int40,int48,int56,int72...int256 *big.Int
fixed bytes (bytes1,bytes2...bytes32) [length]byte
fixed type T array (T[length]) [length]TG (TG is go type matched with solidty type T)
bytes []byte
dynamic type T array T[] []TG ((TG is go type matched with solidty type T))
function [24]byte
string string
bool bool
tuple struct eg:[{"name": "balance","type": "uint256"}] => struct {Balance *big.Int}

Documentation

Overview

Package sdk is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountManager

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

AccountManager manages Conflux accounts.

func NewAccountManager

func NewAccountManager(keydir string, networkID uint32) *AccountManager

NewAccountManager creates an instance of AccountManager based on the keystore directory "keydir".

func (*AccountManager) Create

func (m *AccountManager) Create(passphrase string) (address types.Address, err error)

Create creates a new account and puts the keystore file into keystore directory

func (*AccountManager) CreateEthCompatible added in v0.1.1

func (m *AccountManager) CreateEthCompatible(passphrase string) (address types.Address, err error)

CreateEthCompatible creates a new account compatible with eth and puts the keystore file into keystore directory

func (*AccountManager) Delete

func (m *AccountManager) Delete(address types.Address, passphrase string) error

Delete deletes the specified account and remove the keystore file from keystore directory.

func (*AccountManager) Export added in v0.1.1

func (m *AccountManager) Export(address types.Address, passphrase string) (string, error)

Export exports private key string of address

func (*AccountManager) GetDefault

func (m *AccountManager) GetDefault() (*types.Address, error)

GetDefault return first account in keystore directory

func (*AccountManager) Import

func (m *AccountManager) Import(keyFile, passphrase, newPassphrase string) (address types.Address, err error)

Import imports account from external key file to keystore directory. Returns error if the account already exists.

func (*AccountManager) ImportKey added in v0.1.1

func (m *AccountManager) ImportKey(keyString string, passphrase string) (address types.Address, err error)

ImportKey import account from private key hex string and save to keystore directory

func (*AccountManager) List

func (m *AccountManager) List() []types.Address

List lists all accounts in keystore directory.

func (*AccountManager) Lock

func (m *AccountManager) Lock(address types.Address) error

Lock locks the specified account.

func (*AccountManager) Sign

func (m *AccountManager) Sign(tx types.UnsignedTransaction, passphrase string) (v byte, r, s []byte, err error)

Sign signs tx by passphrase and returns the signature

func (*AccountManager) SignAndEcodeTransactionWithPassphrase

func (m *AccountManager) SignAndEcodeTransactionWithPassphrase(tx types.UnsignedTransaction, passphrase string) ([]byte, error)

SignAndEcodeTransactionWithPassphrase signs tx with given passphrase and return its RLP encoded data.

func (*AccountManager) SignTransaction

func (m *AccountManager) SignTransaction(tx types.UnsignedTransaction) ([]byte, error)

SignTransaction signs tx and returns its RLP encoded data.

func (*AccountManager) SignTransactionWithPassphrase

func (m *AccountManager) SignTransactionWithPassphrase(tx types.UnsignedTransaction, passphrase string) (types.SignedTransaction, error)

SignTransactionWithPassphrase signs tx with given passphrase and returns a transction with signature

func (*AccountManager) TimedUnlock

func (m *AccountManager) TimedUnlock(address types.Address, passphrase string, timeout time.Duration) error

TimedUnlock unlocks the specified account for a period of time.

func (*AccountManager) TimedUnlockDefault

func (m *AccountManager) TimedUnlockDefault(passphrase string, timeout time.Duration) error

TimedUnlockDefault unlocks the specified account for a period of time.

func (*AccountManager) Unlock

func (m *AccountManager) Unlock(address types.Address, passphrase string) error

Unlock unlocks the specified account indefinitely.

func (*AccountManager) UnlockDefault

func (m *AccountManager) UnlockDefault(passphrase string) error

UnlockDefault unlocks the default account indefinitely.

func (*AccountManager) Update

func (m *AccountManager) Update(address types.Address, passphrase, newPassphrase string) error

Update updates the passphrase of specified account.

type AccountManagerOperator added in v0.1.1

type AccountManagerOperator interface {
	Create(passphrase string) (types.Address, error)
	Import(keyFile, passphrase, newPassphrase string) (types.Address, error)
	Delete(address types.Address, passphrase string) error
	Update(address types.Address, passphrase, newPassphrase string) error
	List() []types.Address
	GetDefault() (*types.Address, error)
	Unlock(address types.Address, passphrase string) error
	UnlockDefault(passphrase string) error
	TimedUnlock(address types.Address, passphrase string, timeout time.Duration) error
	TimedUnlockDefault(passphrase string, timeout time.Duration) error
	Lock(address types.Address) error
	SignTransaction(tx types.UnsignedTransaction) ([]byte, error)
	SignAndEcodeTransactionWithPassphrase(tx types.UnsignedTransaction, passphrase string) ([]byte, error)
	SignTransactionWithPassphrase(tx types.UnsignedTransaction, passphrase string) (types.SignedTransaction, error)
	Sign(tx types.UnsignedTransaction, passphrase string) (v byte, r, s []byte, err error)
}

AccountManagerOperator is interface of operate actions on account manager

type Client

type Client struct {
	AccountManager AccountManagerOperator
	// contains filtered or unexported fields
}

Client represents a client to interact with Conflux blockchain.

func NewClient

func NewClient(nodeURL string, option ...ClientOption) (*Client, error)

NewClient creates an instance of Client with specified conflux node url, it will creat account manager if option.KeystorePath not empty.

func NewClientWithRPCRequester added in v0.1.1

func NewClientWithRPCRequester(rpcRequester RpcRequester) (*Client, error)

NewClientWithRPCRequester creates client with specified rpcRequester

func (*Client) ApplyUnsignedTransactionDefault

func (client *Client) ApplyUnsignedTransactionDefault(tx *types.UnsignedTransaction) error

ApplyUnsignedTransactionDefault set empty fields to value fetched from conflux node.

func (*Client) BatchCallRPC added in v0.1.1

func (client *Client) BatchCallRPC(b []rpc.BatchElem) error

BatchCallRPC sends all given requests as a single batch and waits for the server to return a response for all of them.

In contrast to Call, BatchCall only returns I/O errors. Any error specific to a request is reported through the Error field of the corresponding BatchElem.

Note that batch calls may not be executed atomically on the server side.

You could use UseBatchCallRpcMiddleware to add middleware for hooking BatchCallRPC

func (*Client) BatchGetBlockConfirmationRisk added in v0.1.1

func (client *Client) BatchGetBlockConfirmationRisk(blockhashes []types.Hash) (map[types.Hash]*big.Float, error)

BatchGetBlockConfirmationRisk acquires confirmation risk informations in bulk by blockhashes

func (*Client) BatchGetBlockSummarys added in v0.1.1

func (client *Client) BatchGetBlockSummarys(blockhashes []types.Hash) (map[types.Hash]*types.BlockSummary, error)

BatchGetBlockSummarys requests block summary informations in bulk by blockhashes

func (*Client) BatchGetBlockSummarysByNumber added in v0.1.1

func (client *Client) BatchGetBlockSummarysByNumber(blocknumbers []hexutil.Uint64) (map[hexutil.Uint64]*types.BlockSummary, error)

BatchGetBlockSummarysByNumber requests block summary informations in bulk by blocknumbers

func (*Client) BatchGetRawBlockConfirmationRisk added in v0.1.1

func (client *Client) BatchGetRawBlockConfirmationRisk(blockhashes []types.Hash) (map[types.Hash]*big.Int, error)

BatchGetRawBlockConfirmationRisk requests raw confirmation risk informations in bulk by blockhashes

func (*Client) BatchGetTxByHashes added in v0.1.1

func (client *Client) BatchGetTxByHashes(txhashes []types.Hash) (map[types.Hash]*types.Transaction, error)

BatchGetTxByHashes requests transaction informations in bulk by txhashes

func (*Client) Call

func (client *Client) Call(request types.CallRequest, epoch *types.Epoch) (result hexutil.Bytes, err error)

Call executes a message call transaction "request" at specified epoch, which is directly executed in the VM of the node, but never mined into the block chain and returns the contract execution result.

func (*Client) CallRPC

func (client *Client) CallRPC(result interface{}, method string, args ...interface{}) error

CallRPC performs a JSON-RPC call with the given arguments and unmarshals into result if no error occurred.

The result must be a pointer so that package json can unmarshal into it. You can also pass nil, in which case the result is ignored.

You could use UseCallRpcMiddleware to add middleware for hooking CallRPC

func (*Client) CheckBalanceAgainstTransaction added in v0.1.1

func (client *Client) CheckBalanceAgainstTransaction(accountAddress types.Address,
	contractAddress types.Address,
	gasLimit *hexutil.Big,
	gasPrice *hexutil.Big,
	storageLimit *hexutil.Big,
	epoch ...*types.Epoch) (response types.CheckBalanceAgainstTransactionResponse, err error)

CheckBalanceAgainstTransaction checks if user balance is enough for the transaction.

func (*Client) Close

func (client *Client) Close()

Close closes the client, aborting any in-flight requests.

func (*Client) CreateUnsignedTransaction

func (client *Client) CreateUnsignedTransaction(from types.Address, to types.Address, amount *hexutil.Big, data []byte) (types.UnsignedTransaction, error)

CreateUnsignedTransaction creates an unsigned transaction by parameters, and the other fields will be set to values fetched from conflux node.

func (*Client) DeployContract

func (client *Client) DeployContract(option *types.ContractDeployOption, abiJSON []byte,
	bytecode []byte, constroctorParams ...interface{}) *ContractDeployResult

DeployContract deploys a contract by abiJSON, bytecode and consturctor params. It returns a ContractDeployState instance which contains 3 channels for notifying when state changed.

func (*Client) EstimateGasAndCollateral

func (client *Client) EstimateGasAndCollateral(request types.CallRequest, epoch ...*types.Epoch) (estimat types.Estimate, err error)

EstimateGasAndCollateral excutes a message call "request" and returns the amount of the gas used and storage for collateral

func (*Client) FilterTraces added in v0.1.1

func (client *Client) FilterTraces(traceFilter types.TraceFilter) (traces []types.LocalizedTrace, err error)

GetFilterTraces returns all traces matching the provided filter.

func (*Client) GetAccountInfo added in v0.1.1

func (client *Client) GetAccountInfo(account types.Address, epoch ...*types.Epoch) (accountInfo types.AccountInfo, err error)

GetAccountInfo returns account related states of the given account

func (*Client) GetAccountPendingInfo added in v0.1.1

func (client *Client) GetAccountPendingInfo(address types.Address) (pendignInfo *types.AccountPendingInfo, err error)

GetAccountPendingInfo gets transaction pending info by account address

func (*Client) GetAccountPendingTransactions added in v0.1.1

func (client *Client) GetAccountPendingTransactions(address types.Address, startNonce *hexutil.Big, limit *hexutil.Uint64) (pendingTxs types.AccountPendingTransactions, err error)

func (*Client) GetAccumulateInterestRate added in v0.1.1

func (client *Client) GetAccumulateInterestRate(epoch ...*types.Epoch) (intersetRate *hexutil.Big, err error)

GetAccumulateInterestRate returns accumulate interest rate of the given epoch

func (*Client) GetAdmin added in v0.1.1

func (client *Client) GetAdmin(contractAddress types.Address, epoch ...*types.Epoch) (admin *types.Address, err error)

GetAdmin returns admin of the given contract, it will return nil if contract not exist

func (*Client) GetBalance

func (client *Client) GetBalance(address types.Address, epoch ...*types.Epoch) (balance *hexutil.Big, err error)

GetBalance returns the balance of specified address at epoch.

func (*Client) GetBestBlockHash

func (client *Client) GetBestBlockHash() (hash types.Hash, err error)

GetBestBlockHash returns the current best block hash.

func (*Client) GetBlockByBlockNumber added in v0.1.1

func (client *Client) GetBlockByBlockNumber(blockNumer hexutil.Uint64) (block *types.Block, err error)

func (*Client) GetBlockByEpoch

func (client *Client) GetBlockByEpoch(epoch *types.Epoch) (block *types.Block, err error)

GetBlockByEpoch returns the block of specified epoch. If the epoch is invalid, return the concrete error.

func (*Client) GetBlockByHash

func (client *Client) GetBlockByHash(blockHash types.Hash) (block *types.Block, err error)

GetBlockByHash returns the block of specified blockHash If the block is not found, return nil.

func (*Client) GetBlockByHashWithPivotAssumption added in v0.1.1

func (client *Client) GetBlockByHashWithPivotAssumption(blockHash types.Hash, pivotHash types.Hash, epoch hexutil.Uint64) (block types.Block, err error)

GetBlockByHashWithPivotAssumption returns block with given hash and pivot chain assumption.

func (*Client) GetBlockConfirmationRisk added in v0.1.1

func (client *Client) GetBlockConfirmationRisk(blockHash types.Hash) (*big.Float, error)

GetBlockConfirmationRisk indicates the probability that the pivot block of the epoch where the block is located becomes a normal block.

it's (raw confirmation risk coefficient/ (2^256-1))

func (*Client) GetBlockRewardInfo added in v0.1.1

func (client *Client) GetBlockRewardInfo(epoch types.Epoch) (rewardInfo []types.RewardInfo, err error)

GetBlockRewardInfo returns block reward information in an epoch

func (*Client) GetBlockSummaryByBlockNumber added in v0.1.1

func (client *Client) GetBlockSummaryByBlockNumber(blockNumer hexutil.Uint64) (block *types.BlockSummary, err error)

func (*Client) GetBlockSummaryByEpoch

func (client *Client) GetBlockSummaryByEpoch(epoch *types.Epoch) (blockSummary *types.BlockSummary, err error)

GetBlockSummaryByEpoch returns the block summary of specified epoch. If the epoch is invalid, return the concrete error.

func (*Client) GetBlockSummaryByHash

func (client *Client) GetBlockSummaryByHash(blockHash types.Hash) (blockSummary *types.BlockSummary, err error)

GetBlockSummaryByHash returns the block summary of specified blockHash If the block is not found, return nil.

func (*Client) GetBlockTraces added in v0.1.1

func (client *Client) GetBlockTraces(blockHash types.Hash) (traces *types.LocalizedBlockTrace, err error)

GetBlockTrace returns all traces produced at given block.

func (*Client) GetBlocksByEpoch

func (client *Client) GetBlocksByEpoch(epoch *types.Epoch) (blockHashes []types.Hash, err error)

GetBlocksByEpoch returns the blocks hash in the specified epoch.

func (*Client) GetClientVersion added in v0.1.1

func (client *Client) GetClientVersion() (clientVersion string, err error)

GetClientVersion returns the client version as a string

func (*Client) GetCode

func (client *Client) GetCode(address types.Address, epoch ...*types.Epoch) (code hexutil.Bytes, err error)

GetCode returns the bytecode in HEX format of specified address at epoch.

func (*Client) GetCollateralForStorage added in v0.1.1

func (client *Client) GetCollateralForStorage(account types.Address, epoch ...*types.Epoch) (storage *hexutil.Big, err error)

GetCollateralForStorage returns balance of the given account.

func (*Client) GetContract

func (client *Client) GetContract(abiJSON []byte, deployedAt *types.Address) (*Contract, error)

GetContract creates a contract instance according to abi json and it's deployed address

func (*Client) GetDepositList added in v0.1.1

func (client *Client) GetDepositList(address types.Address, epoch ...*types.Epoch) (depositInfos []types.DepositInfo, err error)

GetDepositList returns deposit list of the given account.

func (*Client) GetEpochNumber

func (client *Client) GetEpochNumber(epoch ...*types.Epoch) (epochNumber *hexutil.Big, err error)

GetEpochNumber returns the highest or specified epoch number.

func (*Client) GetEpochReceipts added in v0.1.1

func (client *Client) GetEpochReceipts(epoch types.Epoch) (receipts [][]types.TransactionReceipt, err error)

func (*Client) GetEpochReceiptsByPivotBlockHash added in v0.1.1

func (client *Client) GetEpochReceiptsByPivotBlockHash(hash types.Hash) (receipts [][]types.TransactionReceipt, err error)

func (*Client) GetGasPrice

func (client *Client) GetGasPrice() (gasPrice *hexutil.Big, err error)

GetGasPrice returns the recent mean gas price.

func (*Client) GetInterestRate added in v0.1.1

func (client *Client) GetInterestRate(epoch ...*types.Epoch) (intersetRate *hexutil.Big, err error)

GetInterestRate returns interest rate of the given epoch

func (*Client) GetLogs

func (client *Client) GetLogs(filter types.LogFilter) (logs []types.Log, err error)

GetLogs returns logs that matching the specified filter.

func (*Client) GetNetworkID added in v0.1.1

func (client *Client) GetNetworkID() (uint32, error)

GetNetworkID returns networkID of connecting conflux node

func (*Client) GetNextNonce

func (client *Client) GetNextNonce(address types.Address, epoch ...*types.Epoch) (nonce *hexutil.Big, err error)

GetNextNonce returns the next transaction nonce of address

func (*Client) GetNodeURL added in v0.1.1

func (client *Client) GetNodeURL() string

GetNodeURL returns node url

func (*Client) GetRawBlockConfirmationRisk added in v0.1.1

func (client *Client) GetRawBlockConfirmationRisk(blockhash types.Hash) (risk *hexutil.Big, err error)

GetRawBlockConfirmationRisk indicates the risk coefficient that the pivot block of the epoch where the block is located becomes a normal block. It will return nil if block not exist

func (*Client) GetSkippedBlocksByEpoch added in v0.1.1

func (client *Client) GetSkippedBlocksByEpoch(epoch *types.Epoch) (blockHashs []types.Hash, err error)

GetSkippedBlocksByEpoch returns skipped block hashes of given epoch

func (*Client) GetSponsorInfo added in v0.1.1

func (client *Client) GetSponsorInfo(contractAddress types.Address, epoch ...*types.Epoch) (sponsor types.SponsorInfo, err error)

GetSponsorInfo returns sponsor information of the given contract

func (*Client) GetStakingBalance added in v0.1.1

func (client *Client) GetStakingBalance(account types.Address, epoch ...*types.Epoch) (balance *hexutil.Big, err error)

GetStakingBalance returns balance of the given account.

func (*Client) GetStatus added in v0.1.1

func (client *Client) GetStatus() (status types.Status, err error)

GetStatus returns status of connecting conflux node

func (*Client) GetStorageAt added in v0.1.1

func (client *Client) GetStorageAt(address types.Address, position types.Hash, epoch ...*types.Epoch) (storageEntries hexutil.Bytes, err error)

GetStorageAt returns storage entries from a given contract.

func (*Client) GetStorageRoot added in v0.1.1

func (client *Client) GetStorageRoot(address types.Address, epoch ...*types.Epoch) (storageRoot *types.StorageRoot, err error)

GetStorageRoot returns storage root of given address

func (*Client) GetSupplyInfo added in v0.1.1

func (client *Client) GetSupplyInfo(epoch ...*types.Epoch) (info types.TokenSupplyInfo, err error)

GetSupplyInfo Return information about total token supply.

func (*Client) GetTransactionByHash

func (client *Client) GetTransactionByHash(txHash types.Hash) (tx *types.Transaction, err error)

GetTransactionByHash returns transaction for the specified txHash. If the transaction is not found, return nil.

func (*Client) GetTransactionReceipt

func (client *Client) GetTransactionReceipt(txHash types.Hash) (receipt *types.TransactionReceipt, err error)

GetTransactionReceipt returns the receipt of specified transaction hash. If no receipt is found, return nil.

func (*Client) GetTransactionTraces added in v0.1.1

func (client *Client) GetTransactionTraces(txHash types.Hash) (traces []types.LocalizedTrace, err error)

GetTransactionTraces returns all traces produced at the given transaction.

func (*Client) GetVoteList added in v0.1.1

func (client *Client) GetVoteList(address types.Address, epoch ...*types.Epoch) (voteStakeInfos []types.VoteStakeInfo, err error)

GetVoteList returns vote list of the given account.

func (*Client) MustNewAddress added in v0.1.1

func (client *Client) MustNewAddress(base32OrHex string) types.Address

MustNewAddress create conflux address by base32 string or hex40 string, if base32OrHex is base32 and networkID is passed it will create cfx Address use networkID of current client. it will painc if error occured.

func (*Client) NewAddress added in v0.1.1

func (client *Client) NewAddress(base32OrHex string) (types.Address, error)

NewAddress create conflux address by base32 string or hex40 string, if base32OrHex is base32 and networkID is passed it will create cfx Address use networkID of current client.

func (*Client) Pos added in v0.1.1

func (client *Client) Pos() *RpcPosClient

func (*Client) SendRawTransaction

func (client *Client) SendRawTransaction(rawData []byte) (hash types.Hash, err error)

SendRawTransaction sends signed transaction and returns its hash.

func (*Client) SendTransaction

func (client *Client) SendTransaction(tx types.UnsignedTransaction) (types.Hash, error)

SendTransaction signs and sends transaction to conflux node and returns the transaction hash.

func (*Client) SetAccountManager

func (client *Client) SetAccountManager(accountManager AccountManagerOperator)

SetAccountManager sets account manager for sign transaction

func (*Client) SignEncodedTransactionAndSend

func (client *Client) SignEncodedTransactionAndSend(encodedTx []byte, v byte, r, s []byte) (*types.Transaction, error)

SignEncodedTransactionAndSend signs RLP encoded transaction "encodedTx" by signature "r,s,v" and sends it to node, and returns responsed transaction.

func (*Client) SubscribeEpochs added in v0.1.1

func (client *Client) SubscribeEpochs(channel chan types.WebsocketEpochResponse, subscriptionEpochType ...types.Epoch) (*rpc.ClientSubscription, error)

SubscribeEpochs subscribes consensus results: the total order of blocks, as expressed by a sequence of epochs. Currently subscriptionEpochType only support "latest_mined" and "latest_state"

func (*Client) SubscribeLogs added in v0.1.1

func (client *Client) SubscribeLogs(channel chan types.SubscriptionLog, filter types.LogFilter) (*rpc.ClientSubscription, error)

SubscribeLogs subscribes all logs matching a certain filter, in order.

func (*Client) SubscribeNewHeads added in v0.1.1

func (client *Client) SubscribeNewHeads(channel chan types.BlockHeader) (*rpc.ClientSubscription, error)

SubscribeNewHeads subscribes all new block headers participating in the consensus.

func (*Client) UseBatchCallRpcMiddleware added in v0.1.1

func (client *Client) UseBatchCallRpcMiddleware(middleware middleware.BatchCallRpcMiddleware)

UseBatchCallRpcMiddleware set middleware to hook BatchCallRpc, for example use middleware.BatchCallRpcLogMiddleware for logging batch request info. You can customize your BatchCallRpcMiddleware and use multi BatchCallRpcMiddleware.

func (*Client) UseCallRpcMiddleware added in v0.1.1

func (client *Client) UseCallRpcMiddleware(middleware middleware.CallRpcMiddleware)

UseCallRpcMiddleware set middleware to hook CallRpc, for example use middleware.CallRpcLogMiddleware for logging request info. You can customize your CallRpcMiddleware and use multi CallRpcMiddleware.

func (*Client) WaitForTransationBePacked added in v0.1.1

func (client *Client) WaitForTransationBePacked(txhash types.Hash, duration time.Duration) (*types.Transaction, error)

WaitForTransationBePacked returns transaction when it is packed

func (*Client) WaitForTransationReceipt added in v0.1.1

func (client *Client) WaitForTransationReceipt(txhash types.Hash, duration time.Duration) (*types.TransactionReceipt, error)

WaitForTransationReceipt waits for transaction receipt valid

type ClientOperator

type ClientOperator interface {
	GetNodeURL() string
	NewAddress(base32OrHex string) (types.Address, error)
	MustNewAddress(base32OrHex string) types.Address

	CallRPC(result interface{}, method string, args ...interface{}) error
	BatchCallRPC(b []rpc.BatchElem) error

	UseCallRpcMiddleware(middleware middleware.CallRpcMiddleware)
	UseBatchCallRpcMiddleware(middleware middleware.BatchCallRpcMiddleware)

	SetAccountManager(accountManager AccountManagerOperator)

	GetGasPrice() (*hexutil.Big, error)
	GetNextNonce(address types.Address, epoch ...*types.Epoch) (*hexutil.Big, error)
	GetStatus() (types.Status, error)
	GetNetworkID() (uint32, error)
	GetEpochNumber(epoch ...*types.Epoch) (*hexutil.Big, error)
	GetBalance(address types.Address, epoch ...*types.Epoch) (*hexutil.Big, error)
	GetCode(address types.Address, epoch ...*types.Epoch) (hexutil.Bytes, error)
	GetBlockSummaryByHash(blockHash types.Hash) (*types.BlockSummary, error)
	GetBlockByHash(blockHash types.Hash) (*types.Block, error)
	GetBlockSummaryByEpoch(epoch *types.Epoch) (*types.BlockSummary, error)
	GetBlockByEpoch(epoch *types.Epoch) (*types.Block, error)
	GetBlockByBlockNumber(blockNumer hexutil.Uint64) (block *types.Block, err error)
	GetBlockSummaryByBlockNumber(blockNumer hexutil.Uint64) (block *types.BlockSummary, err error)
	GetBestBlockHash() (types.Hash, error)
	GetRawBlockConfirmationRisk(blockhash types.Hash) (*hexutil.Big, error)
	GetBlockConfirmationRisk(blockHash types.Hash) (*big.Float, error)

	SendTransaction(tx types.UnsignedTransaction) (types.Hash, error)
	SendRawTransaction(rawData []byte) (types.Hash, error)
	SignEncodedTransactionAndSend(encodedTx []byte, v byte, r, s []byte) (*types.Transaction, error)

	Call(request types.CallRequest, epoch *types.Epoch) (hexutil.Bytes, error)

	GetLogs(filter types.LogFilter) ([]types.Log, error)
	GetTransactionByHash(txHash types.Hash) (*types.Transaction, error)
	EstimateGasAndCollateral(request types.CallRequest, epoch ...*types.Epoch) (types.Estimate, error)
	GetBlocksByEpoch(epoch *types.Epoch) ([]types.Hash, error)
	GetTransactionReceipt(txHash types.Hash) (*types.TransactionReceipt, error)
	GetAdmin(contractAddress types.Address, epoch ...*types.Epoch) (admin *types.Address, err error)
	GetSponsorInfo(contractAddress types.Address, epoch ...*types.Epoch) (sponsor types.SponsorInfo, err error)
	GetStakingBalance(account types.Address, epoch ...*types.Epoch) (balance *hexutil.Big, err error)
	GetCollateralForStorage(account types.Address, epoch ...*types.Epoch) (storage *hexutil.Big, err error)
	GetStorageAt(address types.Address, position types.Hash, epoch ...*types.Epoch) (storageEntries hexutil.Bytes, err error)
	GetStorageRoot(address types.Address, epoch ...*types.Epoch) (storageRoot *types.StorageRoot, err error)
	GetBlockByHashWithPivotAssumption(blockHash types.Hash, pivotHash types.Hash, epoch hexutil.Uint64) (block types.Block, err error)
	CheckBalanceAgainstTransaction(accountAddress types.Address,
		contractAddress types.Address,
		gasLimit *hexutil.Big,
		gasPrice *hexutil.Big,
		storageLimit *hexutil.Big,
		epoch ...*types.Epoch) (response types.CheckBalanceAgainstTransactionResponse, err error)
	GetSkippedBlocksByEpoch(epoch *types.Epoch) (blockHashs []types.Hash, err error)
	GetAccountInfo(account types.Address, epoch ...*types.Epoch) (accountInfo types.AccountInfo, err error)
	GetInterestRate(epoch ...*types.Epoch) (intersetRate *hexutil.Big, err error)
	GetAccumulateInterestRate(epoch ...*types.Epoch) (intersetRate *hexutil.Big, err error)
	GetBlockRewardInfo(epoch types.Epoch) (rewardInfo []types.RewardInfo, err error)
	GetClientVersion() (clientVersion string, err error)
	GetDepositList(address types.Address, epoch ...*types.Epoch) ([]types.DepositInfo, error)
	GetVoteList(address types.Address, epoch ...*types.Epoch) ([]types.VoteStakeInfo, error)
	GetSupplyInfo(epoch ...*types.Epoch) (info types.TokenSupplyInfo, err error)

	GetBlockTraces(blockHash types.Hash) (*types.LocalizedBlockTrace, error)
	FilterTraces(traceFilter types.TraceFilter) (traces []types.LocalizedTrace, err error)
	GetTransactionTraces(txHash types.Hash) (traces []types.LocalizedTrace, err error)

	CreateUnsignedTransaction(from types.Address, to types.Address, amount *hexutil.Big, data []byte) (types.UnsignedTransaction, error)
	ApplyUnsignedTransactionDefault(tx *types.UnsignedTransaction) error

	DeployContract(option *types.ContractDeployOption, abiJSON []byte,
		bytecode []byte, constroctorParams ...interface{}) *ContractDeployResult
	GetContract(abiJSON []byte, deployedAt *types.Address) (*Contract, error)
	GetAccountPendingInfo(address types.Address) (pendignInfo *types.AccountPendingInfo, err error)
	GetAccountPendingTransactions(address types.Address, startNonce *hexutil.Big, limit *hexutil.Uint64) (pendingTxs types.AccountPendingTransactions, err error)
	GetEpochReceipts(epoch types.Epoch) (receipts [][]types.TransactionReceipt, err error)
	GetEpochReceiptsByPivotBlockHash(hash types.Hash) (receipts [][]types.TransactionReceipt, err error)

	BatchGetTxByHashes(txhashes []types.Hash) (map[types.Hash]*types.Transaction, error)
	BatchGetBlockSummarys(blockhashes []types.Hash) (map[types.Hash]*types.BlockSummary, error)
	BatchGetBlockSummarysByNumber(blocknumbers []hexutil.Uint64) (map[hexutil.Uint64]*types.BlockSummary, error)
	BatchGetRawBlockConfirmationRisk(blockhashes []types.Hash) (map[types.Hash]*big.Int, error)
	BatchGetBlockConfirmationRisk(blockhashes []types.Hash) (map[types.Hash]*big.Float, error)

	Close()

	SubscribeNewHeads(channel chan types.BlockHeader) (*rpc.ClientSubscription, error)
	SubscribeEpochs(channel chan types.WebsocketEpochResponse, subscriptionEpochType ...types.Epoch) (*rpc.ClientSubscription, error)
	SubscribeLogs(channel chan types.SubscriptionLog, filter types.LogFilter) (*rpc.ClientSubscription, error)

	WaitForTransationBePacked(txhash types.Hash, duration time.Duration) (*types.Transaction, error)
	WaitForTransationReceipt(txhash types.Hash, duration time.Duration) (*types.TransactionReceipt, error)
}

ClientOperator is interface of operate actions on client

type ClientOption added in v0.1.1

type ClientOption struct {
	KeystorePath string
	// retry
	RetryCount    int
	RetryInterval time.Duration
	// timeout of request
	RequestTimeout time.Duration
}

ClientOption for set keystore path and flags for retry

The simplest way to set logger is to use the types.DefaultCallRpcLog and types.DefaultBatchCallRPCLog

type Contract

type Contract struct {
	ABI     abi.ABI
	Client  ClientOperator
	Address *types.Address
}

Contract represents a smart contract. You can conveniently create contract by Client.GetContract or Client.DeployContract.

func NewContract added in v0.1.1

func NewContract(abiJSON []byte, client ClientOperator, address *types.Address) (*Contract, error)

NewContract creates contract by abi and deployed address

func (*Contract) Call

func (contract *Contract) Call(option *types.ContractMethodCallOption, resultPtr interface{}, method string, args ...interface{}) error

Call calls to the contract method with args and fills the excuted result to the "resultPtr".

the resultPtr should be a pointer of the method output struct type.

please refer https://github.com/Conflux-Chain/go-conflux-sdk/blob/master/README.md to get the mappings of solidity types to go types

func (*Contract) DecodeEvent added in v0.1.1

func (contract *Contract) DecodeEvent(out interface{}, event string, log types.Log) error

DecodeEvent unpacks a retrieved log into the provided output structure.

please refer https://github.com/Conflux-Chain/go-conflux-sdk/blob/master/README.md to get the mappings of solidity types to go types

func (*Contract) GetData

func (contract *Contract) GetData(method string, args ...interface{}) ([]byte, error)

GetData packs the given method name to conform the ABI of the contract. Method call's data will consist of method_id, args0, arg1, ... argN. Method id consists of 4 bytes and arguments are all 32 bytes. Method ids are created from the first 4 bytes of the hash of the methods string signature. (signature = baz(uint32,string32))

please refer https://github.com/Conflux-Chain/go-conflux-sdk/blob/master/README.md to get the mappings of solidity types to go types

func (*Contract) SendTransaction

func (contract *Contract) SendTransaction(option *types.ContractMethodSendOption, method string, args ...interface{}) (types.Hash, error)

SendTransaction sends a transaction to the contract method with args and returns its transaction hash

please refer https://github.com/Conflux-Chain/go-conflux-sdk/blob/master/README.md to get the mappings of solidity types to go types

type ContractDeployResult added in v0.1.1

type ContractDeployResult struct {
	//DoneChannel channel for notifying when contract deployed done
	DoneChannel      <-chan struct{}
	TransactionHash  *types.Hash
	Error            error
	DeployedContract *Contract
}

ContractDeployResult for state change notification when deploying contract

type Contractor

type Contractor interface {
	GetData(method string, args ...interface{}) ([]byte, error)
	Call(option *types.ContractMethodCallOption, resultPtr interface{}, method string, args ...interface{}) error
	SendTransaction(option *types.ContractMethodSendOption, method string, args ...interface{}) (types.Hash, error)
	DecodeEvent(out interface{}, event string, log types.Log) error
}

Contractor is interface of contract operator

type HTTPRequester

type HTTPRequester interface {
	Get(url string) (resp *http.Response, err error)
}

HTTPRequester is interface for emitting a http requester

type MockAccountManagerOperator added in v0.3.2

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

MockAccountManagerOperator is a mock of AccountManagerOperator interface

func NewMockAccountManagerOperator added in v0.3.2

func NewMockAccountManagerOperator(ctrl *gomock.Controller) *MockAccountManagerOperator

NewMockAccountManagerOperator creates a new mock instance

func (*MockAccountManagerOperator) Create added in v0.3.2

func (m *MockAccountManagerOperator) Create(passphrase string) (types.Address, error)

Create mocks base method

func (*MockAccountManagerOperator) Delete added in v0.3.2

func (m *MockAccountManagerOperator) Delete(address types.Address, passphrase string) error

Delete mocks base method

func (*MockAccountManagerOperator) EXPECT added in v0.3.2

EXPECT returns an object that allows the caller to indicate expected use

func (*MockAccountManagerOperator) GetDefault added in v0.3.2

func (m *MockAccountManagerOperator) GetDefault() (*types.Address, error)

GetDefault mocks base method

func (*MockAccountManagerOperator) Import added in v0.3.2

func (m *MockAccountManagerOperator) Import(keyFile, passphrase, newPassphrase string) (types.Address, error)

Import mocks base method

func (*MockAccountManagerOperator) List added in v0.3.2

List mocks base method

func (*MockAccountManagerOperator) Lock added in v0.3.2

func (m *MockAccountManagerOperator) Lock(address types.Address) error

Lock mocks base method

func (*MockAccountManagerOperator) Sign added in v0.3.2

func (m *MockAccountManagerOperator) Sign(tx types.UnsignedTransaction, passphrase string) (byte, []byte, []byte, error)

Sign mocks base method

func (*MockAccountManagerOperator) SignAndEcodeTransactionWithPassphrase added in v0.3.2

func (m *MockAccountManagerOperator) SignAndEcodeTransactionWithPassphrase(tx types.UnsignedTransaction, passphrase string) ([]byte, error)

SignAndEcodeTransactionWithPassphrase mocks base method

func (*MockAccountManagerOperator) SignTransaction added in v0.3.2

func (m *MockAccountManagerOperator) SignTransaction(tx types.UnsignedTransaction) ([]byte, error)

SignTransaction mocks base method

func (*MockAccountManagerOperator) SignTransactionWithPassphrase added in v0.3.2

func (m *MockAccountManagerOperator) SignTransactionWithPassphrase(tx types.UnsignedTransaction, passphrase string) (*types.SignedTransaction, error)

SignTransactionWithPassphrase mocks base method

func (*MockAccountManagerOperator) TimedUnlock added in v0.3.2

func (m *MockAccountManagerOperator) TimedUnlock(address types.Address, passphrase string, timeout time.Duration) error

TimedUnlock mocks base method

func (*MockAccountManagerOperator) TimedUnlockDefault added in v0.3.2

func (m *MockAccountManagerOperator) TimedUnlockDefault(passphrase string, timeout time.Duration) error

TimedUnlockDefault mocks base method

func (*MockAccountManagerOperator) Unlock added in v0.3.2

func (m *MockAccountManagerOperator) Unlock(address types.Address, passphrase string) error

Unlock mocks base method

func (*MockAccountManagerOperator) UnlockDefault added in v0.3.2

func (m *MockAccountManagerOperator) UnlockDefault(passphrase string) error

UnlockDefault mocks base method

func (*MockAccountManagerOperator) Update added in v0.3.2

func (m *MockAccountManagerOperator) Update(address types.Address, passphrase, newPassphrase string) error

Update mocks base method

type MockAccountManagerOperatorMockRecorder added in v0.3.2

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

MockAccountManagerOperatorMockRecorder is the mock recorder for MockAccountManagerOperator

func (*MockAccountManagerOperatorMockRecorder) Create added in v0.3.2

func (mr *MockAccountManagerOperatorMockRecorder) Create(passphrase interface{}) *gomock.Call

Create indicates an expected call of Create

func (*MockAccountManagerOperatorMockRecorder) Delete added in v0.3.2

func (mr *MockAccountManagerOperatorMockRecorder) Delete(address, passphrase interface{}) *gomock.Call

Delete indicates an expected call of Delete

func (*MockAccountManagerOperatorMockRecorder) GetDefault added in v0.3.2

GetDefault indicates an expected call of GetDefault

func (*MockAccountManagerOperatorMockRecorder) Import added in v0.3.2

func (mr *MockAccountManagerOperatorMockRecorder) Import(keyFile, passphrase, newPassphrase interface{}) *gomock.Call

Import indicates an expected call of Import

func (*MockAccountManagerOperatorMockRecorder) List added in v0.3.2

List indicates an expected call of List

func (*MockAccountManagerOperatorMockRecorder) Lock added in v0.3.2

func (mr *MockAccountManagerOperatorMockRecorder) Lock(address interface{}) *gomock.Call

Lock indicates an expected call of Lock

func (*MockAccountManagerOperatorMockRecorder) Sign added in v0.3.2

func (mr *MockAccountManagerOperatorMockRecorder) Sign(tx, passphrase interface{}) *gomock.Call

Sign indicates an expected call of Sign

func (*MockAccountManagerOperatorMockRecorder) SignAndEcodeTransactionWithPassphrase added in v0.3.2

func (mr *MockAccountManagerOperatorMockRecorder) SignAndEcodeTransactionWithPassphrase(tx, passphrase interface{}) *gomock.Call

SignAndEcodeTransactionWithPassphrase indicates an expected call of SignAndEcodeTransactionWithPassphrase

func (*MockAccountManagerOperatorMockRecorder) SignTransaction added in v0.3.2

func (mr *MockAccountManagerOperatorMockRecorder) SignTransaction(tx interface{}) *gomock.Call

SignTransaction indicates an expected call of SignTransaction

func (*MockAccountManagerOperatorMockRecorder) SignTransactionWithPassphrase added in v0.3.2

func (mr *MockAccountManagerOperatorMockRecorder) SignTransactionWithPassphrase(tx, passphrase interface{}) *gomock.Call

SignTransactionWithPassphrase indicates an expected call of SignTransactionWithPassphrase

func (*MockAccountManagerOperatorMockRecorder) TimedUnlock added in v0.3.2

func (mr *MockAccountManagerOperatorMockRecorder) TimedUnlock(address, passphrase, timeout interface{}) *gomock.Call

TimedUnlock indicates an expected call of TimedUnlock

func (*MockAccountManagerOperatorMockRecorder) TimedUnlockDefault added in v0.3.2

func (mr *MockAccountManagerOperatorMockRecorder) TimedUnlockDefault(passphrase, timeout interface{}) *gomock.Call

TimedUnlockDefault indicates an expected call of TimedUnlockDefault

func (*MockAccountManagerOperatorMockRecorder) Unlock added in v0.3.2

func (mr *MockAccountManagerOperatorMockRecorder) Unlock(address, passphrase interface{}) *gomock.Call

Unlock indicates an expected call of Unlock

func (*MockAccountManagerOperatorMockRecorder) UnlockDefault added in v0.3.2

func (mr *MockAccountManagerOperatorMockRecorder) UnlockDefault(passphrase interface{}) *gomock.Call

UnlockDefault indicates an expected call of UnlockDefault

func (*MockAccountManagerOperatorMockRecorder) Update added in v0.3.2

func (mr *MockAccountManagerOperatorMockRecorder) Update(address, passphrase, newPassphrase interface{}) *gomock.Call

Update indicates an expected call of Update

type MockClientOperator added in v0.3.2

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

MockClientOperator is a mock of ClientOperator interface

func NewMockClientOperator added in v0.3.2

func NewMockClientOperator(ctrl *gomock.Controller) *MockClientOperator

NewMockClientOperator creates a new mock instance

func (*MockClientOperator) ApplyUnsignedTransactionDefault added in v0.3.2

func (m *MockClientOperator) ApplyUnsignedTransactionDefault(tx *types.UnsignedTransaction) error

ApplyUnsignedTransactionDefault mocks base method

func (*MockClientOperator) BatchCallRPC added in v0.3.2

func (m *MockClientOperator) BatchCallRPC(b []rpc.BatchElem) error

BatchCallRPC mocks base method

func (*MockClientOperator) BatchGetBlockConfirmationRisk added in v0.3.2

func (m *MockClientOperator) BatchGetBlockConfirmationRisk(blockhashes []types.Hash) (map[types.Hash]*big.Float, error)

BatchGetBlockConfirmationRisk mocks base method

func (*MockClientOperator) BatchGetBlockSummarys added in v0.3.2

func (m *MockClientOperator) BatchGetBlockSummarys(blockhashes []types.Hash) (map[types.Hash]*types.BlockSummary, error)

BatchGetBlockSummarys mocks base method

func (*MockClientOperator) BatchGetBlockSummarysByNumber added in v1.0.14

func (m *MockClientOperator) BatchGetBlockSummarysByNumber(blocknumbers []hexutil.Uint64) (map[hexutil.Uint64]*types.BlockSummary, error)

BatchGetBlockSummarysByNumber mocks base method

func (*MockClientOperator) BatchGetRawBlockConfirmationRisk added in v0.3.2

func (m *MockClientOperator) BatchGetRawBlockConfirmationRisk(blockhashes []types.Hash) (map[types.Hash]*big.Int, error)

BatchGetRawBlockConfirmationRisk mocks base method

func (*MockClientOperator) BatchGetTxByHashes added in v0.3.2

func (m *MockClientOperator) BatchGetTxByHashes(txhashes []types.Hash) (map[types.Hash]*types.Transaction, error)

BatchGetTxByHashes mocks base method

func (*MockClientOperator) Call added in v0.3.2

func (m *MockClientOperator) Call(request types.CallRequest, epoch *types.Epoch) (*string, error)

Call mocks base method

func (*MockClientOperator) CallRPC added in v0.3.2

func (m *MockClientOperator) CallRPC(result interface{}, method string, args ...interface{}) error

CallRPC mocks base method

func (*MockClientOperator) Close added in v0.3.2

func (m *MockClientOperator) Close()

Close mocks base method

func (*MockClientOperator) CreateUnsignedTransaction added in v0.3.2

func (m *MockClientOperator) CreateUnsignedTransaction(from, to types.Address, amount *hexutil.Big, data []byte) (*types.UnsignedTransaction, error)

CreateUnsignedTransaction mocks base method

func (*MockClientOperator) Debug added in v0.3.2

func (m *MockClientOperator) Debug(method string, args ...interface{}) (interface{}, error)

Debug mocks base method

func (*MockClientOperator) DeployContract added in v0.3.2

func (m *MockClientOperator) DeployContract(option *types.ContractDeployOption, abiJSON, bytecode []byte, constroctorParams ...interface{}) *ContractDeployResult

DeployContract mocks base method

func (*MockClientOperator) EXPECT added in v0.3.2

EXPECT returns an object that allows the caller to indicate expected use

func (*MockClientOperator) EstimateGasAndCollateral added in v0.3.2

func (m *MockClientOperator) EstimateGasAndCollateral(request types.CallRequest) (*types.Estimate, error)

EstimateGasAndCollateral mocks base method

func (*MockClientOperator) GetBalance added in v0.3.2

func (m *MockClientOperator) GetBalance(address types.Address, epoch ...*types.Epoch) (*big.Int, error)

GetBalance mocks base method

func (*MockClientOperator) GetBestBlockHash added in v0.3.2

func (m *MockClientOperator) GetBestBlockHash() (types.Hash, error)

GetBestBlockHash mocks base method

func (*MockClientOperator) GetBlockByEpoch added in v0.3.2

func (m *MockClientOperator) GetBlockByEpoch(epoch *types.Epoch) (*types.Block, error)

GetBlockByEpoch mocks base method

func (*MockClientOperator) GetBlockByHash added in v0.3.2

func (m *MockClientOperator) GetBlockByHash(blockHash types.Hash) (*types.Block, error)

GetBlockByHash mocks base method

func (*MockClientOperator) GetBlockConfirmationRisk added in v0.3.2

func (m *MockClientOperator) GetBlockConfirmationRisk(blockHash types.Hash) (*big.Float, error)

GetBlockConfirmationRisk mocks base method

func (*MockClientOperator) GetBlockSummaryByEpoch added in v0.3.2

func (m *MockClientOperator) GetBlockSummaryByEpoch(epoch *types.Epoch) (*types.BlockSummary, error)

GetBlockSummaryByEpoch mocks base method

func (*MockClientOperator) GetBlockSummaryByHash added in v0.3.2

func (m *MockClientOperator) GetBlockSummaryByHash(blockHash types.Hash) (*types.BlockSummary, error)

GetBlockSummaryByHash mocks base method

func (*MockClientOperator) GetBlocksByEpoch added in v0.3.2

func (m *MockClientOperator) GetBlocksByEpoch(epoch *types.Epoch) ([]types.Hash, error)

GetBlocksByEpoch mocks base method

func (*MockClientOperator) GetCode added in v0.3.2

func (m *MockClientOperator) GetCode(address types.Address, epoch ...*types.Epoch) (string, error)

GetCode mocks base method

func (*MockClientOperator) GetContract added in v0.3.2

func (m *MockClientOperator) GetContract(abiJSON []byte, deployedAt *types.Address) (*Contract, error)

GetContract mocks base method

func (*MockClientOperator) GetEpochNumber added in v0.3.2

func (m *MockClientOperator) GetEpochNumber(epoch ...*types.Epoch) (*big.Int, error)

GetEpochNumber mocks base method

func (*MockClientOperator) GetGasPrice added in v0.3.2

func (m *MockClientOperator) GetGasPrice() (*big.Int, error)

GetGasPrice mocks base method

func (*MockClientOperator) GetLogs added in v0.3.2

func (m *MockClientOperator) GetLogs(filter types.LogFilter) ([]types.Log, error)

GetLogs mocks base method

func (*MockClientOperator) GetNodeURL added in v0.3.2

func (m *MockClientOperator) GetNodeURL() string

GetNodeURL mocks base method

func (*MockClientOperator) GetRawBlockConfirmationRisk added in v0.3.2

func (m *MockClientOperator) GetRawBlockConfirmationRisk(blockhash types.Hash) (*big.Int, error)

GetRawBlockConfirmationRisk mocks base method

func (*MockClientOperator) GetTransactionByHash added in v0.3.2

func (m *MockClientOperator) GetTransactionByHash(txHash types.Hash) (*types.Transaction, error)

GetTransactionByHash mocks base method

func (*MockClientOperator) GetTransactionReceipt added in v0.3.2

func (m *MockClientOperator) GetTransactionReceipt(txHash types.Hash) (*types.TransactionReceipt, error)

GetTransactionReceipt mocks base method

func (*MockClientOperator) SendRawTransaction added in v0.3.2

func (m *MockClientOperator) SendRawTransaction(rawData []byte) (types.Hash, error)

SendRawTransaction mocks base method

func (*MockClientOperator) SendTransaction added in v0.3.2

func (m *MockClientOperator) SendTransaction(tx *types.UnsignedTransaction) (types.Hash, error)

SendTransaction mocks base method

func (*MockClientOperator) SetAccountManager added in v0.3.2

func (m *MockClientOperator) SetAccountManager(accountManager AccountManagerOperator)

SetAccountManager mocks base method

func (*MockClientOperator) SignEncodedTransactionAndSend added in v0.3.2

func (m *MockClientOperator) SignEncodedTransactionAndSend(encodedTx []byte, v byte, r, s []byte) (*types.Transaction, error)

SignEncodedTransactionAndSend mocks base method

type MockClientOperatorMockRecorder added in v0.3.2

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

MockClientOperatorMockRecorder is the mock recorder for MockClientOperator

func (*MockClientOperatorMockRecorder) ApplyUnsignedTransactionDefault added in v0.3.2

func (mr *MockClientOperatorMockRecorder) ApplyUnsignedTransactionDefault(tx interface{}) *gomock.Call

ApplyUnsignedTransactionDefault indicates an expected call of ApplyUnsignedTransactionDefault

func (*MockClientOperatorMockRecorder) BatchCallRPC added in v0.3.2

func (mr *MockClientOperatorMockRecorder) BatchCallRPC(b interface{}) *gomock.Call

BatchCallRPC indicates an expected call of BatchCallRPC

func (*MockClientOperatorMockRecorder) BatchGetBlockConfirmationRisk added in v0.3.2

func (mr *MockClientOperatorMockRecorder) BatchGetBlockConfirmationRisk(blockhashes interface{}) *gomock.Call

BatchGetBlockConfirmationRisk indicates an expected call of BatchGetBlockConfirmationRisk

func (*MockClientOperatorMockRecorder) BatchGetBlockSummarys added in v0.3.2

func (mr *MockClientOperatorMockRecorder) BatchGetBlockSummarys(blockhashes interface{}) *gomock.Call

BatchGetBlockSummarys indicates an expected call of BatchGetBlockSummarys

func (*MockClientOperatorMockRecorder) BatchGetBlockSummarysByNumber added in v1.0.14

func (mr *MockClientOperatorMockRecorder) BatchGetBlockSummarysByNumber(blocknumbers interface{}) *gomock.Call

BatchGetBlockSummarysByNumber indicates an expected call of BatchGetBlockSummarysByNumber

func (*MockClientOperatorMockRecorder) BatchGetRawBlockConfirmationRisk added in v0.3.2

func (mr *MockClientOperatorMockRecorder) BatchGetRawBlockConfirmationRisk(blockhashes interface{}) *gomock.Call

BatchGetRawBlockConfirmationRisk indicates an expected call of BatchGetRawBlockConfirmationRisk

func (*MockClientOperatorMockRecorder) BatchGetTxByHashes added in v0.3.2

func (mr *MockClientOperatorMockRecorder) BatchGetTxByHashes(txhashes interface{}) *gomock.Call

BatchGetTxByHashes indicates an expected call of BatchGetTxByHashes

func (*MockClientOperatorMockRecorder) Call added in v0.3.2

func (mr *MockClientOperatorMockRecorder) Call(request, epoch interface{}) *gomock.Call

Call indicates an expected call of Call

func (*MockClientOperatorMockRecorder) CallRPC added in v0.3.2

func (mr *MockClientOperatorMockRecorder) CallRPC(result, method interface{}, args ...interface{}) *gomock.Call

CallRPC indicates an expected call of CallRPC

func (*MockClientOperatorMockRecorder) Close added in v0.3.2

Close indicates an expected call of Close

func (*MockClientOperatorMockRecorder) CreateUnsignedTransaction added in v0.3.2

func (mr *MockClientOperatorMockRecorder) CreateUnsignedTransaction(from, to, amount, data interface{}) *gomock.Call

CreateUnsignedTransaction indicates an expected call of CreateUnsignedTransaction

func (*MockClientOperatorMockRecorder) Debug added in v0.3.2

func (mr *MockClientOperatorMockRecorder) Debug(method interface{}, args ...interface{}) *gomock.Call

Debug indicates an expected call of Debug

func (*MockClientOperatorMockRecorder) DeployContract added in v0.3.2

func (mr *MockClientOperatorMockRecorder) DeployContract(option, abiJSON, bytecode interface{}, constroctorParams ...interface{}) *gomock.Call

DeployContract indicates an expected call of DeployContract

func (*MockClientOperatorMockRecorder) EstimateGasAndCollateral added in v0.3.2

func (mr *MockClientOperatorMockRecorder) EstimateGasAndCollateral(request interface{}) *gomock.Call

EstimateGasAndCollateral indicates an expected call of EstimateGasAndCollateral

func (*MockClientOperatorMockRecorder) GetBalance added in v0.3.2

func (mr *MockClientOperatorMockRecorder) GetBalance(address interface{}, epoch ...interface{}) *gomock.Call

GetBalance indicates an expected call of GetBalance

func (*MockClientOperatorMockRecorder) GetBestBlockHash added in v0.3.2

func (mr *MockClientOperatorMockRecorder) GetBestBlockHash() *gomock.Call

GetBestBlockHash indicates an expected call of GetBestBlockHash

func (*MockClientOperatorMockRecorder) GetBlockByEpoch added in v0.3.2

func (mr *MockClientOperatorMockRecorder) GetBlockByEpoch(epoch interface{}) *gomock.Call

GetBlockByEpoch indicates an expected call of GetBlockByEpoch

func (*MockClientOperatorMockRecorder) GetBlockByHash added in v0.3.2

func (mr *MockClientOperatorMockRecorder) GetBlockByHash(blockHash interface{}) *gomock.Call

GetBlockByHash indicates an expected call of GetBlockByHash

func (*MockClientOperatorMockRecorder) GetBlockConfirmationRisk added in v0.3.2

func (mr *MockClientOperatorMockRecorder) GetBlockConfirmationRisk(blockHash interface{}) *gomock.Call

GetBlockConfirmationRisk indicates an expected call of GetBlockConfirmationRisk

func (*MockClientOperatorMockRecorder) GetBlockSummaryByEpoch added in v0.3.2

func (mr *MockClientOperatorMockRecorder) GetBlockSummaryByEpoch(epoch interface{}) *gomock.Call

GetBlockSummaryByEpoch indicates an expected call of GetBlockSummaryByEpoch

func (*MockClientOperatorMockRecorder) GetBlockSummaryByHash added in v0.3.2

func (mr *MockClientOperatorMockRecorder) GetBlockSummaryByHash(blockHash interface{}) *gomock.Call

GetBlockSummaryByHash indicates an expected call of GetBlockSummaryByHash

func (*MockClientOperatorMockRecorder) GetBlocksByEpoch added in v0.3.2

func (mr *MockClientOperatorMockRecorder) GetBlocksByEpoch(epoch interface{}) *gomock.Call

GetBlocksByEpoch indicates an expected call of GetBlocksByEpoch

func (*MockClientOperatorMockRecorder) GetCode added in v0.3.2

func (mr *MockClientOperatorMockRecorder) GetCode(address interface{}, epoch ...interface{}) *gomock.Call

GetCode indicates an expected call of GetCode

func (*MockClientOperatorMockRecorder) GetContract added in v0.3.2

func (mr *MockClientOperatorMockRecorder) GetContract(abiJSON, deployedAt interface{}) *gomock.Call

GetContract indicates an expected call of GetContract

func (*MockClientOperatorMockRecorder) GetEpochNumber added in v0.3.2

func (mr *MockClientOperatorMockRecorder) GetEpochNumber(epoch ...interface{}) *gomock.Call

GetEpochNumber indicates an expected call of GetEpochNumber

func (*MockClientOperatorMockRecorder) GetGasPrice added in v0.3.2

func (mr *MockClientOperatorMockRecorder) GetGasPrice() *gomock.Call

GetGasPrice indicates an expected call of GetGasPrice

func (*MockClientOperatorMockRecorder) GetLogs added in v0.3.2

func (mr *MockClientOperatorMockRecorder) GetLogs(filter interface{}) *gomock.Call

GetLogs indicates an expected call of GetLogs

func (*MockClientOperatorMockRecorder) GetNodeURL added in v0.3.2

func (mr *MockClientOperatorMockRecorder) GetNodeURL() *gomock.Call

GetNodeURL indicates an expected call of GetNodeURL

func (*MockClientOperatorMockRecorder) GetRawBlockConfirmationRisk added in v0.3.2

func (mr *MockClientOperatorMockRecorder) GetRawBlockConfirmationRisk(blockhash interface{}) *gomock.Call

GetRawBlockConfirmationRisk indicates an expected call of GetRawBlockConfirmationRisk

func (*MockClientOperatorMockRecorder) GetTransactionByHash added in v0.3.2

func (mr *MockClientOperatorMockRecorder) GetTransactionByHash(txHash interface{}) *gomock.Call

GetTransactionByHash indicates an expected call of GetTransactionByHash

func (*MockClientOperatorMockRecorder) GetTransactionReceipt added in v0.3.2

func (mr *MockClientOperatorMockRecorder) GetTransactionReceipt(txHash interface{}) *gomock.Call

GetTransactionReceipt indicates an expected call of GetTransactionReceipt

func (*MockClientOperatorMockRecorder) SendRawTransaction added in v0.3.2

func (mr *MockClientOperatorMockRecorder) SendRawTransaction(rawData interface{}) *gomock.Call

SendRawTransaction indicates an expected call of SendRawTransaction

func (*MockClientOperatorMockRecorder) SendTransaction added in v0.3.2

func (mr *MockClientOperatorMockRecorder) SendTransaction(tx interface{}) *gomock.Call

SendTransaction indicates an expected call of SendTransaction

func (*MockClientOperatorMockRecorder) SetAccountManager added in v0.3.2

func (mr *MockClientOperatorMockRecorder) SetAccountManager(accountManager interface{}) *gomock.Call

SetAccountManager indicates an expected call of SetAccountManager

func (*MockClientOperatorMockRecorder) SignEncodedTransactionAndSend added in v0.3.2

func (mr *MockClientOperatorMockRecorder) SignEncodedTransactionAndSend(encodedTx, v, r, s interface{}) *gomock.Call

SignEncodedTransactionAndSend indicates an expected call of SignEncodedTransactionAndSend

type MockContractor added in v0.3.2

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

MockContractor is a mock of Contractor interface

func NewMockContractor added in v0.3.2

func NewMockContractor(ctrl *gomock.Controller) *MockContractor

NewMockContractor creates a new mock instance

func (*MockContractor) Call added in v0.3.2

func (m *MockContractor) Call(option *types.ContractMethodCallOption, resultPtr interface{}, method string, args ...interface{}) error

Call mocks base method

func (*MockContractor) DecodeEvent added in v0.3.2

func (m *MockContractor) DecodeEvent(out interface{}, event string, log types.Log) error

DecodeEvent mocks base method

func (*MockContractor) EXPECT added in v0.3.2

EXPECT returns an object that allows the caller to indicate expected use

func (*MockContractor) GetData added in v0.3.2

func (m *MockContractor) GetData(method string, args ...interface{}) ([]byte, error)

GetData mocks base method

func (*MockContractor) SendTransaction added in v0.3.2

func (m *MockContractor) SendTransaction(option *types.ContractMethodSendOption, method string, args ...interface{}) (*types.Hash, error)

SendTransaction mocks base method

type MockContractorMockRecorder added in v0.3.2

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

MockContractorMockRecorder is the mock recorder for MockContractor

func (*MockContractorMockRecorder) Call added in v0.3.2

func (mr *MockContractorMockRecorder) Call(option, resultPtr, method interface{}, args ...interface{}) *gomock.Call

Call indicates an expected call of Call

func (*MockContractorMockRecorder) DecodeEvent added in v0.3.2

func (mr *MockContractorMockRecorder) DecodeEvent(out, event, log interface{}) *gomock.Call

DecodeEvent indicates an expected call of DecodeEvent

func (*MockContractorMockRecorder) GetData added in v0.3.2

func (mr *MockContractorMockRecorder) GetData(method interface{}, args ...interface{}) *gomock.Call

GetData indicates an expected call of GetData

func (*MockContractorMockRecorder) SendTransaction added in v0.3.2

func (mr *MockContractorMockRecorder) SendTransaction(option, method interface{}, args ...interface{}) *gomock.Call

SendTransaction indicates an expected call of SendTransaction

type MockHTTPRequester added in v0.3.2

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

MockHTTPRequester is a mock of HTTPRequester interface

func NewMockHTTPRequester added in v0.3.2

func NewMockHTTPRequester(ctrl *gomock.Controller) *MockHTTPRequester

NewMockHTTPRequester creates a new mock instance

func (*MockHTTPRequester) EXPECT added in v0.3.2

EXPECT returns an object that allows the caller to indicate expected use

func (*MockHTTPRequester) Get added in v0.3.2

func (m *MockHTTPRequester) Get(url string) (*http.Response, error)

Get mocks base method

type MockHTTPRequesterMockRecorder added in v0.3.2

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

MockHTTPRequesterMockRecorder is the mock recorder for MockHTTPRequester

func (*MockHTTPRequesterMockRecorder) Get added in v0.3.2

func (mr *MockHTTPRequesterMockRecorder) Get(url interface{}) *gomock.Call

Get indicates an expected call of Get

type MockrpcRequester added in v0.3.2

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

MockrpcRequester is a mock of rpcRequester interface

func NewMockrpcRequester added in v0.3.2

func NewMockrpcRequester(ctrl *gomock.Controller) *MockrpcRequester

NewMockrpcRequester creates a new mock instance

func (*MockrpcRequester) BatchCall added in v0.3.2

func (m *MockrpcRequester) BatchCall(b []rpc.BatchElem) error

BatchCall mocks base method

func (*MockrpcRequester) Call added in v0.3.2

func (m *MockrpcRequester) Call(resultPtr interface{}, method string, args ...interface{}) error

Call mocks base method

func (*MockrpcRequester) Close added in v0.3.2

func (m *MockrpcRequester) Close()

Close mocks base method

func (*MockrpcRequester) EXPECT added in v0.3.2

EXPECT returns an object that allows the caller to indicate expected use

type MockrpcRequesterMockRecorder added in v0.3.2

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

MockrpcRequesterMockRecorder is the mock recorder for MockrpcRequester

func (*MockrpcRequesterMockRecorder) BatchCall added in v0.3.2

func (mr *MockrpcRequesterMockRecorder) BatchCall(b interface{}) *gomock.Call

BatchCall indicates an expected call of BatchCall

func (*MockrpcRequesterMockRecorder) Call added in v0.3.2

func (mr *MockrpcRequesterMockRecorder) Call(resultPtr, method interface{}, args ...interface{}) *gomock.Call

Call indicates an expected call of Call

func (*MockrpcRequesterMockRecorder) Close added in v0.3.2

Close indicates an expected call of Close

type RpcPos added in v0.1.1

type RpcPos interface {
	GetStatus() (postypes.Status, error)
	GetAccount(address postypes.Address, view ...hexutil.Uint64) (postypes.Account, error)
	GetCommittee(view ...hexutil.Uint64) (postypes.CommitteeState, error)
	GetBlockByHash(types.Hash) (*postypes.Block, error)
	GetBlockByNumber() (*postypes.Block, error)
	GetTransactionByNumber() (*postypes.Transaction, error)
	GetRewardsByEpoch() (*postypes.EpochReward, error)
}

type RpcPosClient added in v0.1.1

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

func NewRpcPosClient added in v0.1.1

func NewRpcPosClient(core *Client) RpcPosClient

func (*RpcPosClient) GetAccount added in v0.1.1

func (c *RpcPosClient) GetAccount(address postypes.Address, blockNumber ...uint64) (account postypes.Account, err error)

GetAccount returns account info at block

func (*RpcPosClient) GetBlockByHash added in v0.1.1

func (c *RpcPosClient) GetBlockByHash(hash types.Hash) (block *postypes.Block, err error)

GetBlockByHash returns block info of block hash

func (*RpcPosClient) GetBlockByNumber added in v0.1.1

func (c *RpcPosClient) GetBlockByNumber(blockNumber postypes.BlockNumber) (block *postypes.Block, err error)

GetBlockByHash returns block at block number

func (*RpcPosClient) GetCommittee added in v0.1.1

func (c *RpcPosClient) GetCommittee(blockNumber ...uint64) (committee postypes.CommitteeState, err error)

GetCommittee returns committee info at block

func (*RpcPosClient) GetRewardsByEpoch added in v0.1.1

func (c *RpcPosClient) GetRewardsByEpoch(epochNumber uint64) (reward postypes.EpochReward, err error)

GetRewardsByEpoch returns rewards of epoch

func (*RpcPosClient) GetStatus added in v0.1.1

func (c *RpcPosClient) GetStatus() (status postypes.Status, err error)

GetStatus returns pos chain status

func (*RpcPosClient) GetTransactionByNumber added in v0.1.1

func (c *RpcPosClient) GetTransactionByNumber(txNumber uint64) (transaction *postypes.Transaction, err error)

GetTransactionByNumber returns transaction info of transaction number

type RpcRequester added in v0.1.1

type RpcRequester interface {
	Call(resultPtr interface{}, method string, args ...interface{}) error
	CallContext(ctx context.Context, result interface{}, method string, args ...interface{}) error
	BatchCall(b []rpc.BatchElem) error
	BatchCallContext(ctx context.Context, b []rpc.BatchElem) error
	Subscribe(ctx context.Context, namespace string, channel interface{}, args ...interface{}) (*rpc.ClientSubscription, error)
	Close()
}

Directories

Path Synopsis
contract_meta
example
Package rpc implements bi-directional JSON-RPC 2.0 on multiple transports.
Package rpc implements bi-directional JSON-RPC 2.0 on multiple transports.
pos

Jump to

Keyboard shortcuts

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