Skip to content
This repository was archived by the owner on Oct 20, 2024. It is now read-only.

Commit 983b26f

Browse files
committed
privTx docs
1 parent 4a7586b commit 983b26f

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ Fork of [ethrpc](https://github.com/onrik/ethrpc) with additional [Flashbots RPC
55
* `FlashbotsCallBundle` ([`eth_callBundle`](https://docs.flashbots.net/flashbots-auction/searchers/advanced/rpc-endpoint/#eth_callbundle))
66
* `FlashbotsSendBundle` ([`eth_sendBundle`](https://docs.flashbots.net/flashbots-auction/searchers/advanced/rpc-endpoint/#eth_sendbundle))
77
* `FlashbotsGetUserStats` ([`flashbots_getUserStats`](https://docs.flashbots.net/flashbots-auction/searchers/advanced/rpc-endpoint/#flashbots_getuserstats))
8+
* `FlashbotsSendPrivateTransaction` (`eth_sendPrivateTransaction`)
9+
* `FlashbotsCancelPrivateTransaction` (`eth_cancelPrivateTransaction`)
810
* `FlashbotsSimulateBlock`: simulate a full block
911

1012
## Usage

flashbotsrpc.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,7 @@ func (rpc *FlashbotsRPC) FlashbotsSimulateBlock(privKey *ecdsa.PrivateKey, block
681681
return res, err
682682
}
683683

684-
// docs todo
684+
// Sends a rawTx to the Flashbots relay. It will be sent to miners as bundle for 25 blocks, after which the transaction is failed.
685685
func (rpc *FlashbotsRPC) FlashbotsSendPrivateTransaction(privKey *ecdsa.PrivateKey, param FlashbotsSendPrivateTransactionRequest) (txHash string, err error) {
686686
rawMsg, err := rpc.CallWithFlashbotsSignature("eth_sendPrivateTransaction", privKey, param)
687687
if err != nil {
@@ -691,10 +691,15 @@ func (rpc *FlashbotsRPC) FlashbotsSendPrivateTransaction(privKey *ecdsa.PrivateK
691691
return txHash, err
692692
}
693693

694-
// docs todo
694+
// Try to cancel a private transaction at the Flashbots relay. If this call returns true this means the cancel was initiated, but it's not guaranteed
695+
// that the transaction is actually cancelled, only that it won't be sent to miners anymore. A transaction that was already sent to miners might still
696+
// be included in the next block.
697+
//
698+
// Possible errors: 'tx not found', 'tx was already cancelled', 'tx has already expired'
695699
func (rpc *FlashbotsRPC) FlashbotsCancelPrivateTransaction(privKey *ecdsa.PrivateKey, param FlashbotsCancelPrivateTransactionRequest) (cancelled bool, err error) {
696700
rawMsg, err := rpc.CallWithFlashbotsSignature("eth_cancelPrivateTransaction", privKey, param)
697701
if err != nil {
702+
// possible todo: return specific errors for the 3 possible relay-internal error cases
698703
return false, err
699704
}
700705
err = json.Unmarshal(rawMsg, &cancelled)

0 commit comments

Comments
 (0)