From 9c7b4a1271b42db95a5f468e20f35e388b8e3e48 Mon Sep 17 00:00:00 2001 From: dayong Date: Tue, 9 Nov 2021 16:59:57 +0800 Subject: [PATCH 1/4] Add comments Add bulk caller of pos/trace/debug update doc --- README.md | 65 ++- api.md | 635 ++++++++++++++++++++++++++++ cfxclient/api.md | 0 cfxclient/bulk/bulk_caller.go | 58 ++- cfxclient/bulk/bulk_caller_cfx.go | 3 + cfxclient/bulk/bulk_caller_debug.go | 3 + cfxclient/bulk/bulk_caller_pos.go | 95 +++++ cfxclient/bulk/bulk_caller_trace.go | 3 + cfxclient/bulk/bulk_sender.go | 23 +- cfxclient/bulk/utils.go | 22 +- generate_doc.sh | 3 +- go.mod | 3 +- go.sum | 6 - tools/bulk_generator.js | 15 +- 14 files changed, 878 insertions(+), 56 deletions(-) create mode 100644 cfxclient/api.md diff --git a/README.md b/README.md index 7aee152..68c70f6 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,10 @@ govendor fetch github.com/Conflux-Chain/go-conflux-sdk ## Usage -[api document](https://github.com/Conflux-Chain/go-conflux-sdk/blob/master/api.md) +- [API document](https://github.com/Conflux-Chain/go-conflux-sdk/blob/master/api.md) +- [Examples](https://github.com/conflux-fans/go-conflux-sdk-examples) + + ## Manage Accounts Use `AccountManager` struct to manage accounts at local machine. @@ -79,6 +82,36 @@ To send a transaction, you need to sign the transaction at local machine, and se 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. +## Batch Query Information and Send Transaction +When we need query many informations or send many transactions, we may need send many requests to rpc server and it may cause request limitation and low efficiency. So we provided batch methods for you to send batch request at a time to avoid this case and imporve efficiency. + +Please see example from [go-conflux-sdk-examples/example_bulk](https://github.com/conflux-fans/go-conflux-sdk-examples/tree/main/example_bulk) +### Batch query information +1. New `BulkCaller` +2. `BulkCaller.Cfx().XXX` *(XXX means rpc methods)* to append request, and the returned result and error are pointer for saving results after requests be sent. + > Besides `Cfx`, there also `Debug`, `Trace`, `Pos` methods for acquire rpc methods for corresponding namespace +3. `BulkCaller.Execute` to send requests. +4. The result and error pointer of step 2 are filled by request results +5. `BulkCaller.Clear` to clear request cache for new bulk call action. + +### Batch call contract +1. Use abigen to generate contract binding +2. There is a struct called `XXXBulkCaller` *(XXX means your contract name)* for bulk call contract methods +3. `XXXBulkCaller.YourContractMethod` to append request to it's first parameter which is bulkSender instance, and the returned result and error are pointer for saving results after requests be sent. +4. Same as step 4 of [`Batch query information`]() + +It's ok to bulk call normal rpc methods and contract call. +### Batch send transaction +1. New `BulkSender` +2. `BulkSender.AppendTransaction` to append unsigned transaction +3. `BulkSender.SignAndSend` to send requests. The transaction hashes and errors will be returned. All of them are slice with same length of step 2. +4. `BulkSender.Clear` to clear request cache for new bulk send action. + +### Batch send contract transaction +1. Use abigen to generate contract binding +2. There is a struct called `XXXBulkTransactor` *(XXX means your contract name)* for bulk send contract transactions +3. Same as step 3 of [`Batch send transaction`]() + ## Deploy/Invoke Smart Contract **The simpiest and recommend way is to use [conflux-abigen](https://github.com/Conflux-Chain/conflux-abigen) to generate contract binding to deploy and invoke with contract** @@ -86,8 +119,6 @@ To send multiple transactions at a time, you can unlock the account at first, th ***[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](https://github.com/Conflux-Chain/go-conflux-sdk/blob/master/api.md) for detail. - - ### Contract Example ***[Depreated]*** Please reference [contract example]((https://github.com/Conflux-Chain/go-conflux-sdk/blob/master/example/example_contract)) for all source code ```go @@ -201,18 +232,18 @@ 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 | +| 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} | diff --git a/api.md b/api.md index 2c333e4..33d12b3 100644 --- a/api.md +++ b/api.md @@ -359,6 +359,12 @@ func (client *Client) GetAccountInfo(account types.Address, epoch ...*types.Epoc ``` GetAccountInfo returns account related states of the given account +#### func (*Client) GetAccountManager + +```go +func (client *Client) GetAccountManager() AccountManagerOperator +``` + #### func (*Client) GetAccountPendingInfo ```go @@ -1248,3 +1254,632 @@ for obtain vote power func (s *Staking) Withdraw(option *types.ContractMethodSendOption, amount *big.Int) (types.Hash, error) ``` Withdraw `amount` cfx from this contract +# bulk + +This file is auto-generated by bulk_generator, please don't edit + + + +### type BulkCaller + +```go +type BulkCaller struct { + BulkCallerCore + + *BulkCfxCaller +} +``` + +BulkCaller used for bulk call rpc in one request to imporve efficiency + +#### func NewBulkerCaller + +```go +func NewBulkerCaller(rpcCaller sdk.ClientOperator) *BulkCaller +``` +NewBulkerCaller creates new bulk caller instance + +#### func (*BulkCaller) Cfx + +```go +func (b *BulkCaller) Cfx() *BulkCfxCaller +``` +Cfx returns BulkCfxCaller for genereating "cfx" namespace relating rpc request + +#### func (*BulkCaller) Clear + +```go +func (b *BulkCaller) Clear() +``` +Clear clear requests and errors in queue for new bulk call action + +#### func (*BulkCaller) Customer + +```go +func (b *BulkCaller) Customer() *BulkCustomCaller +``` +Customer returns BulkCustomCaller for genereating contract relating rpc request +which mainly for decoding contract call result with type *hexutil.Big to ABI +defined types + +#### func (*BulkCaller) Debug + +```go +func (b *BulkCaller) Debug() *BulkDebugCaller +``` +Debug returns BulkDebugCaller for genereating "debug" namespace relating rpc +request + +#### func (*BulkCaller) Execute + +```go +func (b *BulkCaller) Execute() error +``` +Execute sends all rpc requests in queue by rpc call "batch" on one request + +#### func (*BulkCaller) Pos + +```go +func (b *BulkCaller) Pos() *BulkPosCaller +``` +Pos returns BulkTraceCaller for genereating "pos" namespace relating rpc request + +#### func (*BulkCaller) Trace + +```go +func (b *BulkCaller) Trace() *BulkTraceCaller +``` +Trace returns BulkTraceCaller for genereating "trace" namespace relating rpc +request + +### type BulkCallerCore + +```go +type BulkCallerCore struct { +} +``` + + +#### func NewBulkCallerCore + +```go +func NewBulkCallerCore(rpcCaller sdk.ClientOperator) BulkCallerCore +``` + +### type BulkCfxCaller + +```go +type BulkCfxCaller BulkCallerCore +``` + +BulkCfxCaller used for bulk call rpc in one request to imporve efficiency + +#### func NewBulkCfxCaller + +```go +func NewBulkCfxCaller(core BulkCallerCore) *BulkCfxCaller +``` +NewBulkCfxCaller creates new BulkCfxCaller instance + +#### func (*BulkCfxCaller) Call + +```go +func (client *BulkCfxCaller) Call(request types.CallRequest, epoch *types.Epoch) (*hexutil.Bytes, *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 (*BulkCfxCaller) CheckBalanceAgainstTransaction + +```go +func (client *BulkCfxCaller) CheckBalanceAgainstTransaction(accountAddress types.Address, + contractAddress types.Address, + gasLimit *hexutil.Big, + gasPrice *hexutil.Big, + storageLimit *hexutil.Big, + epoch ...*types.Epoch) (*types.CheckBalanceAgainstTransactionResponse, *error) +``` +CheckBalanceAgainstTransaction checks if user balance is enough for the +transaction. + +#### func (*BulkCfxCaller) EstimateGasAndCollateral + +```go +func (client *BulkCfxCaller) EstimateGasAndCollateral(request types.CallRequest, epoch ...*types.Epoch) (*types.Estimate, *error) +``` +EstimateGasAndCollateral excutes a message call "request" and returns the amount +of the gas used and storage for collateral + +#### func (*BulkCfxCaller) Execute + +```go +func (b *BulkCfxCaller) Execute() ([]error, error) +``` +Execute sends all rpc requests in queue by rpc call "batch" on one request + +#### func (*BulkCfxCaller) GetAccountInfo + +```go +func (client *BulkCfxCaller) GetAccountInfo(account types.Address, epoch ...*types.Epoch) (*types.AccountInfo, *error) +``` +GetAccountInfo returns account related states of the given account + +#### func (*BulkCfxCaller) GetAccountPendingInfo + +```go +func (client *BulkCfxCaller) GetAccountPendingInfo(address types.Address) (*types.AccountPendingInfo, *error) +``` +GetAccountPendingInfo gets transaction pending info by account address + +#### func (*BulkCfxCaller) GetAccountPendingTransactions + +```go +func (client *BulkCfxCaller) GetAccountPendingTransactions(address types.Address, startNonce *hexutil.Big, limit *hexutil.Uint64) (*types.AccountPendingTransactions, *error) +``` + +#### func (*BulkCfxCaller) GetAccumulateInterestRate + +```go +func (client *BulkCfxCaller) GetAccumulateInterestRate(epoch ...*types.Epoch) (*hexutil.Big, *error) +``` +GetAccumulateInterestRate returns accumulate interest rate of the given epoch + +#### func (*BulkCfxCaller) GetAdmin + +```go +func (client *BulkCfxCaller) GetAdmin(contractAddress types.Address, epoch ...*types.Epoch) (*types.Address, *error) +``` +GetAdmin returns admin of the given contract, it will return nil if contract not +exist + +#### func (*BulkCfxCaller) GetBalance + +```go +func (client *BulkCfxCaller) GetBalance(address types.Address, epoch ...*types.Epoch) (*hexutil.Big, *error) +``` +GetBalance returns the balance of specified address at epoch. + +#### func (*BulkCfxCaller) GetBestBlockHash + +```go +func (client *BulkCfxCaller) GetBestBlockHash() (*types.Hash, *error) +``` +GetBestBlockHash returns the current best block hash. + +#### func (*BulkCfxCaller) GetBlockByBlockNumber + +```go +func (client *BulkCfxCaller) GetBlockByBlockNumber(blockNumer hexutil.Uint64) (*types.Block, *error) +``` + +#### func (*BulkCfxCaller) GetBlockByEpoch + +```go +func (client *BulkCfxCaller) GetBlockByEpoch(epoch *types.Epoch) (*types.Block, *error) +``` +GetBlockByEpoch returns the block of specified epoch. If the epoch is invalid, +return the concrete error. + +#### func (*BulkCfxCaller) GetBlockByHash + +```go +func (client *BulkCfxCaller) GetBlockByHash(blockHash types.Hash) (*types.Block, *error) +``` +GetBlockByHash returns the block of specified blockHash If the block is not +found, return nil. + +#### func (*BulkCfxCaller) GetBlockByHashWithPivotAssumption + +```go +func (client *BulkCfxCaller) GetBlockByHashWithPivotAssumption(blockHash types.Hash, pivotHash types.Hash, epoch hexutil.Uint64) (*types.Block, *error) +``` +GetBlockByHashWithPivotAssumption returns block with given hash and pivot chain +assumption. + +#### func (*BulkCfxCaller) GetBlockRewardInfo + +```go +func (client *BulkCfxCaller) GetBlockRewardInfo(epoch types.Epoch) ([]types.RewardInfo, *error) +``` +GetBlockRewardInfo returns block reward information in an epoch + +#### func (*BulkCfxCaller) GetBlockSummaryByBlockNumber + +```go +func (client *BulkCfxCaller) GetBlockSummaryByBlockNumber(blockNumer hexutil.Uint64) (*types.BlockSummary, *error) +``` + +#### func (*BulkCfxCaller) GetBlockSummaryByEpoch + +```go +func (client *BulkCfxCaller) GetBlockSummaryByEpoch(epoch *types.Epoch) (*types.BlockSummary, *error) +``` +GetBlockSummaryByEpoch returns the block summary of specified epoch. If the +epoch is invalid, return the concrete error. + +#### func (*BulkCfxCaller) GetBlockSummaryByHash + +```go +func (client *BulkCfxCaller) GetBlockSummaryByHash(blockHash types.Hash) (*types.BlockSummary, *error) +``` +GetBlockSummaryByHash returns the block summary of specified blockHash If the +block is not found, return nil. + +#### func (*BulkCfxCaller) GetBlocksByEpoch + +```go +func (client *BulkCfxCaller) GetBlocksByEpoch(epoch *types.Epoch) ([]types.Hash, *error) +``` +GetBlocksByEpoch returns the blocks hash in the specified epoch. + +#### func (*BulkCfxCaller) GetClientVersion + +```go +func (client *BulkCfxCaller) GetClientVersion() (*string, *error) +``` +GetClientVersion returns the client version as a string + +#### func (*BulkCfxCaller) GetCode + +```go +func (client *BulkCfxCaller) GetCode(address types.Address, epoch ...*types.Epoch) (*hexutil.Bytes, *error) +``` +GetCode returns the bytecode in HEX format of specified address at epoch. + +#### func (*BulkCfxCaller) GetCollateralForStorage + +```go +func (client *BulkCfxCaller) GetCollateralForStorage(account types.Address, epoch ...*types.Epoch) (*hexutil.Big, *error) +``` +GetCollateralForStorage returns balance of the given account. + +#### func (*BulkCfxCaller) GetDepositList + +```go +func (client *BulkCfxCaller) GetDepositList(address types.Address, epoch ...*types.Epoch) ([]types.DepositInfo, *error) +``` +GetDepositList returns deposit list of the given account. + +#### func (*BulkCfxCaller) GetEpochNumber + +```go +func (client *BulkCfxCaller) GetEpochNumber(epoch ...*types.Epoch) (*hexutil.Big, *error) +``` + +#### func (*BulkCfxCaller) GetGasPrice + +```go +func (client *BulkCfxCaller) GetGasPrice() (*hexutil.Big, *error) +``` + +#### func (*BulkCfxCaller) GetInterestRate + +```go +func (client *BulkCfxCaller) GetInterestRate(epoch ...*types.Epoch) (*hexutil.Big, *error) +``` +GetInterestRate returns interest rate of the given epoch + +#### func (*BulkCfxCaller) GetLogs + +```go +func (client *BulkCfxCaller) GetLogs(filter types.LogFilter) ([]types.Log, *error) +``` +GetLogs returns logs that matching the specified filter. + +#### func (*BulkCfxCaller) GetNextNonce + +```go +func (client *BulkCfxCaller) GetNextNonce(address types.Address, epoch ...*types.Epoch) (*hexutil.Big, *error) +``` +GetNextNonce returns the next transaction nonce of address + +#### func (*BulkCfxCaller) GetRawBlockConfirmationRisk + +```go +func (client *BulkCfxCaller) GetRawBlockConfirmationRisk(blockhash types.Hash) (*hexutil.Big, *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 (*BulkCfxCaller) GetSkippedBlocksByEpoch + +```go +func (client *BulkCfxCaller) GetSkippedBlocksByEpoch(epoch *types.Epoch) ([]types.Hash, *error) +``` +GetSkippedBlocksByEpoch returns skipped block hashes of given epoch + +#### func (*BulkCfxCaller) GetSponsorInfo + +```go +func (client *BulkCfxCaller) GetSponsorInfo(contractAddress types.Address, epoch ...*types.Epoch) (*types.SponsorInfo, *error) +``` +GetSponsorInfo returns sponsor information of the given contract + +#### func (*BulkCfxCaller) GetStakingBalance + +```go +func (client *BulkCfxCaller) GetStakingBalance(account types.Address, epoch ...*types.Epoch) (*hexutil.Big, *error) +``` +GetStakingBalance returns balance of the given account. + +#### func (*BulkCfxCaller) GetStorageAt + +```go +func (client *BulkCfxCaller) GetStorageAt(address types.Address, position types.Hash, epoch ...*types.Epoch) (*hexutil.Bytes, *error) +``` +GetStorageAt returns storage entries from a given contract. + +#### func (*BulkCfxCaller) GetStorageRoot + +```go +func (client *BulkCfxCaller) GetStorageRoot(address types.Address, epoch ...*types.Epoch) (*types.StorageRoot, *error) +``` +GetStorageRoot returns storage root of given address + +#### func (*BulkCfxCaller) GetSupplyInfo + +```go +func (client *BulkCfxCaller) GetSupplyInfo(epoch ...*types.Epoch) (*types.TokenSupplyInfo, *error) +``` +GetSupplyInfo Return information about total token supply. + +#### func (*BulkCfxCaller) GetTransactionByHash + +```go +func (client *BulkCfxCaller) GetTransactionByHash(txHash types.Hash) (*types.Transaction, *error) +``` +GetTransactionByHash returns transaction for the specified txHash. If the +transaction is not found, return nil. + +#### func (*BulkCfxCaller) GetTransactionReceipt + +```go +func (client *BulkCfxCaller) GetTransactionReceipt(txHash types.Hash) (*types.TransactionReceipt, *error) +``` +GetTransactionReceipt returns the receipt of specified transaction hash. If no +receipt is found, return nil. + +#### func (*BulkCfxCaller) GetVoteList + +```go +func (client *BulkCfxCaller) GetVoteList(address types.Address, epoch ...*types.Epoch) ([]types.VoteStakeInfo, *error) +``` +GetVoteList returns vote list of the given account. + +#### func (*BulkCfxCaller) SendRawTransaction + +```go +func (client *BulkCfxCaller) SendRawTransaction(rawData []byte) (*types.Hash, *error) +``` + +### type BulkCustomCaller + +```go +type BulkCustomCaller struct { + BulkCallerCore +} +``` + + +#### func NewBulkCustomCaller + +```go +func NewBulkCustomCaller(core BulkCallerCore, + outHandlers map[int]*OutputHandler, +) *BulkCustomCaller +``` + +#### func (*BulkCustomCaller) ContractCall + +```go +func (client *BulkCustomCaller) ContractCall(request types.CallRequest, + epoch *types.Epoch, + outDecoder OutputHandler, + errPtr *error, +) +``` + +### type BulkDebugCaller + +```go +type BulkDebugCaller BulkCallerCore +``` + +BulkDebugCaller used for bulk call rpc in one request to imporve efficiency + +#### func NewBulkDebugCaller + +```go +func NewBulkDebugCaller(core BulkCallerCore) *BulkDebugCaller +``` +NewBulkDebugCaller creates new BulkDebugCaller instance + +#### func (*BulkDebugCaller) Execute + +```go +func (b *BulkDebugCaller) Execute() ([]error, error) +``` +Execute sends all rpc requests in queue by rpc call "batch" on one request + +#### func (*BulkDebugCaller) GetEpochReceipts + +```go +func (client *BulkDebugCaller) GetEpochReceipts(epoch types.Epoch) ([][]types.TransactionReceipt, *error) +``` + +#### func (*BulkDebugCaller) GetEpochReceiptsByPivotBlockHash + +```go +func (client *BulkDebugCaller) GetEpochReceiptsByPivotBlockHash(hash types.Hash) ([][]types.TransactionReceipt, *error) +``` + +### type BulkPosCaller + +```go +type BulkPosCaller BulkCallerCore +``` + +BulkPosCaller used for bulk call rpc in one request to imporve efficiency + +#### func NewBulkPosCaller + +```go +func NewBulkPosCaller(core BulkCallerCore) *BulkPosCaller +``` +NewBulkPosCaller creates new BulkPosCaller instance + +#### func (*BulkPosCaller) Execute + +```go +func (b *BulkPosCaller) Execute() ([]error, error) +``` +Execute sends all rpc requests in queue by rpc call "batch" on one request + +#### func (*BulkPosCaller) GetAccount + +```go +func (client *BulkPosCaller) GetAccount(address postypes.Address, blockNumber ...uint64) (*postypes.Account, *error) +``` +GetAccount returns account info at block + +#### func (*BulkPosCaller) GetBlockByHash + +```go +func (client *BulkPosCaller) GetBlockByHash(hash types.Hash) (*postypes.Block, *error) +``` +GetBlockByHash returns block info of block hash + +#### func (*BulkPosCaller) GetBlockByNumber + +```go +func (client *BulkPosCaller) GetBlockByNumber(blockNumber postypes.BlockNumber) (*postypes.Block, *error) +``` +GetBlockByHash returns block at block number + +#### func (*BulkPosCaller) GetCommittee + +```go +func (client *BulkPosCaller) GetCommittee(blockNumber ...uint64) (*postypes.CommitteeState, *error) +``` +GetCommittee returns committee info at block + +#### func (*BulkPosCaller) GetRewardsByEpoch + +```go +func (client *BulkPosCaller) GetRewardsByEpoch(epochNumber uint64) (*postypes.EpochReward, *error) +``` +GetRewardsByEpoch returns rewards of epoch + +#### func (*BulkPosCaller) GetStatus + +```go +func (client *BulkPosCaller) GetStatus() (*postypes.Status, *error) +``` + +#### func (*BulkPosCaller) GetTransactionByNumber + +```go +func (client *BulkPosCaller) GetTransactionByNumber(txNumber uint64) (*postypes.Transaction, *error) +``` +GetTransactionByNumber returns transaction info of transaction number + +### type BulkSender + +```go +type BulkSender struct { +} +``` + +BulkSender used for bulk send unsigned tranactions in one request to imporve +efficiency, it will auto populate missing fields and nonce of unsigned +transactions in queue before send. + +#### func NewBuckSender + +```go +func NewBuckSender(signableClient sdk.Client) *BulkSender +``` +NewBuckSender creates new bulk sender instance + +#### func (*BulkSender) AppendTransaction + +```go +func (b *BulkSender) AppendTransaction(tx types.UnsignedTransaction) *BulkSender +``` +AppendTransaction append unsigned transaction to queue + +#### func (*BulkSender) Clear + +```go +func (b *BulkSender) Clear() +``` +Clear clear batch elems and errors in queue for new bulk call action + +#### func (*BulkSender) PopulateTransactions + +```go +func (b *BulkSender) PopulateTransactions() error +``` +PopulateTransactions fill missing fields and nonce for unsigned transactions in +queue + +#### func (*BulkSender) SignAndSend + +```go +func (b *BulkSender) SignAndSend() (txHashes []*types.Hash, txErrors []error, batchErr error) +``` +SignAndSend signs and sends all unsigned transactions in queue by rpc call +"batch" on one request and returns the result of sending transactions. If there +is any error on rpc "batch", it will be returned with batchErr not nil. If there +is no error on rpc "batch", it will return the txHashes or txErrors of sending +transactions. + +### type BulkTraceCaller + +```go +type BulkTraceCaller BulkCallerCore +``` + +BulkTraceCaller used for bulk call rpc in one request to imporve efficiency + +#### func NewBulkTraceCaller + +```go +func NewBulkTraceCaller(core BulkCallerCore) *BulkTraceCaller +``` +NewBulkTraceCaller creates new BulkTraceCaller instance + +#### func (*BulkTraceCaller) Execute + +```go +func (b *BulkTraceCaller) Execute() ([]error, error) +``` +Execute sends all rpc requests in queue by rpc call "batch" on one request + +#### func (*BulkTraceCaller) FilterTraces + +```go +func (client *BulkTraceCaller) FilterTraces(traceFilter types.TraceFilter) ([]types.LocalizedTrace, *error) +``` +GetFilterTraces returns all traces matching the provided filter. + +#### func (*BulkTraceCaller) GetBlockTraces + +```go +func (client *BulkTraceCaller) GetBlockTraces(blockHash types.Hash) (*types.LocalizedBlockTrace, *error) +``` + +#### func (*BulkTraceCaller) GetTransactionTraces + +```go +func (client *BulkTraceCaller) GetTransactionTraces(txHash types.Hash) ([]types.LocalizedTrace, *error) +``` +GetTransactionTraces returns all traces produced at the given transaction. + +### type OutputHandler + +```go +type OutputHandler func(out []byte) error +``` diff --git a/cfxclient/api.md b/cfxclient/api.md new file mode 100644 index 0000000..e69de29 diff --git a/cfxclient/bulk/bulk_caller.go b/cfxclient/bulk/bulk_caller.go index bf69804..c4ecb4a 100644 --- a/cfxclient/bulk/bulk_caller.go +++ b/cfxclient/bulk/bulk_caller.go @@ -15,31 +15,41 @@ type BulkCallerCore struct { errors *[]*error } +func NewBulkCallerCore(rpcCaller sdk.ClientOperator) BulkCallerCore { + batchElems := make([]rpc.BatchElem, 0, 10) + errors := make([]*error, 0, 10) + + return BulkCallerCore{ + caller: rpcCaller, + batchElems: &batchElems, + errors: &errors, + } +} + func (b *BulkCallerCore) appendElemsAndError(elem rpc.BatchElem, err *error) { *b.batchElems = append(*b.batchElems, elem) *b.errors = append(*b.errors, err) } +// BulkCaller used for bulk call rpc in one request to imporve efficiency type BulkCaller struct { BulkCallerCore outHandlers map[int]*OutputHandler *BulkCfxCaller + debug *BulkDebugCaller + trace *BulkTraceCaller + pos *BulkPosCaller customer *BulkCustomCaller } +// NewBulkerCaller creates new bulk caller instance func NewBulkerCaller(rpcCaller sdk.ClientOperator) *BulkCaller { - batchElems := make([]rpc.BatchElem, 0, 10) - errors := make([]*error, 0, 10) - outHandlers := make(map[int]*OutputHandler) - - core := BulkCallerCore{ - caller: rpcCaller, - batchElems: &batchElems, - errors: &errors, - } + core := NewBulkCallerCore(rpcCaller) cfx := NewBulkCfxCaller(core) + + outHandlers := make(map[int]*OutputHandler) customer := NewBulkCustomCaller(core, outHandlers) return &BulkCaller{ @@ -50,14 +60,32 @@ func NewBulkerCaller(rpcCaller sdk.ClientOperator) *BulkCaller { } } +// Cfx returns BulkCfxCaller for genereating "cfx" namespace relating rpc request func (b *BulkCaller) Cfx() *BulkCfxCaller { return b.BulkCfxCaller } +// Debug returns BulkDebugCaller for genereating "debug" namespace relating rpc request +func (b *BulkCaller) Debug() *BulkDebugCaller { + return b.debug +} + +// Trace returns BulkTraceCaller for genereating "trace" namespace relating rpc request +func (b *BulkCaller) Trace() *BulkTraceCaller { + return b.trace +} + +// Pos returns BulkTraceCaller for genereating "pos" namespace relating rpc request +func (b *BulkCaller) Pos() *BulkPosCaller { + return b.pos +} + +// Customer returns BulkCustomCaller for genereating contract relating rpc request which mainly for decoding contract call result with type *hexutil.Big to ABI defined types func (b *BulkCaller) Customer() *BulkCustomCaller { return b.customer } +// Execute sends all rpc requests in queue by rpc call "batch" on one request func (b *BulkCaller) Execute() error { _errors, _err := batchCall(b.BulkCallerCore.caller, b.BulkCallerCore.batchElems, b.outHandlers) if _err != nil { @@ -70,8 +98,10 @@ func (b *BulkCaller) Execute() error { return nil } +// Clear clear requests and errors in queue for new bulk call action func (b *BulkCaller) Clear() { *b.BulkCallerCore.batchElems = (*b.BulkCallerCore.batchElems)[:0] + *b.BulkCallerCore.errors = (*b.BulkCallerCore.errors)[:0] } func batchCall(caller sdk.ClientOperator, @@ -119,13 +149,3 @@ func batchCall(caller sdk.ClientOperator, } return _errors, nil } - -func newBatchElem(result interface{}, method string, args ...interface{}) rpc.BatchElem { - return rpc.BatchElem{ - Method: method, - Result: &result, - Args: args, - } -} - -// func appendBatchElem() diff --git a/cfxclient/bulk/bulk_caller_cfx.go b/cfxclient/bulk/bulk_caller_cfx.go index e014a1b..6586491 100644 --- a/cfxclient/bulk/bulk_caller_cfx.go +++ b/cfxclient/bulk/bulk_caller_cfx.go @@ -6,12 +6,15 @@ import ( "github.com/ethereum/go-ethereum/common/hexutil" ) +// BulkCfxCaller used for bulk call rpc in one request to imporve efficiency type BulkCfxCaller BulkCallerCore +// NewBulkCfxCaller creates new BulkCfxCaller instance func NewBulkCfxCaller(core BulkCallerCore) *BulkCfxCaller { return (*BulkCfxCaller)(&core) } +// Execute sends all rpc requests in queue by rpc call "batch" on one request func (b *BulkCfxCaller) Execute() ([]error, error) { return batchCall(b.caller, b.batchElems, nil) } diff --git a/cfxclient/bulk/bulk_caller_debug.go b/cfxclient/bulk/bulk_caller_debug.go index 2c8472f..9125295 100644 --- a/cfxclient/bulk/bulk_caller_debug.go +++ b/cfxclient/bulk/bulk_caller_debug.go @@ -7,12 +7,15 @@ import ( "github.com/Conflux-Chain/go-conflux-sdk/types" ) +// BulkDebugCaller used for bulk call rpc in one request to imporve efficiency type BulkDebugCaller BulkCallerCore +// NewBulkDebugCaller creates new BulkDebugCaller instance func NewBulkDebugCaller(core BulkCallerCore) *BulkDebugCaller { return (*BulkDebugCaller)(&core) } +// Execute sends all rpc requests in queue by rpc call "batch" on one request func (b *BulkDebugCaller) Execute() ([]error, error) { return batchCall(b.caller, b.batchElems, nil) } diff --git a/cfxclient/bulk/bulk_caller_pos.go b/cfxclient/bulk/bulk_caller_pos.go index 605a34c..f6da687 100644 --- a/cfxclient/bulk/bulk_caller_pos.go +++ b/cfxclient/bulk/bulk_caller_pos.go @@ -1 +1,96 @@ +// This file is auto-generated by bulk_generator, please don't edit package bulk + +import ( + "github.com/Conflux-Chain/go-conflux-sdk/types" + postypes "github.com/Conflux-Chain/go-conflux-sdk/types/pos" + "github.com/ethereum/go-ethereum/common/hexutil" +) + +// BulkPosCaller used for bulk call rpc in one request to imporve efficiency +type BulkPosCaller BulkCallerCore + +// NewBulkPosCaller creates new BulkPosCaller instance +func NewBulkPosCaller(core BulkCallerCore) *BulkPosCaller { + return (*BulkPosCaller)(&core) +} + +// Execute sends all rpc requests in queue by rpc call "batch" on one request +func (b *BulkPosCaller) Execute() ([]error, error) { + return batchCall(b.caller, b.batchElems, nil) +} + +//ignore + +//ignore + +func (client *BulkPosCaller) GetStatus() (*postypes.Status, *error) { + result := new(postypes.Status) + err := new(error) + + elem := newBatchElem(result, "pos_getStatus") + (*BulkCallerCore)(client).appendElemsAndError(elem, err) + return result, err +} + +// GetAccount returns account info at block +func (client *BulkPosCaller) GetAccount(address postypes.Address, blockNumber ...uint64) (*postypes.Account, *error) { + result := new(postypes.Account) + err := new(error) + _view := get1stU64Ify(blockNumber) + + elem := newBatchElem(result, "pos_getAccount", address, _view) + (*BulkCallerCore)(client).appendElemsAndError(elem, err) + return result, err +} + +// GetCommittee returns committee info at block +func (client *BulkPosCaller) GetCommittee(blockNumber ...uint64) (*postypes.CommitteeState, *error) { + result := new(postypes.CommitteeState) + err := new(error) + _view := get1stU64Ify(blockNumber) + + elem := newBatchElem(result, "pos_getCommittee", _view) + (*BulkCallerCore)(client).appendElemsAndError(elem, err) + return result, err +} + +// GetBlockByHash returns block info of block hash +func (client *BulkPosCaller) GetBlockByHash(hash types.Hash) (*postypes.Block, *error) { + result := new(postypes.Block) + err := new(error) + + elem := newBatchElem(result, "pos_getBlockByHash", hash) + (*BulkCallerCore)(client).appendElemsAndError(elem, err) + return result, err +} + +// GetBlockByHash returns block at block number +func (client *BulkPosCaller) GetBlockByNumber(blockNumber postypes.BlockNumber) (*postypes.Block, *error) { + result := new(postypes.Block) + err := new(error) + + elem := newBatchElem(result, "pos_getBlockByNumber", blockNumber) + (*BulkCallerCore)(client).appendElemsAndError(elem, err) + return result, err +} + +// GetTransactionByNumber returns transaction info of transaction number +func (client *BulkPosCaller) GetTransactionByNumber(txNumber uint64) (*postypes.Transaction, *error) { + result := new(postypes.Transaction) + err := new(error) + + elem := newBatchElem(result, "pos_getTransactionByNumber", hexutil.Uint64(txNumber)) + (*BulkCallerCore)(client).appendElemsAndError(elem, err) + return result, err +} + +// GetRewardsByEpoch returns rewards of epoch +func (client *BulkPosCaller) GetRewardsByEpoch(epochNumber uint64) (*postypes.EpochReward, *error) { + result := new(postypes.EpochReward) + err := new(error) + + elem := newBatchElem(result, "pos_getRewardsByEpoch", hexutil.Uint64(epochNumber)) + (*BulkCallerCore)(client).appendElemsAndError(elem, err) + return result, err +} diff --git a/cfxclient/bulk/bulk_caller_trace.go b/cfxclient/bulk/bulk_caller_trace.go index c9218a1..a9cb9e8 100644 --- a/cfxclient/bulk/bulk_caller_trace.go +++ b/cfxclient/bulk/bulk_caller_trace.go @@ -5,12 +5,15 @@ import ( "github.com/Conflux-Chain/go-conflux-sdk/types" ) +// BulkTraceCaller used for bulk call rpc in one request to imporve efficiency type BulkTraceCaller BulkCallerCore +// NewBulkTraceCaller creates new BulkTraceCaller instance func NewBulkTraceCaller(core BulkCallerCore) *BulkTraceCaller { return (*BulkTraceCaller)(&core) } +// Execute sends all rpc requests in queue by rpc call "batch" on one request func (b *BulkTraceCaller) Execute() ([]error, error) { return batchCall(b.caller, b.batchElems, nil) } diff --git a/cfxclient/bulk/bulk_sender.go b/cfxclient/bulk/bulk_sender.go index 219cf30..21e8240 100644 --- a/cfxclient/bulk/bulk_sender.go +++ b/cfxclient/bulk/bulk_sender.go @@ -11,25 +11,27 @@ import ( "github.com/pkg/errors" ) +// BulkSender used for bulk send unsigned tranactions in one request to imporve efficiency, +// it will auto populate missing fields and nonce of unsigned transactions in queue before send. type BulkSender struct { - // bulkCaller *BulkCaller signalbeCaller sdk.ClientOperator unsignedTxs []*types.UnsignedTransaction - // wallet interfaces.Wallet } +// NewBuckSender creates new bulk sender instance func NewBuckSender(signableClient sdk.Client) *BulkSender { return &BulkSender{ - // bulkCaller: bulkCaller, signalbeCaller: &signableClient, } } +// AppendTransaction append unsigned transaction to queue func (b *BulkSender) AppendTransaction(tx types.UnsignedTransaction) *BulkSender { b.unsignedTxs = append(b.unsignedTxs, &tx) return b } +// PopulateTransactions fill missing fields and nonce for unsigned transactions in queue func (b *BulkSender) PopulateTransactions() error { defaultAccount, chainID, networkId, gasPrice, epochHeight, err := b.getChainInfos() if err != nil { @@ -180,11 +182,16 @@ func (b *BulkSender) getChainInfos() ( return defaultAccount, chainID, networkId, gasPrice, epochHeight, nil } +// Clear clear batch elems and errors in queue for new bulk call action func (b *BulkSender) Clear() { b.unsignedTxs = b.unsignedTxs[:0] } -func (b *BulkSender) SignAndSend() ([]*types.Hash, []error, error) { +// SignAndSend signs and sends all unsigned transactions in queue by rpc call "batch" on one request +// and returns the result of sending transactions. +// If there is any error on rpc "batch", it will be returned with batchErr not nil. +// If there is no error on rpc "batch", it will return the txHashes or txErrors of sending transactions. +func (b *BulkSender) SignAndSend() (txHashes []*types.Hash, txErrors []error, batchErr error) { rawTxs := make([][]byte, len(b.unsignedTxs)) for i, utx := range b.unsignedTxs { @@ -203,9 +210,9 @@ func (b *BulkSender) SignAndSend() ([]*types.Hash, []error, error) { hashes[i], errs[i] = bulkCaller.Cfx().SendRawTransaction(rawTx) } - err := bulkCaller.Execute() - if err != nil { - return nil, nil, errors.Wrapf(err, "failed to batch send transactions") + batchErr = bulkCaller.Execute() + if batchErr != nil { + return nil, nil, errors.Wrapf(batchErr, "failed to batch send transactions") } errorVals := make([]error, len(errs)) @@ -213,5 +220,5 @@ func (b *BulkSender) SignAndSend() ([]*types.Hash, []error, error) { errorVals[i] = *err } - return hashes, errorVals, err + return hashes, errorVals, batchErr } diff --git a/cfxclient/bulk/utils.go b/cfxclient/bulk/utils.go index 3ffd356..8e289f9 100644 --- a/cfxclient/bulk/utils.go +++ b/cfxclient/bulk/utils.go @@ -1,6 +1,10 @@ package bulk -import "github.com/Conflux-Chain/go-conflux-sdk/types" +import ( + "github.com/Conflux-Chain/go-conflux-sdk/rpc" + "github.com/Conflux-Chain/go-conflux-sdk/types" + "github.com/ethereum/go-ethereum/common/hexutil" +) func get1stEpochIfy(epoch []*types.Epoch) *types.Epoch { var realEpoch *types.Epoch @@ -9,3 +13,19 @@ func get1stEpochIfy(epoch []*types.Epoch) *types.Epoch { } return realEpoch } + +func get1stU64Ify(values []uint64) *hexutil.Uint64 { + if len(values) > 0 { + _value := hexutil.Uint64(values[0]) + return &_value + } + return nil +} + +func newBatchElem(result interface{}, method string, args ...interface{}) rpc.BatchElem { + return rpc.BatchElem{ + Method: method, + Result: &result, + Args: args, + } +} diff --git a/generate_doc.sh b/generate_doc.sh index 1ac5416..4edf548 100755 --- a/generate_doc.sh +++ b/generate_doc.sh @@ -6,8 +6,9 @@ mv ./interface_mock.go ./interface_mock.go.tmd godocdown -o client.md cd ./utils && godocdown -o ../utils.md && cd .. cd ./contract_meta/internal_contract && godocdown -o ../../internal_contract.md && cd ../.. +cd ./cfxclient/bulk && godocdown -o ../../cfxclient.md && cd ../.. -cat client.md utils.md internal_contract.md > tmp.md +cat client.md utils.md internal_contract.md cfxclient.md > tmp.md mv ./interface.go.tmd ./interface.go mv ./interface_mock.go.tmd ./interface_mock.go diff --git a/go.mod b/go.mod index 7dff948..14febc8 100644 --- a/go.mod +++ b/go.mod @@ -9,11 +9,12 @@ require ( github.com/deckarep/golang-set v0.0.0-20180603214616-504e848d77ea github.com/ethereum/go-ethereum v1.9.25 github.com/fatih/color v1.3.0 - github.com/golang/mock v1.6.0 github.com/gorilla/websocket v1.4.1-0.20190629185528-ae1634f6a989 github.com/pkg/errors v0.9.1 github.com/smartystreets/goconvey v1.6.4 github.com/valyala/fasthttp v1.13.1 + golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect + golang.org/x/sys v0.0.0-20210510120138-977fb7262007 // indirect gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce ) diff --git a/go.sum b/go.sum index 67b930f..5ad99a3 100644 --- a/go.sum +++ b/go.sum @@ -75,8 +75,6 @@ github.com/go-sourcemap/sourcemap v2.1.2+incompatible/go.mod h1:F8jJfvm2KbVjc5Nq github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= -github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= @@ -206,7 +204,6 @@ github.com/valyala/fasthttp v1.13.1/go.mod h1:ol1PCaL0dX20wC0htZ7sYCsvCYmrouYra0 github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a/go.mod h1:v3UYOV9WzVtRmSR+PDvWpU/qWl4Wa5LApYYX4ZtKbio= github.com/wsddn/go-ecdh v0.0.0-20161211032359-48726bab9208 h1:1cngl9mPEoITZG8s8cVcUy5CeIBYhEESkOB7m6Gmkrk= github.com/wsddn/go-ecdh v0.0.0-20161211032359-48726bab9208/go.mod h1:IotVbo4F+mw0EzQ08zFqg7pK3FebNXpaMsRy2RT+Ees= -github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190909091759-094676da4a83/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= @@ -221,7 +218,6 @@ golang.org/x/mobile v0.0.0-20200801112145-973feb4309de/go.mod h1:skQtrUTUwhdJvXM golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.1.1-0.20191209134235-331c550502dd/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181011144130-49bb7cea24b1/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= @@ -236,7 +232,6 @@ golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96b golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -263,7 +258,6 @@ golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3 golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200117012304-6edc0a871e69/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/tools/bulk_generator.js b/tools/bulk_generator.js index 92e62b3..88b0531 100644 --- a/tools/bulk_generator.js +++ b/tools/bulk_generator.js @@ -20,14 +20,18 @@ function genBulkFile(filePath, clientName, missingFuncs) { "github.com/Conflux-Chain/go-conflux-sdk/rpc" "github.com/Conflux-Chain/go-conflux-sdk/types" "github.com/ethereum/go-ethereum/common/hexutil" + postypes "github.com/Conflux-Chain/go-conflux-sdk/types/pos" ) + // ${bulkStrctName} used for bulk call rpc in one request to imporve efficiency type ${bulkStrctName} BulkCallerCore + // New${bulkStrctName} creates new ${bulkStrctName} instance func New${bulkStrctName}(core BulkCallerCore) *${bulkStrctName} { return (*${bulkStrctName})(&core) } + // Execute sends all rpc requests in queue by rpc call "batch" on one request func (b *${bulkStrctName}) Execute() ([]error, error) { return batchCall(b.caller, b.batchElems, nil) }\n\n` @@ -42,11 +46,11 @@ function genBulkFile(filePath, clientName, missingFuncs) { */ function genBulkFuncs(func) { let any = "[\\s\\S]" - let reg = new RegExp(`func \\(client \\*(Rpc.*Client)\\)` + // func (client *RpcCfxClient) <<<>>> Group1:StructName ---> RpcCfxClient + let reg = new RegExp(`func \\(.* \\*(Rpc.*Client)\\)` + // func (client *RpcCfxClient) <<<>>> Group1:StructName ---> RpcCfxClient `(${any}*\\)).* ` + // Group2:Function Sign ---> GetNextNonce(address types.Address, epoch ...*types.Epoch) `\\(.*? (.*?),.*?\\)` + `.*?\\{` + // (nonce *hexutil.Big, err error) { <<<>>> Group3:ReturnType ---> *hexutil.Big `(${any}*?)err` + // realEpoch := get1stEpochIfy(epoch)\nerr <<<>>> Group4:Pre-Call ---> realEpoch := get1stEpochIfy(epoch) - `.*?wrappedCallRPC\\(${any}*?,` + // = client.core.wrappedCallRPC(&nonce, + `.*?CallRPC\\(${any}*?,` + // = client.core.wrappedCallRPC(&nonce, `(${any}*)\\)\n` + // "cfx_getNextNonce", address, realEpoch) <<<>>> Group5:RpcElements ---> "cfx_getNextNonce", address, realEpoch `(${any}*?)` + // Group6:Post-Call `return${any}*?` + // result @@ -120,12 +124,17 @@ function genInitResult(returnType) { *client.batchElems = append(*client.batchElems, newBatchElem(result, "cfx_getStatus")) return result }`] - const root = "/Users/wangdayong/myspace/mytemp/go-conflux-sdk" + // Note: Use 2.x branch files to generate bulk functions + let root = "/Users/wangdayong/myspace/mytemp/go-conflux-sdk" const BulkCfxCaller = genBulkFile(`${root}/cfxclient/rpc_cfx.go`, "RpcCfxClient", cfxMissingFuncs) fs.writeFileSync("../cfxclient/bulk/bulk_caller_cfx.go", BulkCfxCaller) const BulkDebugCaller = genBulkFile(`${root}/cfxclient/rpc_debug.go`, "RpcDebugClient") fs.writeFileSync("../cfxclient/bulk/bulk_caller_debug.go", BulkDebugCaller) const BulkTraceCaller = genBulkFile(`${root}/cfxclient/rpc_trace.go`, "RpcTraceClient") fs.writeFileSync("../cfxclient/bulk/bulk_caller_trace.go", BulkTraceCaller) + + root = "/Users/wangdayong/myspace/mywork/go-conflux-sdk" + const BulkPosCaller = genBulkFile(`${root}/client_pos.go`, "RpcPosClient") + fs.writeFileSync("../cfxclient/bulk/bulk_caller_pos.go", BulkPosCaller) })() From e0f996b5c3f21d59c17cdf5dcc5b9a934c29d46a Mon Sep 17 00:00:00 2001 From: dayong Date: Tue, 9 Nov 2021 17:03:43 +0800 Subject: [PATCH 2/4] update change log --- README.md | 2 +- changeLog.md | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 68c70f6..ccf8446 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,7 @@ To send multiple transactions at a time, you can unlock the account at first, th ## Batch Query Information and Send Transaction When we need query many informations or send many transactions, we may need send many requests to rpc server and it may cause request limitation and low efficiency. So we provided batch methods for you to send batch request at a time to avoid this case and imporve efficiency. -Please see example from [go-conflux-sdk-examples/example_bulk](https://github.com/conflux-fans/go-conflux-sdk-examples/tree/main/example_bulk) +Please see example from [example_bulk](https://github.com/conflux-fans/go-conflux-sdk-examples/tree/main/example_bulk) ### Batch query information 1. New `BulkCaller` 2. `BulkCaller.Cfx().XXX` *(XXX means rpc methods)* to append request, and the returned result and error are pointer for saving results after requests be sent. diff --git a/changeLog.md b/changeLog.md index dc12eac..24e3a37 100644 --- a/changeLog.md +++ b/changeLog.md @@ -1,4 +1,6 @@ # Go-conflux-sdk Change Log +## v1.0.15 +- Add bulk caller and bulk sender for send batch rpc requests by one request, see example from [example_bulk](https://github.com/conflux-fans/go-conflux-sdk-examples/tree/main/example_bulk) ## v1.0.14 - Add POS RPC ## v1.0.13 From dd47125217af9305723232928d6bd3e7245d4d95 Mon Sep 17 00:00:00 2001 From: dayong Date: Tue, 9 Nov 2021 18:12:01 +0800 Subject: [PATCH 3/4] fix typo --- README.md | 56 ++++++++++++++--------------- api.md | 12 +++---- cfxclient/api.md | 0 cfxclient/bulk/bulk_caller.go | 2 +- cfxclient/bulk/bulk_caller_cfx.go | 2 +- cfxclient/bulk/bulk_caller_debug.go | 2 +- cfxclient/bulk/bulk_caller_pos.go | 2 +- cfxclient/bulk/bulk_caller_trace.go | 2 +- cfxclient/bulk/bulk_sender.go | 2 +- changeLog.md | 18 +++++----- tools/bulk_generator.js | 2 +- 11 files changed, 49 insertions(+), 51 deletions(-) delete mode 100644 cfxclient/api.md diff --git a/README.md b/README.md index ccf8446..76a41e1 100644 --- a/README.md +++ b/README.md @@ -4,13 +4,13 @@ # 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. +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, users 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. +You can also add the Conflux Golang API into the vendor folder. ``` govendor fetch github.com/Conflux-Chain/go-conflux-sdk ``` @@ -20,10 +20,8 @@ govendor fetch github.com/Conflux-Chain/go-conflux-sdk - [API document](https://github.com/Conflux-Chain/go-conflux-sdk/blob/master/api.md) - [Examples](https://github.com/conflux-fans/go-conflux-sdk-examples) - - ## Manage Accounts -Use `AccountManager` struct to manage accounts at local machine. +Use `AccountManager` struct to manage accounts at the local machine. - Create/Import/Update/Delete an account. - List all accounts. - Unlock/Lock an account. @@ -59,65 +57,65 @@ func main() { ``` ## 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: +To send a transaction, you need to sign the transaction at a local machine and send the signed transaction to a local or remote Conflux node. +- Sign a transaction with an unlocked account: `AccountManager.SignTransaction(tx UnsignedTransaction)` -- Sign a transaction with passphrase for locked account: +- Sign a transaction with the passphrase for the locked account: `AccountManager.SignTransactionWithPassphrase(tx UnsignedTransaction, passphrase string)` -- Send a unsigned transaction +- Send an unsigned transaction `Client.SendTransaction(tx types.UnsignedTransaction)` -- Send a encoded transaction +- Send an encoded transaction `Client.SendRawTransaction(rawData []byte)` -- Encode a encoded unsigned transaction with signature and send transaction +- Encode an encoded unsigned transaction with a signature and send the 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. +To send multiple transactions at a time, you can unlock the account at first, then send multiple transactions without the passphrase. To send a single transaction, you can just only send the transaction with the passphrase. ## Batch Query Information and Send Transaction -When we need query many informations or send many transactions, we may need send many requests to rpc server and it may cause request limitation and low efficiency. So we provided batch methods for you to send batch request at a time to avoid this case and imporve efficiency. +When we need to query many pieces of information or send many transactions, we may need to send many requests to the RPC server, and it may cause request limitation and low efficiency. So we provided batch methods for you to send a batch request at one time to avoid this case and improve efficiency. Please see example from [example_bulk](https://github.com/conflux-fans/go-conflux-sdk-examples/tree/main/example_bulk) ### Batch query information 1. New `BulkCaller` -2. `BulkCaller.Cfx().XXX` *(XXX means rpc methods)* to append request, and the returned result and error are pointer for saving results after requests be sent. - > Besides `Cfx`, there also `Debug`, `Trace`, `Pos` methods for acquire rpc methods for corresponding namespace +2. `BulkCaller.Cfx().XXX` *(XXX means RPC methods)* to append request, and the returned result and error are pointers for saving results after requests are sent. + > Besides `Cfx`, there are also `Debug`, `Trace`, `Pos` methods for acquiring RPC methods for the corresponding namespace 3. `BulkCaller.Execute` to send requests. 4. The result and error pointer of step 2 are filled by request results 5. `BulkCaller.Clear` to clear request cache for new bulk call action. ### Batch call contract -1. Use abigen to generate contract binding +1. Use [`abigen`](https://github.com/Conflux-Chain/conflux-abigen) to generate contract binding 2. There is a struct called `XXXBulkCaller` *(XXX means your contract name)* for bulk call contract methods -3. `XXXBulkCaller.YourContractMethod` to append request to it's first parameter which is bulkSender instance, and the returned result and error are pointer for saving results after requests be sent. +3. `XXXBulkCaller.YourContractMethod` to append request to its first parameter which is BulkSender instance, and the returned result and error arepointersr for saving results after requests be sent. 4. Same as step 4 of [`Batch query information`]() -It's ok to bulk call normal rpc methods and contract call. +It's ok to batch call normal RPC methods and contract calls by BulkCaller. ### Batch send transaction 1. New `BulkSender` -2. `BulkSender.AppendTransaction` to append unsigned transaction -3. `BulkSender.SignAndSend` to send requests. The transaction hashes and errors will be returned. All of them are slice with same length of step 2. +2. `BulkSender.AppendTransaction` to append an unsigned transaction +3. `BulkSender.SignAndSend` to send requests. The transaction hashes and errors will be returned. All of them are slice with the same length of appended transactions. 4. `BulkSender.Clear` to clear request cache for new bulk send action. ### Batch send contract transaction -1. Use abigen to generate contract binding +1. Use [`abigen`](https://github.com/Conflux-Chain/conflux-abigen) to generate contract binding 2. There is a struct called `XXXBulkTransactor` *(XXX means your contract name)* for bulk send contract transactions 3. Same as step 3 of [`Batch send transaction`]() ## Deploy/Invoke Smart Contract -**The simpiest and recommend way is to use [conflux-abigen](https://github.com/Conflux-Chain/conflux-abigen) to generate contract binding to deploy and invoke with contract** +**The simplest and recommended way is to use [conflux-abigen](https://github.com/Conflux-Chain/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](https://github.com/Conflux-Chain/go-conflux-sdk/blob/master/api.md) for detail. +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 the contract, there are GetData/Call/SendTransaction. Please see [api document](https://github.com/Conflux-Chain/go-conflux-sdk/blob/master/api.md) for detail. ### Contract Example ***[Depreated]*** Please reference [contract example]((https://github.com/Conflux-Chain/go-conflux-sdk/blob/master/example/example_contract)) for all source code @@ -204,22 +202,22 @@ func main() { 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. +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 occurs. 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 +## 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`. +Client applies the 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. ```golang client.UseCallRpcMiddleware(middleware.CallRpcConsoleMiddleware) ``` -Also you could +Also, you could - customize middleware -- use multiple middleware +- use multiple middlewares -Notice that the middleware chain exectuion order is like onion, for example, use middleware A first and then middleware B +Notice that the middleware chain execution order is like onion, for example, use middleware A first and then middleware B ```go client.UseCallRpcMiddleware(A) client.UseCallRpcMiddleware(B) diff --git a/api.md b/api.md index 33d12b3..e774894 100644 --- a/api.md +++ b/api.md @@ -1270,7 +1270,7 @@ type BulkCaller struct { } ``` -BulkCaller used for bulk call rpc in one request to imporve efficiency +BulkCaller used for bulk call rpc in one request to improve efficiency #### func NewBulkerCaller @@ -1352,7 +1352,7 @@ func NewBulkCallerCore(rpcCaller sdk.ClientOperator) BulkCallerCore type BulkCfxCaller BulkCallerCore ``` -BulkCfxCaller used for bulk call rpc in one request to imporve efficiency +BulkCfxCaller used for bulk call rpc in one request to improve efficiency #### func NewBulkCfxCaller @@ -1687,7 +1687,7 @@ func (client *BulkCustomCaller) ContractCall(request types.CallRequest, type BulkDebugCaller BulkCallerCore ``` -BulkDebugCaller used for bulk call rpc in one request to imporve efficiency +BulkDebugCaller used for bulk call rpc in one request to improve efficiency #### func NewBulkDebugCaller @@ -1721,7 +1721,7 @@ func (client *BulkDebugCaller) GetEpochReceiptsByPivotBlockHash(hash types.Hash) type BulkPosCaller BulkCallerCore ``` -BulkPosCaller used for bulk call rpc in one request to imporve efficiency +BulkPosCaller used for bulk call rpc in one request to improve efficiency #### func NewBulkPosCaller @@ -1792,7 +1792,7 @@ type BulkSender struct { } ``` -BulkSender used for bulk send unsigned tranactions in one request to imporve +BulkSender used for bulk send unsigned tranactions in one request to improve efficiency, it will auto populate missing fields and nonce of unsigned transactions in queue before send. @@ -1842,7 +1842,7 @@ transactions. type BulkTraceCaller BulkCallerCore ``` -BulkTraceCaller used for bulk call rpc in one request to imporve efficiency +BulkTraceCaller used for bulk call rpc in one request to improve efficiency #### func NewBulkTraceCaller diff --git a/cfxclient/api.md b/cfxclient/api.md deleted file mode 100644 index e69de29..0000000 diff --git a/cfxclient/bulk/bulk_caller.go b/cfxclient/bulk/bulk_caller.go index c4ecb4a..8c155d6 100644 --- a/cfxclient/bulk/bulk_caller.go +++ b/cfxclient/bulk/bulk_caller.go @@ -31,7 +31,7 @@ func (b *BulkCallerCore) appendElemsAndError(elem rpc.BatchElem, err *error) { *b.errors = append(*b.errors, err) } -// BulkCaller used for bulk call rpc in one request to imporve efficiency +// BulkCaller used for bulk call rpc in one request to improve efficiency type BulkCaller struct { BulkCallerCore diff --git a/cfxclient/bulk/bulk_caller_cfx.go b/cfxclient/bulk/bulk_caller_cfx.go index 6586491..a6d1772 100644 --- a/cfxclient/bulk/bulk_caller_cfx.go +++ b/cfxclient/bulk/bulk_caller_cfx.go @@ -6,7 +6,7 @@ import ( "github.com/ethereum/go-ethereum/common/hexutil" ) -// BulkCfxCaller used for bulk call rpc in one request to imporve efficiency +// BulkCfxCaller used for bulk call rpc in one request to improve efficiency type BulkCfxCaller BulkCallerCore // NewBulkCfxCaller creates new BulkCfxCaller instance diff --git a/cfxclient/bulk/bulk_caller_debug.go b/cfxclient/bulk/bulk_caller_debug.go index 9125295..aea655a 100644 --- a/cfxclient/bulk/bulk_caller_debug.go +++ b/cfxclient/bulk/bulk_caller_debug.go @@ -7,7 +7,7 @@ import ( "github.com/Conflux-Chain/go-conflux-sdk/types" ) -// BulkDebugCaller used for bulk call rpc in one request to imporve efficiency +// BulkDebugCaller used for bulk call rpc in one request to improve efficiency type BulkDebugCaller BulkCallerCore // NewBulkDebugCaller creates new BulkDebugCaller instance diff --git a/cfxclient/bulk/bulk_caller_pos.go b/cfxclient/bulk/bulk_caller_pos.go index f6da687..bc7ee2c 100644 --- a/cfxclient/bulk/bulk_caller_pos.go +++ b/cfxclient/bulk/bulk_caller_pos.go @@ -7,7 +7,7 @@ import ( "github.com/ethereum/go-ethereum/common/hexutil" ) -// BulkPosCaller used for bulk call rpc in one request to imporve efficiency +// BulkPosCaller used for bulk call rpc in one request to improve efficiency type BulkPosCaller BulkCallerCore // NewBulkPosCaller creates new BulkPosCaller instance diff --git a/cfxclient/bulk/bulk_caller_trace.go b/cfxclient/bulk/bulk_caller_trace.go index a9cb9e8..205a9bc 100644 --- a/cfxclient/bulk/bulk_caller_trace.go +++ b/cfxclient/bulk/bulk_caller_trace.go @@ -5,7 +5,7 @@ import ( "github.com/Conflux-Chain/go-conflux-sdk/types" ) -// BulkTraceCaller used for bulk call rpc in one request to imporve efficiency +// BulkTraceCaller used for bulk call rpc in one request to improve efficiency type BulkTraceCaller BulkCallerCore // NewBulkTraceCaller creates new BulkTraceCaller instance diff --git a/cfxclient/bulk/bulk_sender.go b/cfxclient/bulk/bulk_sender.go index 21e8240..ba685b0 100644 --- a/cfxclient/bulk/bulk_sender.go +++ b/cfxclient/bulk/bulk_sender.go @@ -11,7 +11,7 @@ import ( "github.com/pkg/errors" ) -// BulkSender used for bulk send unsigned tranactions in one request to imporve efficiency, +// BulkSender used for bulk send unsigned tranactions in one request to improve efficiency, // it will auto populate missing fields and nonce of unsigned transactions in queue before send. type BulkSender struct { signalbeCaller sdk.ClientOperator diff --git a/changeLog.md b/changeLog.md index 24e3a37..fc1e2f6 100644 --- a/changeLog.md +++ b/changeLog.md @@ -1,6 +1,6 @@ # Go-conflux-sdk Change Log ## v1.0.15 -- Add bulk caller and bulk sender for send batch rpc requests by one request, see example from [example_bulk](https://github.com/conflux-fans/go-conflux-sdk-examples/tree/main/example_bulk) +- Add bulk caller and bulk sender for sending batch RPC requests by one request, see the example from [example_bulk](https://github.com/conflux-fans/go-conflux-sdk-examples/tree/main/example_bulk) ## v1.0.14 - Add POS RPC ## v1.0.13 @@ -10,26 +10,26 @@ ## v1.0.11 - Add `blockNumber` to block related methods `cfx_getBlockByHash`, `cfx_getBlockByEpochNumber`, `cfx_getBlockByHashWithPivotAssumption` which need `Conflux-rust v1.1.5` or above. - Add new RPC method `cfx_getBlockByBlockNumber` -- Refactor SubscribeLogs for avoiding lossing timing sequence of Chain-Reorg and Log +- Refactor SubscribeLogs for avoiding losing the timing sequence of Chain-Reorg and Log - Add variadic arguments support for rpc service ## v1.0.10 -- Set default rpc request timeout to 30s +- Set default RPC request timeout to 30s - Remove addition error msg in wrappedCallRPC - Add method GetAccountPendingTransactions in client ## v1.0.9 -- Apply middleware for hooking call rpc and batch call rpc -- Support set request rpc timeout in Client +- Apply middleware for hooking call RPC and batch call RPC +- Support set request RPC timeout in Client ## v1.0.0 -Note: v1.0.0 is not impatable with v0.x, the changes are +Note: v1.0.0 is not incompatible with v0.x, the changes are - Change address format follow [CIP-37](https://github.com/Conflux-Chain/CIPs/blob/master/CIPs/cip-37.md) - Unmarshal logfilter according to full node struct -- RPC functions follow rule: input and output to be value or pointer according to whether it could be nil +- RPC functions follow the rule: input and output to be value or pointer according to whether it could be nil ## v0.4.11 - Fix bug ## v0.4.10 -- Support rpc block_trace -- Fix amount of TIME_WAIT when concurrency request +- Support RPC block_trace +- Fix the amount of TIME_WAIT when concurrency request ## v0.4.9 - Support sdk.Client.GetSupplyInfo diff --git a/tools/bulk_generator.js b/tools/bulk_generator.js index 88b0531..0b59256 100644 --- a/tools/bulk_generator.js +++ b/tools/bulk_generator.js @@ -23,7 +23,7 @@ function genBulkFile(filePath, clientName, missingFuncs) { postypes "github.com/Conflux-Chain/go-conflux-sdk/types/pos" ) - // ${bulkStrctName} used for bulk call rpc in one request to imporve efficiency + // ${bulkStrctName} used for bulk call rpc in one request to improve efficiency type ${bulkStrctName} BulkCallerCore // New${bulkStrctName} creates new ${bulkStrctName} instance From 5eb1ba7c03f8341012111b4176d8a64e4090ef84 Mon Sep 17 00:00:00 2001 From: dayong Date: Tue, 9 Nov 2021 18:27:30 +0800 Subject: [PATCH 4/4] update changelog --- changeLog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/changeLog.md b/changeLog.md index fc1e2f6..e199ca5 100644 --- a/changeLog.md +++ b/changeLog.md @@ -1,6 +1,7 @@ # Go-conflux-sdk Change Log ## v1.0.15 - Add bulk caller and bulk sender for sending batch RPC requests by one request, see the example from [example_bulk](https://github.com/conflux-fans/go-conflux-sdk-examples/tree/main/example_bulk) +- Move example to independent repo [go-conflux-sdk-example](https://github.com/conflux-fans/go-conflux-sdk-examples) ## v1.0.14 - Add POS RPC ## v1.0.13