Documentation ¶
Index ¶
- func CallMethod(ctx context.Context, rpc RPCClient, signer TXSigner, from, addr string, ...) (map[string]interface{}, error)
- func CobraInitRPC(cmd *cobra.Command, rconf *RPCConf)
- func GetOrionPrivacyGroup(ctx context.Context, rpc RPCClient, addr *common.Address, privateFrom string, ...) (string, error)
- func GetOrionTXCount(ctx context.Context, rpc RPCClient, addr *common.Address, privacyGroup string) (int64, error)
- func GetSolc(requestedVersion string) (*compiler.Solidity, error)
- func GetSolcArgs(evmVersion string) []string
- func GetTransactionCount(ctx context.Context, rpc RPCClient, addr *common.Address, blockNumber string) (int64, error)
- func ProcessRLPBytes(args abi.Arguments, retBytes []byte) map[string]interface{}
- type CompiledSolidity
- type MockRPCClient
- type MockRPCSubscription
- type OrionPrivacyGroup
- type RPCClient
- type RPCClientAll
- type RPCClientAsync
- type RPCClientSubscription
- type RPCClosable
- type RPCConf
- type RPCConnOpts
- type SendTXArgs
- type TXSigner
- type Txn
- type TxnReceipt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CallMethod ¶
func CallMethod(ctx context.Context, rpc RPCClient, signer TXSigner, from, addr string, value json.Number, methodABI *maidenlanedbind.ABIMethod, msgParams []interface{}, blocknumber string) (map[string]interface{}, error)
CallMethod performs eth_call to return data from the chain
func CobraInitRPC ¶
CobraInitRPC sets the standard command-line parameters for RPC
func GetOrionPrivacyGroup ¶
func GetOrionPrivacyGroup(ctx context.Context, rpc RPCClient, addr *common.Address, privateFrom string, privateFor []string) (string, error)
GetOrionPrivacyGroup resolves privateFrom/privateFor into a privacyGroupID
func GetOrionTXCount ¶
func GetOrionTXCount(ctx context.Context, rpc RPCClient, addr *common.Address, privacyGroup string) (int64, error)
GetOrionTXCount uses the special Pantheon/Orion interface to check the next nonce for the privacy group associated with the privateFrom/privateFor combination
func GetSolc ¶
GetSolc returns the appropriate solc command based on the combination of env vars, and message-specific request parameters passed in
func GetSolcArgs ¶
GetSolcArgs get the correct solc args
Types ¶
type CompiledSolidity ¶
type CompiledSolidity struct { ContractName string Compiled []byte DevDoc string ABI maidenlanedbind.ABIMarshaling ContractInfo *compiler.ContractInfo }
CompiledSolidity wraps solc compilation of solidity and ABI generation
func CompileContract ¶
func CompileContract(soliditySource, contractName, requestedVersion, evmVersion string) (*CompiledSolidity, error)
CompileContract uses solc to compile the Solidity source and
func ProcessCompiled ¶
func ProcessCompiled(compiled map[string]*compiler.Contract, contractName string, isStdin bool) (*CompiledSolidity, error)
ProcessCompiled takes solc output and packs it into our CompiledSolidity structure
type MockRPCClient ¶
type MockRPCClient struct { // Captured results SubscribeErr error SubResult *MockRPCSubscription MethodCapture string ArgsCapture []interface{} Closed bool // contains filtered or unexported fields }
MockRPCClient implements RPCClientAll
func NewMockRPCClientForAsync ¶
func NewMockRPCClientForAsync(subscribeErr error) *MockRPCClient
NewMockRPCClientForAsync contructs a mock client for async testing
func NewMockRPCClientForSync ¶
func NewMockRPCClientForSync(callErr error, resultWranger func(string, interface{}, ...interface{})) *MockRPCClient
NewMockRPCClientForSync contructs a mock client for sync testing
func (*MockRPCClient) CallContext ¶
func (m *MockRPCClient) CallContext(ctx context.Context, result interface{}, method string, args ...interface{}) error
CallContext invokes the supplied result wranger, and captures the args
func (*MockRPCClient) Close ¶
func (m *MockRPCClient) Close()
Close captures the fact close was called
func (*MockRPCClient) Subscribe ¶
func (m *MockRPCClient) Subscribe(ctx context.Context, namespace string, channel interface{}, args ...interface{}) (RPCClientSubscription, error)
Subscribe returns the subscription already configured in the mock
type MockRPCSubscription ¶
type MockRPCSubscription struct { Namespace string Args []interface{} ErrChan chan error MsgChan chan<- interface{} Subscribed bool }
MockRPCSubscription allows convenient subscription mocking in other packages
func (*MockRPCSubscription) Err ¶
func (ms *MockRPCSubscription) Err() <-chan error
Err returns the configured mock error channel
func (*MockRPCSubscription) Unsubscribe ¶
func (ms *MockRPCSubscription) Unsubscribe()
Unsubscribe captures the unsubscribe call
type OrionPrivacyGroup ¶
type OrionPrivacyGroup struct {
PrivacyGroupID string `json:"privacyGroupId"`
}
OrionPrivacyGroup is the result of the priv_findPrivacyGroup call
type RPCClient ¶
type RPCClient interface {
CallContext(ctx context.Context, result interface{}, method string, args ...interface{}) error
}
RPCClient refers to the functions from the ethereum RPC client that we use
type RPCClientAll ¶
type RPCClientAll interface { RPCClosable RPCClient RPCClientAsync }
RPCClientAll has both sync and async interfaces (splitting out helps callers with limiting their mocks)
func RPCConnect ¶
func RPCConnect(conf *RPCConnOpts) (RPCClientAll, error)
RPCConnect wraps rpc.Dial with useful logging, avoiding logging username/password
type RPCClientAsync ¶
type RPCClientAsync interface {
Subscribe(ctx context.Context, namespace string, channel interface{}, args ...interface{}) (RPCClientSubscription, error)
}
RPCClientAsync refers to the async functions from the ethereum RPC client that we use
type RPCClientSubscription ¶
type RPCClientSubscription interface { Unsubscribe() Err() <-chan error }
RPCClientSubscription local alias type for ClientSubscription
type RPCConf ¶
type RPCConf struct {
RPC RPCConnOpts `json:"rpc"`
}
RPCConf is the standard snippet to include in YAML config for RPC
type RPCConnOpts ¶
type RPCConnOpts struct {
URL string `json:"url"`
}
RPCConnOpts configuration params
type SendTXArgs ¶
type SendTXArgs struct { Nonce *hexutil.Uint64 `json:"nonce,omitempty"` From string `json:"from"` To string `json:"to,omitempty"` Gas *hexutil.Uint64 `json:"gas,omitempty"` GasPrice hexutil.Big `json:"gasPrice,omitempty"` Value hexutil.Big `json:"value,omitempty"` Data *hexutil.Bytes `json:"data"` // EEA spec extensions PrivateFrom string `json:"privateFrom,omitempty"` PrivateFor []string `json:"privateFor,omitempty"` PrivacyGroupID string `json:"privacyGroupId,omitempty"` Restriction string `json:"restriction,omitempty"` }
SendTXArgs is the JSON arguments that can be passed to an eth_sendTransaction call, and also the interface passed to the signer in the case of pre-signing
type TXSigner ¶
type TXSigner interface { Type() string Address() string Sign(tx *types.Transaction) ([]byte, error) }
TXSigner is an interface for pre-signing signing using the parameters of eth_sendTransaction
type Txn ¶
type Txn struct { NodeAssignNonce bool OrionPrivateAPIS bool From common.Address EthTX *types.Transaction Hash string Receipt TxnReceipt PrivateFrom string PrivateFor []string PrivacyGroupID string Signer TXSigner }
Txn wraps an ethereum transaction, along with the logic to send it over JSON/RPC to a node
func NewContractDeployTxn ¶
func NewContractDeployTxn(msg *maidenlanedmessages.DeployContract, signer TXSigner) (tx *Txn, err error)
NewContractDeployTxn builds a new ethereum transaction from the supplied SendTranasction message
func NewSendTxn ¶
func NewSendTxn(msg *maidenlanedmessages.SendTransaction, signer TXSigner) (tx *Txn, err error)
NewSendTxn builds a new ethereum transaction from the supplied SendTranasction message
func (*Txn) Call ¶
Call synchronously calls the method, without mining a transaction, and returns the result as RLP encoded bytes or nil
func (*Txn) GetTXReceipt ¶
GetTXReceipt gets the receipt for the transaction
type TxnReceipt ¶
type TxnReceipt struct { BlockHash *common.Hash `json:"blockHash"` BlockNumber *hexutil.Big `json:"blockNumber"` ContractAddress *common.Address `json:"contractAddress"` CumulativeGasUsed *hexutil.Big `json:"cumulativeGasUsed"` TransactionHash *common.Hash `json:"transactionHash"` From *common.Address `json:"from"` GasUsed *hexutil.Big `json:"gasUsed"` Status *hexutil.Big `json:"status"` To *common.Address `json:"to"` TransactionIndex *hexutil.Uint `json:"transactionIndex"` }
TxnReceipt is the receipt obtained over JSON/RPC from the ethereum client