Documentation ¶
Overview ¶
Package client provides a client for the Klaytn RPC API.
Index ¶
- type BridgeJournal
- type Client
- func (ec *Client) AddPeer(ctx context.Context, url string) (bool, error)
- func (ec *Client) BalanceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (*big.Int, error)
- func (ec *Client) BlockByHash(ctx context.Context, hash common.Hash) (*types.Block, error)
- func (ec *Client) BlockByNumber(ctx context.Context, number *big.Int) (*types.Block, error)
- func (ec *Client) BlockNumber(ctx context.Context) (*big.Int, error)
- func (ec *Client) BridgeAddPeerOnBridge(ctx context.Context, url string) (bool, error)
- func (ec *Client) BridgeConvertChildChainBlockHashToParentChainTxHash(ctx context.Context, scBlockHash common.Hash) (common.Hash, error)
- func (ec *Client) BridgeConvertRequestTxHashToHandleTxHash(ctx context.Context, requestTxHash common.Hash) (common.Hash, error)
- func (ec *Client) BridgeDeployBridge(ctx context.Context) (common.Address, common.Address, error)
- func (ec *Client) BridgeDeregisterBridge(ctx context.Context, cBridge common.Address, pBridge common.Address) error
- func (ec *Client) BridgeDeregisterTokenContract(ctx context.Context, cBridge, pBridge, cToken, pToken common.Address) error
- func (ec *Client) BridgeDisableAnchoring(ctx context.Context) (bool, error)
- func (ec *Client) BridgeEnableAnchoring(ctx context.Context) (bool, error)
- func (ec *Client) BridgeGetAnchoringPeriod(ctx context.Context) (uint64, error)
- func (ec *Client) BridgeGetChildChainIndexingEnabled(ctx context.Context) (bool, error)
- func (ec *Client) BridgeGetChildOperatorAddr(ctx context.Context) (common.Address, error)
- func (ec *Client) BridgeGetChildOperatorNonce(ctx context.Context) (uint64, error)
- func (ec *Client) BridgeGetERC20Fee(ctx context.Context, bridgeAddr, tokenAddr common.Address) (*big.Int, error)
- func (ec *Client) BridgeGetFeeReceiver(ctx context.Context, bridgeAddr common.Address) (common.Address, error)
- func (ec *Client) BridgeGetKLAYFee(ctx context.Context, bridgeAddr common.Address) (*big.Int, error)
- func (ec *Client) BridgeGetLatestAnchoredBlockNumber(ctx context.Context) (uint64, error)
- func (ec *Client) BridgeGetParentOperatorAddr(ctx context.Context) (common.Address, error)
- func (ec *Client) BridgeGetParentOperatorNonce(ctx context.Context) (uint64, error)
- func (ec *Client) BridgeGetReceiptFromParentChain(ctx context.Context, hash common.Hash) (*types.Receipt, error)
- func (ec *Client) BridgeGetRegisteredOperators(ctx context.Context, bridge common.Address) ([]common.Address, error)
- func (ec *Client) BridgeGetSentChainTxsLimit(ctx context.Context) (uint64, error)
- func (ec *Client) BridgeGetTxPending(ctx context.Context) (map[common.Address]types.Transactions, error)
- func (ec *Client) BridgeGetValueTransferOperatorThreshold(ctx context.Context, bridge common.Address) (uint8, error)
- func (ec *Client) BridgeListBridge(ctx context.Context) ([]*BridgeJournal, error)
- func (ec *Client) BridgeNodeInfo(ctx context.Context) (*p2p.NodeInfo, error)
- func (ec *Client) BridgePeersOnBridge(ctx context.Context) ([]*p2p.PeerInfo, error)
- func (ec *Client) BridgeRegisterBridge(ctx context.Context, cBridge common.Address, pBridge common.Address) error
- func (ec *Client) BridgeRegisterOperator(ctx context.Context, bridge, operator common.Address) (common.Hash, error)
- func (ec *Client) BridgeRegisterTokenContract(ctx context.Context, cBridge, pBridge, cToken, pToken common.Address) error
- func (ec *Client) BridgeRemovePeerOnBridge(ctx context.Context, url string) (bool, error)
- func (ec *Client) BridgeSetERC20Fee(ctx context.Context, bridgeAddr, tokenAddr common.Address, fee *big.Int) (common.Hash, error)
- func (ec *Client) BridgeSetFeeReceiver(ctx context.Context, bridgeAddr, receiver common.Address) (common.Hash, error)
- func (ec *Client) BridgeSetKLAYFee(ctx context.Context, bridgeAddr common.Address, fee *big.Int) (common.Hash, error)
- func (ec *Client) BridgeSetValueTransferOperatorThreshold(ctx context.Context, bridge common.Address, threshold uint8) (common.Hash, error)
- func (ec *Client) BridgeSubscribeBridge(ctx context.Context, cBridge common.Address, pBridge common.Address) error
- func (ec *Client) BridgeTxPendingCount(ctx context.Context) (int, error)
- func (ec *Client) BridgeUnsubscribeBridge(ctx context.Context, cBridge common.Address, pBridge common.Address) error
- func (ec *Client) CallContract(ctx context.Context, msg klaytn.CallMsg, blockNumber *big.Int) ([]byte, error)
- func (ec *Client) ChainID(ctx context.Context) (*big.Int, error)
- func (ec *Client) Close()
- func (ec *Client) CodeAt(ctx context.Context, account common.Address, blockNumber *big.Int) ([]byte, error)
- func (ec *Client) CreateAccessList(ctx context.Context, msg klaytn.CallMsg) (*types.AccessList, uint64, string, error)
- func (ec *Client) EstimateGas(ctx context.Context, msg klaytn.CallMsg) (uint64, error)
- func (ec *Client) FilterLogs(ctx context.Context, q klaytn.FilterQuery) ([]types.Log, error)
- func (ec *Client) HeaderByHash(ctx context.Context, hash common.Hash) (*types.Header, error)
- func (ec *Client) HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error)
- func (ec *Client) ImportRawKey(ctx context.Context, key string, password string) (common.Address, error)
- func (ec *Client) MainBridgeNodeInfo(ctx context.Context) (*p2p.NodeInfo, error)
- func (ec *Client) MainBridgePeersOnBridge(ctx context.Context) ([]*p2p.PeerInfo, error)
- func (ec *Client) NetworkID(ctx context.Context) (*big.Int, error)
- func (ec *Client) NonceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (uint64, error)
- func (ec *Client) PendingBalanceAt(ctx context.Context, account common.Address) (*big.Int, error)
- func (ec *Client) PendingCallContract(ctx context.Context, msg klaytn.CallMsg) ([]byte, error)
- func (ec *Client) PendingCodeAt(ctx context.Context, account common.Address) ([]byte, error)
- func (ec *Client) PendingNonceAt(ctx context.Context, account common.Address) (uint64, error)
- func (ec *Client) PendingStorageAt(ctx context.Context, account common.Address, key common.Hash) ([]byte, error)
- func (ec *Client) PendingTransactionCount(ctx context.Context) (uint, error)
- func (ec *Client) RemovePeer(ctx context.Context, url string) (bool, error)
- func (ec *Client) SendRawTransaction(ctx context.Context, tx *types.Transaction) (common.Hash, error)
- func (ec *Client) SendTransaction(ctx context.Context, tx *types.Transaction) error
- func (ec *Client) SendUnsignedTransaction(ctx context.Context, from common.Address, to common.Address, gas uint64, ...) (common.Hash, error)
- func (ec *Client) SetHeader(key, value string)
- func (ec *Client) StorageAt(ctx context.Context, account common.Address, key common.Hash, ...) ([]byte, error)
- func (ec *Client) SubscribeFilterLogs(ctx context.Context, q klaytn.FilterQuery, ch chan<- types.Log) (klaytn.Subscription, error)
- func (ec *Client) SubscribeNewHead(ctx context.Context, ch chan<- *types.Header) (klaytn.Subscription, error)
- func (ec *Client) SuggestGasPrice(ctx context.Context) (*big.Int, error)
- func (ec *Client) SyncProgress(ctx context.Context) (*klaytn.SyncProgress, error)
- func (ec *Client) TransactionByHash(ctx context.Context, hash common.Hash) (tx *types.Transaction, isPending bool, err error)
- func (ec *Client) TransactionCount(ctx context.Context, blockHash common.Hash) (uint, error)
- func (ec *Client) TransactionInBlock(ctx context.Context, blockHash common.Hash, index uint) (*types.Transaction, error)
- func (ec *Client) TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)
- func (ec *Client) TransactionReceiptRpcOutput(ctx context.Context, txHash common.Hash) (r map[string]interface{}, err error)
- func (ec *Client) TransactionSender(ctx context.Context, tx *types.Transaction, block common.Hash, index uint) (common.Address, error)
- func (ec *Client) UnlockAccount(ctx context.Context, address common.Address, password string, time uint) (bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BridgeJournal ¶
type BridgeJournal struct { ChildAddress common.Address `json:"childAddress"` ParentAddress common.Address `json:"parentAddress"` Subscribed bool `json:"subscribed"` }
TODO-Klaytn if client pkg is removed in sc pkg, this will be replaced origin struct.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client defines typed wrappers for the Klaytn RPC API.
func (*Client) BalanceAt ¶
func (ec *Client) BalanceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (*big.Int, error)
BalanceAt returns the peb balance of the given account. The block number can be nil, in which case the balance is taken from the latest known block.
func (*Client) BlockByHash ¶
BlockByHash returns the given full block.
Note that loading full blocks requires two requests. Use HeaderByHash if you don't need all transactions.
func (*Client) BlockByNumber ¶
BlockByNumber returns a block from the current canonical chain. If number is nil, the latest known block is returned.
Note that loading full blocks requires two requests. Use HeaderByNumber if you don't need all transactions.
func (*Client) BlockNumber ¶
BlockNumber can get the latest block number.
func (*Client) BridgeAddPeerOnBridge ¶
BridgeAddPeerOnParentChain can add a static peer on bridge node for service chain.
func (*Client) BridgeConvertChildChainBlockHashToParentChainTxHash ¶ added in v1.1.1
func (ec *Client) BridgeConvertChildChainBlockHashToParentChainTxHash(ctx context.Context, scBlockHash common.Hash) (common.Hash, error)
BridgeConvertChildChainBlockHashToParentChainTxHash can convert child chain block hash to anchoring tx hash which contains anchored data.
func (*Client) BridgeConvertRequestTxHashToHandleTxHash ¶
func (ec *Client) BridgeConvertRequestTxHashToHandleTxHash(ctx context.Context, requestTxHash common.Hash) (common.Hash, error)
BridgeConvertRequestTxHashToHandleTxHash can convert a request value transfer tx hash to the corresponded handle value transfer tx hash.
func (*Client) BridgeDeployBridge ¶
BridgeDeployBridge can deploy the pair of bridge for parent/child chain.
func (*Client) BridgeDeregisterBridge ¶
func (ec *Client) BridgeDeregisterBridge(ctx context.Context, cBridge common.Address, pBridge common.Address) error
BridgeDeregisterBridge can deregister the given pair of deployed child/parent bridges.
func (*Client) BridgeDeregisterTokenContract ¶
func (ec *Client) BridgeDeregisterTokenContract(ctx context.Context, cBridge, pBridge, cToken, pToken common.Address) error
BridgeDeregisterTokenContract can deregister the given pair of deployed child/parent chain token contracts. If the registering is failed, it returns an error.
func (*Client) BridgeDisableAnchoring ¶
BridgeDisableAnchoring can disable anchoring function and return the set value.
func (*Client) BridgeEnableAnchoring ¶
BridgeEnableAnchoring can enable anchoring function and return the set value.
func (*Client) BridgeGetAnchoringPeriod ¶
BridgeGetAnchoringPeriod can get the block period to anchor chain data.
func (*Client) BridgeGetChildChainIndexingEnabled ¶
BridgeGetChildChainIndexingEnabled can get if child chain indexing is enabled or not.
func (*Client) BridgeGetChildOperatorAddr ¶ added in v1.1.1
BridgeGetChildOperatorAddr can get a child chain operator address.
func (*Client) BridgeGetChildOperatorNonce ¶ added in v1.1.1
BridgeGetChildOperatorAddr can get a child chain operator nonce.
func (*Client) BridgeGetERC20Fee ¶ added in v1.1.0
func (ec *Client) BridgeGetERC20Fee(ctx context.Context, bridgeAddr, tokenAddr common.Address) (*big.Int, error)
BridgeGetERC20Fee returns the ERC20 transfer fee.
func (*Client) BridgeGetFeeReceiver ¶ added in v1.1.0
func (ec *Client) BridgeGetFeeReceiver(ctx context.Context, bridgeAddr common.Address) (common.Address, error)
BridgeGetFeeReceiver returns the fee receiver.
func (*Client) BridgeGetKLAYFee ¶ added in v1.1.0
func (ec *Client) BridgeGetKLAYFee(ctx context.Context, bridgeAddr common.Address) (*big.Int, error)
BridgeGetKLAYFee returns the KLAY transfer fee.
func (*Client) BridgeGetLatestAnchoredBlockNumber ¶
BridgeGetLatestAnchoredBlockNumber can return the latest anchored block number.
func (*Client) BridgeGetParentOperatorAddr ¶ added in v1.1.1
BridgeGetParentOperatorAddr can get a parent chain operator address.
func (*Client) BridgeGetParentOperatorNonce ¶ added in v1.1.1
BridgeGetParentOperatorNonce can get a parent chain operator nonce.
func (*Client) BridgeGetReceiptFromParentChain ¶
func (ec *Client) BridgeGetReceiptFromParentChain(ctx context.Context, hash common.Hash) (*types.Receipt, error)
BridgeGetReceiptFromParentChain can get the receipt of child chain tx from parent node.
func (*Client) BridgeGetRegisteredOperators ¶ added in v1.2.0
func (ec *Client) BridgeGetRegisteredOperators(ctx context.Context, bridge common.Address) ([]common.Address, error)
BridgeGetRegisteredOperators returns the list of operators.
func (*Client) BridgeGetSentChainTxsLimit ¶
BridgeGetSentChainTxsLimit can get the maximum number of transaction which child peer can send to parent peer once.
func (*Client) BridgeGetTxPending ¶
func (ec *Client) BridgeGetTxPending(ctx context.Context) (map[common.Address]types.Transactions, error)
BridgeGetTxPending can return the pend tx list mapped by address.
func (*Client) BridgeGetValueTransferOperatorThreshold ¶ added in v1.2.0
func (ec *Client) BridgeGetValueTransferOperatorThreshold(ctx context.Context, bridge common.Address) (uint8, error)
BridgeGetValueTransferOperatorThreshold can get the operator threshold of the bridge contract.
func (*Client) BridgeListBridge ¶
func (ec *Client) BridgeListBridge(ctx context.Context) ([]*BridgeJournal, error)
BridgeListBridge can return the list of the bridge.
func (*Client) BridgeNodeInfo ¶
BridgeNodeInfo returns the node information
func (*Client) BridgePeersOnBridge ¶
BridgePeersOnBridge returns the peer list of bridge node for service chain.
func (*Client) BridgeRegisterBridge ¶
func (ec *Client) BridgeRegisterBridge(ctx context.Context, cBridge common.Address, pBridge common.Address) error
BridgeRegisterBridge can register the given pair of deployed child/parent bridges.
func (*Client) BridgeRegisterOperator ¶ added in v1.2.0
func (ec *Client) BridgeRegisterOperator(ctx context.Context, bridge, operator common.Address) (common.Hash, error)
BridgeRegisteredOperators registers an operator.
func (*Client) BridgeRegisterTokenContract ¶
func (ec *Client) BridgeRegisterTokenContract(ctx context.Context, cBridge, pBridge, cToken, pToken common.Address) error
BridgeRegisterTokenContract can register the given pair of deployed child/parent chain token contracts. If the registering is failed, it returns an error.
func (*Client) BridgeRemovePeerOnBridge ¶
BridgeRemovePeerOnParentChain can remove a static peer on bridge node.
func (*Client) BridgeSetERC20Fee ¶ added in v1.1.0
func (ec *Client) BridgeSetERC20Fee(ctx context.Context, bridgeAddr, tokenAddr common.Address, fee *big.Int) (common.Hash, error)
BridgeSetERC20Fee can set the ERC20 transfer fee.
func (*Client) BridgeSetFeeReceiver ¶ added in v1.1.0
func (ec *Client) BridgeSetFeeReceiver(ctx context.Context, bridgeAddr, receiver common.Address) (common.Hash, error)
BridgeSetFeeReceiver can set the fee receiver.
func (*Client) BridgeSetKLAYFee ¶ added in v1.1.0
func (ec *Client) BridgeSetKLAYFee(ctx context.Context, bridgeAddr common.Address, fee *big.Int) (common.Hash, error)
BridgeSetKLAYFee can set the KLAY transfer fee.
func (*Client) BridgeSetValueTransferOperatorThreshold ¶ added in v1.2.0
func (ec *Client) BridgeSetValueTransferOperatorThreshold(ctx context.Context, bridge common.Address, threshold uint8) (common.Hash, error)
BridgeSetValueTransferOperatorThreshold can set the operator threshold of the bridge contract.
func (*Client) BridgeSubscribeBridge ¶
func (ec *Client) BridgeSubscribeBridge(ctx context.Context, cBridge common.Address, pBridge common.Address) error
BridgeSubscribeBridge can enable for subbridge to subscribe the event of given child/parent chain bridges. If the subscribing is failed, it returns an error.
func (*Client) BridgeTxPendingCount ¶
BridgeTxPendingCount can return the count of the pend tx in bridge txpool.
func (*Client) BridgeUnsubscribeBridge ¶
func (ec *Client) BridgeUnsubscribeBridge(ctx context.Context, cBridge common.Address, pBridge common.Address) error
BridgeUnsubscribeBridge disables the event subscription of the given child/parent chain bridges. If the unsubscribing is failed, it returns an error.
func (*Client) CallContract ¶
func (ec *Client) CallContract(ctx context.Context, msg klaytn.CallMsg, blockNumber *big.Int) ([]byte, error)
CallContract executes a message call transaction, which is directly executed in the VM of the node, but never mined into the blockchain.
blockNumber selects the block height at which the call runs. It can be nil, in which case the code is taken from the latest known block. Note that state from very old blocks might not be available.
func (*Client) CodeAt ¶
func (ec *Client) CodeAt(ctx context.Context, account common.Address, blockNumber *big.Int) ([]byte, error)
CodeAt returns the contract code of the given account. The block number can be nil, in which case the code is taken from the latest known block.
func (*Client) CreateAccessList ¶ added in v1.8.0
func (ec *Client) CreateAccessList(ctx context.Context, msg klaytn.CallMsg) (*types.AccessList, uint64, string, error)
CreateAccessList tries to create an access list for a specific transaction based on the current pending state of the blockchain.
func (*Client) EstimateGas ¶
EstimateGas tries to estimate the gas needed to execute a specific transaction based on the latest state of the backend blockchain. There is no guarantee that this is the true gas limit requirement as other transactions may be added or removed by miners, but it should provide a basis for setting a reasonable default.
func (*Client) FilterLogs ¶
FilterLogs executes a filter query.
func (*Client) HeaderByHash ¶
HeaderByHash returns the block header with the given hash.
func (*Client) HeaderByNumber ¶
HeaderByNumber returns a block header from the current canonical chain. If number is nil, the latest known header is returned.
func (*Client) ImportRawKey ¶
func (ec *Client) ImportRawKey(ctx context.Context, key string, password string) (common.Address, error)
ImportRawKey can create key store from private key string on Klaytn node.
func (*Client) MainBridgeNodeInfo ¶
BridgeNodeInfo returns the node information
func (*Client) MainBridgePeersOnBridge ¶
BridgePeersOnBridge returns the peer list of bridge node for service chain.
func (*Client) NetworkID ¶
NetworkID returns the network ID (also known as the chain ID) for this chain.
func (*Client) NonceAt ¶
func (ec *Client) NonceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (uint64, error)
NonceAt returns the account nonce of the given account. The block number can be nil, in which case the nonce is taken from the latest known block.
func (*Client) PendingBalanceAt ¶
PendingBalanceAt returns the peb balance of the given account in the pending state.
func (*Client) PendingCallContract ¶
PendingCallContract executes a message call transaction using the EVM. The state seen by the contract call is the pending state.
func (*Client) PendingCodeAt ¶
PendingCodeAt returns the contract code of the given account in the pending state.
func (*Client) PendingNonceAt ¶
PendingNonceAt returns the account nonce of the given account in the pending state. This is the nonce that should be used for the next transaction.
func (*Client) PendingStorageAt ¶
func (ec *Client) PendingStorageAt(ctx context.Context, account common.Address, key common.Hash) ([]byte, error)
PendingStorageAt returns the value of key in the contract storage of the given account in the pending state.
func (*Client) PendingTransactionCount ¶
PendingTransactionCount returns the total number of transactions in the pending state.
func (*Client) RemovePeer ¶
RemovePeer can remove a static peer on Klaytn node.
func (*Client) SendRawTransaction ¶
func (ec *Client) SendRawTransaction(ctx context.Context, tx *types.Transaction) (common.Hash, error)
SendRawTransaction injects a signed transaction into the pending pool for execution.
This function can return the transaction hash and error.
func (*Client) SendTransaction ¶
SendTransaction injects a signed transaction into the pending pool for execution.
If the transaction was a contract creation use the TransactionReceipt method to get the contract address after the transaction has been mined.
func (*Client) SendUnsignedTransaction ¶
func (ec *Client) SendUnsignedTransaction(ctx context.Context, from common.Address, to common.Address, gas uint64, gasPrice uint64, value *big.Int, data []byte, input []byte) (common.Hash, error)
SendUnsignedTransaction injects a unsigned transaction into the pending pool for execution.
This function can return the transaction hash and error.
func (*Client) StorageAt ¶
func (ec *Client) StorageAt(ctx context.Context, account common.Address, key common.Hash, blockNumber *big.Int) ([]byte, error)
StorageAt returns the value of key in the contract storage of the given account. The block number can be nil, in which case the value is taken from the latest known block.
func (*Client) SubscribeFilterLogs ¶
func (ec *Client) SubscribeFilterLogs(ctx context.Context, q klaytn.FilterQuery, ch chan<- types.Log) (klaytn.Subscription, error)
SubscribeFilterLogs subscribes to the results of a streaming filter query.
func (*Client) SubscribeNewHead ¶
func (ec *Client) SubscribeNewHead(ctx context.Context, ch chan<- *types.Header) (klaytn.Subscription, error)
SubscribeNewHead subscribes to notifications about the current blockchain head on the given channel.
func (*Client) SuggestGasPrice ¶
SuggestGasPrice retrieves the currently suggested gas price to allow a timely execution of a transaction.
func (*Client) SyncProgress ¶
SyncProgress retrieves the current progress of the sync algorithm. If there's no sync currently running, it returns nil.
func (*Client) TransactionByHash ¶
func (ec *Client) TransactionByHash(ctx context.Context, hash common.Hash) (tx *types.Transaction, isPending bool, err error)
TransactionByHash returns the transaction with the given hash.
func (*Client) TransactionCount ¶
TransactionCount returns the total number of transactions in the given block.
func (*Client) TransactionInBlock ¶
func (ec *Client) TransactionInBlock(ctx context.Context, blockHash common.Hash, index uint) (*types.Transaction, error)
TransactionInBlock returns a single transaction at index in the given block.
func (*Client) TransactionReceipt ¶
func (ec *Client) TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)
TransactionReceipt returns the receipt of a transaction by transaction hash. Note that the receipt is not available for pending transactions.
func (*Client) TransactionReceiptRpcOutput ¶ added in v1.1.0
func (ec *Client) TransactionReceiptRpcOutput(ctx context.Context, txHash common.Hash) (r map[string]interface{}, err error)
TransactionReceiptRpcOutput returns the receipt of a transaction by transaction hash as a rpc output.
func (*Client) TransactionSender ¶
func (ec *Client) TransactionSender(ctx context.Context, tx *types.Transaction, block common.Hash, index uint) (common.Address, error)
TransactionSender returns the sender address of the given transaction. The transaction must be known to the remote node and included in the blockchain at the given block and index. The sender is the one derived by the protocol at the time of inclusion.
There is a fast-path for transactions retrieved by TransactionByHash and TransactionInBlock. Getting their sender address can be done without an RPC interaction.