Skip to content

Commit

Permalink
Update Suave-std api reference (#128)
Browse files Browse the repository at this point in the history
* Update Suave-std api reference

* fix build

---------

Co-authored-by: metachris <[email protected]>
Co-authored-by: andytudhope <[email protected]>
  • Loading branch information
3 people authored Aug 5, 2024
1 parent baa21a3 commit a1a685d
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 28 deletions.
2 changes: 1 addition & 1 deletion docs/tools/suave-std/Suapp.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ Suapp is a contract with general utilities for a Suapp.

## Functions

### [emitOffchainLogs](https://github.com/flashbots/suave-std/tree/main/src/Suapp.sol#L9)
### [emitOffchainLogs](https://github.com/flashbots/suave-std/tree/main/src/Suapp.sol#L10)

Modifier to emit the offchain logs.
26 changes: 25 additions & 1 deletion docs/tools/suave-std/protocols/Bundle.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,31 @@ Output:

- `response` (`bytes`): Raw bytes response from the Flashbots relay.

### [decodeBundle](https://github.com/flashbots/suave-std/tree/main/src/protocols/Bundle.sol#L82)
### [encodeBundleParams](https://github.com/flashbots/suave-std/tree/main/src/protocols/Bundle.sol#L39)

Encode a bundle in json format.

Input:

- `args` ([BundleObj](#bundleobj)): The bundle to encode.

Output:

- `params` (`bytes`): JSON-encoded bytes: `{blockNumber, txs, minTimestamp, maxTimestamp}`.

### [encodeBundle](https://github.com/flashbots/suave-std/tree/main/src/protocols/Bundle.sol#L61)

Encode a call to `eth_sendBundle` as an HttpRequest.

Input:

- `args` ([BundleObj](#bundleobj)): The bundle to encode.

Output:

- `request` ([HttpRequest](/tools/suave-std/suavelib/Suave#httprequest)): The HttpRequest to send the bundle.

### [decodeBundle](https://github.com/flashbots/suave-std/tree/main/src/protocols/Bundle.sol#L90)

Decode a bundle from a JSON string.

Expand Down
53 changes: 27 additions & 26 deletions docs/tools/suave-std/suavelib/Suave.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ Library to interact with the Suave MEVM precompiles.

## Functions

### [isConfidential](https://github.com/flashbots/suave-std/tree/main/src/suavelib/Suave.sol#L153)
### [isConfidential](https://github.com/flashbots/suave-std/tree/main/src/suavelib/Suave.sol#L155)

Returns whether execution is off- or on-chain.

Output:

- `b` (`bool`): Whether execution is off- or on-chain.

### [buildEthBlock](https://github.com/flashbots/suave-std/tree/main/src/suavelib/Suave.sol#L172)
### [buildEthBlock](https://github.com/flashbots/suave-std/tree/main/src/suavelib/Suave.sol#L174)

Constructs an Ethereum block based on the provided data records. No blobs are returned.

Expand All @@ -30,7 +30,7 @@ Output:

- `executionPayload` (`bytes`): Execution payload encoded in JSON.

### [buildEthBlockTo](https://github.com/flashbots/suave-std/tree/main/src/suavelib/Suave.sol#L191)
### [buildEthBlockTo](https://github.com/flashbots/suave-std/tree/main/src/suavelib/Suave.sol#L193)

Constructs an Ethereum block based on the provided data records. No blobs are returned.

Expand All @@ -50,15 +50,15 @@ Output:

- `executionPayload` (`bytes`): Execution payload encoded in JSON.

### [confidentialInputs](https://github.com/flashbots/suave-std/tree/main/src/suavelib/Suave.sol#L208)
### [confidentialInputs](https://github.com/flashbots/suave-std/tree/main/src/suavelib/Suave.sol#L210)

Provides the confidential inputs associated with a confidential computation request. Outputs are in bytes format.

Output:

- `confindentialData` (`bytes`): Confidential inputs.

### [confidentialRetrieve](https://github.com/flashbots/suave-std/tree/main/src/suavelib/Suave.sol#L221)
### [confidentialRetrieve](https://github.com/flashbots/suave-std/tree/main/src/suavelib/Suave.sol#L223)

Retrieves data from the confidential store. Also mandates the caller's presence in the `AllowedPeekers` list.

Expand All @@ -72,7 +72,7 @@ Output:

- `value` (`bytes`): Value of the data.

### [confidentialStore](https://github.com/flashbots/suave-std/tree/main/src/suavelib/Suave.sol#L234)
### [confidentialStore](https://github.com/flashbots/suave-std/tree/main/src/suavelib/Suave.sol#L236)

Stores data in the confidential store. Requires the caller to be part of the `AllowedPeekers` for the associated data record.

Expand All @@ -84,7 +84,7 @@ Input:

- `value` (`bytes`): Value of the data to store.

### [contextGet](https://github.com/flashbots/suave-std/tree/main/src/suavelib/Suave.sol#L244)
### [contextGet](https://github.com/flashbots/suave-std/tree/main/src/suavelib/Suave.sol#L246)

Retrieves a value from the context.

Expand All @@ -96,7 +96,7 @@ Output:

- `value` (`bytes`): Value of the key.

### [doHTTPRequest](https://github.com/flashbots/suave-std/tree/main/src/suavelib/Suave.sol#L256)
### [doHTTPRequest](https://github.com/flashbots/suave-std/tree/main/src/suavelib/Suave.sol#L258)

Performs an HTTP request and returns the response. `request` is the request to perform.

Expand All @@ -108,7 +108,7 @@ Output:

- `httpResponse` (`bytes`): Body of the response.

### [ethcall](https://github.com/flashbots/suave-std/tree/main/src/suavelib/Suave.sol#L269)
### [ethcall](https://github.com/flashbots/suave-std/tree/main/src/suavelib/Suave.sol#L271)

Uses the `eth_call` JSON RPC method to let you simulate a function call and return the response.

Expand All @@ -122,7 +122,7 @@ Output:

- `callOutput` (`bytes`): Output of the contract call.

### [extractHint](https://github.com/flashbots/suave-std/tree/main/src/suavelib/Suave.sol#L281)
### [extractHint](https://github.com/flashbots/suave-std/tree/main/src/suavelib/Suave.sol#L283)

Interprets the bundle data and extracts hints, such as the `To` address and calldata.

Expand All @@ -134,7 +134,7 @@ Output:

- `hints` (`bytes`): List of hints encoded in JSON.

### [fetchDataRecords](https://github.com/flashbots/suave-std/tree/main/src/suavelib/Suave.sol#L295)
### [fetchDataRecords](https://github.com/flashbots/suave-std/tree/main/src/suavelib/Suave.sol#L297)

Retrieves all data records correlating with a specified decryption condition and namespace.

Expand All @@ -148,7 +148,7 @@ Output:

- `dataRecords` (``): List of data records that match the filter.

### [fillMevShareBundle](https://github.com/flashbots/suave-std/tree/main/src/suavelib/Suave.sol#L307)
### [fillMevShareBundle](https://github.com/flashbots/suave-std/tree/main/src/suavelib/Suave.sol#L309)

Joins the user's transaction and with the backrun, and returns encoded mev-share bundle. The bundle is ready to be sent via `SubmitBundleJsonRPC`.

Expand All @@ -160,15 +160,15 @@ Output:

- `encodedBundle` (`bytes`): Mev-Share bundle encoded in JSON.

### [newBuilder](https://github.com/flashbots/suave-std/tree/main/src/suavelib/Suave.sol#L319)
### [newBuilder](https://github.com/flashbots/suave-std/tree/main/src/suavelib/Suave.sol#L321)

Initializes a new remote builder session.

Output:

- `sessionid` (`string`): ID of the remote builder session.

### [newDataRecord](https://github.com/flashbots/suave-std/tree/main/src/suavelib/Suave.sol#L334)
### [newDataRecord](https://github.com/flashbots/suave-std/tree/main/src/suavelib/Suave.sol#L336)

Initializes data records within the ConfidentialStore. Prior to storing data, all data records should undergo initialization via this precompile.

Expand All @@ -186,7 +186,7 @@ Output:

- `dataRecord` ([DataRecord](#datarecord)): Data record that was created.

### [privateKeyGen](https://github.com/flashbots/suave-std/tree/main/src/suavelib/Suave.sol#L352)
### [privateKeyGen](https://github.com/flashbots/suave-std/tree/main/src/suavelib/Suave.sol#L354)

Generates a private key in ECDA secp256k1 format.

Expand All @@ -198,7 +198,7 @@ Output:

- `privateKey` (`string`): Hex encoded string of the ECDSA private key. Exactly as a signMessage precompile wants.

### [randomBytes](https://github.com/flashbots/suave-std/tree/main/src/suavelib/Suave.sol#L364)
### [randomBytes](https://github.com/flashbots/suave-std/tree/main/src/suavelib/Suave.sol#L366)

Generates a number of random bytes, given by the argument numBytes.

Expand All @@ -210,7 +210,7 @@ Output:

- `value` (`bytes`): Randomly-generated bytes.

### [signEthTransaction](https://github.com/flashbots/suave-std/tree/main/src/suavelib/Suave.sol#L378)
### [signEthTransaction](https://github.com/flashbots/suave-std/tree/main/src/suavelib/Suave.sol#L380)

Signs an Ethereum Transaction, 1559 or Legacy, and returns raw signed transaction bytes. `txn` is binary encoding of the transaction.

Expand All @@ -226,7 +226,7 @@ Output:

- `signedTxn` (`bytes`): Signed transaction encoded in RLP.

### [signMessage](https://github.com/flashbots/suave-std/tree/main/src/suavelib/Suave.sol#L395)
### [signMessage](https://github.com/flashbots/suave-std/tree/main/src/suavelib/Suave.sol#L397)

Signs a message and returns the signature.

Expand All @@ -242,7 +242,7 @@ Output:

- `signature` (`bytes`): Signature of the message with the private key.

### [simulateBundle](https://github.com/flashbots/suave-std/tree/main/src/suavelib/Suave.sol#L411)
### [simulateBundle](https://github.com/flashbots/suave-std/tree/main/src/suavelib/Suave.sol#L413)

Performs a simulation of the bundle by building a block that includes it.

Expand All @@ -254,7 +254,7 @@ Output:

- `effectiveGasPrice` (`uint64`): Effective Gas Price of the resultant block.

### [simulateTransaction](https://github.com/flashbots/suave-std/tree/main/src/suavelib/Suave.sol#L424)
### [simulateTransaction](https://github.com/flashbots/suave-std/tree/main/src/suavelib/Suave.sol#L426)

Simulates a transaction on a remote builder session.

Expand All @@ -268,7 +268,7 @@ Output:

- `simulationResult` ([SimulateTransactionResult](#simulatetransactionresult)): Result of the simulation.

### [submitBundleJsonRPC](https://github.com/flashbots/suave-std/tree/main/src/suavelib/Suave.sol#L441)
### [submitBundleJsonRPC](https://github.com/flashbots/suave-std/tree/main/src/suavelib/Suave.sol#L443)

Submits bytes as JSONRPC message to the specified URL with the specified method. As this call is intended for bundles, it also signs the params and adds `X-Flashbots-Signature` header, as usual with bundles. Regular eth bundles don't need any processing to be sent.

Expand All @@ -284,7 +284,7 @@ Output:

- `errorMessage` (`bytes`): Error message if any.

### [submitEthBlockToRelay](https://github.com/flashbots/suave-std/tree/main/src/suavelib/Suave.sol#L458)
### [submitEthBlockToRelay](https://github.com/flashbots/suave-std/tree/main/src/suavelib/Suave.sol#L460)

Submits a given builderBid to a mev-boost relay.

Expand Down Expand Up @@ -327,7 +327,7 @@ A record of data stored in the ConfidentialStore.
- `allowedStores` (``): Addresses can set data.
- `version` (`string`): Namespace of the data record.

### [HttpRequest](https://github.com/flashbots/suave-std/tree/main/src/suavelib/Suave.sol#L63)
### [HttpRequest](https://github.com/flashbots/suave-std/tree/main/src/suavelib/Suave.sol#L64)

Description of an HTTP request.

Expand All @@ -336,8 +336,9 @@ Description of an HTTP request.
- `headers` (``): HTTP Headers.
- `body` (`bytes`): Body of the request (if Post or Put).
- `withFlashbotsSignature` (`bool`): Whether to include the Flashbots signature.
- `timeout` (`uint64`): Timeout of the request in milliseconds.

### [SimulateTransactionResult](https://github.com/flashbots/suave-std/tree/main/src/suavelib/Suave.sol#L76)
### [SimulateTransactionResult](https://github.com/flashbots/suave-std/tree/main/src/suavelib/Suave.sol#L78)

Result of a simulated transaction.

Expand All @@ -346,15 +347,15 @@ Result of a simulated transaction.
- `success` (`bool`): Whether the transaction was successful or not.
- `error` (`string`): Error message if any.

### [SimulatedLog](https://github.com/flashbots/suave-std/tree/main/src/suavelib/Suave.sol#L87)
### [SimulatedLog](https://github.com/flashbots/suave-std/tree/main/src/suavelib/Suave.sol#L89)

A log emitted during the simulation of a transaction.

- `data` (`bytes`): Data of the log.
- `addr` (`address`): Address of the contract that emitted the log.
- `topics` (``): Topics of the log.

### [Withdrawal](https://github.com/flashbots/suave-std/tree/main/src/suavelib/Suave.sol#L98)
### [Withdrawal](https://github.com/flashbots/suave-std/tree/main/src/suavelib/Suave.sol#L100)

A withdrawal from the beacon chain.

Expand Down

0 comments on commit a1a685d

Please sign in to comment.