Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add section for suave-std api #92

Merged
merged 6 commits into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 18 additions & 9 deletions docs/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module.exports = {
'technical/specs/rigil/confidential-data-store',
'concepts/confidential-computation',
'concepts/block-building',
'concepts/mev-supplychain-interface',
'concepts/mev-supplychain-interface'
]
},
{
Expand All @@ -36,24 +36,33 @@ module.exports = {
link: { type: 'doc', id: 'tutorials/index' },
items: [
'tutorials/run-suave',
'tutorials/suave-standard-library',
'tutorials/deploy-contracts',
'tutorials/build-suapp-webapp',
'tutorials/confidential-compute-requests',
'tutorials/create-precompiles',
'concepts/confidential-data-storage',
'tutorials/create-precompiles'
]
},
{
type: 'category',
label: '🛠️ Tools',
collapsed: false,
link: { type: 'doc', id: 'resources/index' },
link: { type: 'doc', id: 'tools/index' },
items: [
'resources/rigil',
'resources/forge',
'resources/golang-sdk',
'resources/typescript-sdk'
'tools/rigil',
{
type: 'category',
label: 'SUAVE-STD',
collapsed: true,
items: [
{
type: 'autogenerated',
dirName: 'tools/suave-std',
}
]
},
'tools/forge',
'tools/golang-sdk',
'tools/typescript-sdk'
],
},
{
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/forge.mdx → docs/tools/forge.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,4 @@ forge create --rpc-url http://localhost:8545 --legacy \
examples/app-ofa-private/ofa-private.sol:OFAPrivate
```

You should also note, if you look at the other examples, how the [Golang SDK](/resources/golang-sdk) is used not only to deploy contracts, but test various kinds of transactions in order to illustrate how each contract is intended to function. Using the Golang SDK can provide for significantly more flexibility than just deploying your contract via Forge.
You should also note, if you look at the other examples, how the [Golang SDK](/tools/golang-sdk) is used not only to deploy contracts, but test various kinds of transactions in order to illustrate how each contract is intended to function. Using the Golang SDK can provide for significantly more flexibility than just deploying your contract via Forge.
File renamed without changes.
6 changes: 3 additions & 3 deletions docs/resources/index.mdx → docs/tools/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ Here is an up-to-date list of software and repositories to help you build on [SU
**SDKs and Tools:**

- [`suave-std` Solidity Libraries](/tutorials/suave-standard-library)
- [Forge](/resources/forge)
- [Golang SDK](/resources/golang-sdk)
- [`suave-viem` TypeScript SDK](/resources/typescript-sdk)
- [Forge](/tools/forge)
- [Golang SDK](/tools/golang-sdk)
- [`suave-viem` TypeScript SDK](/tools/typescript-sdk)

**Docs, examples and code:**

Expand Down
File renamed without changes.
21 changes: 21 additions & 0 deletions docs/tools/suave-std/Context.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Context

Context is a library with functions to retrieve the context of the MEVM execution.

## Functions

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

Returns the confidential inputs of the confidential compute request.

Output:

- `output` (`bytes`): Bytes of the confidential inputs.

### [kettleAddress](https://github.com/flashbots/suave-std/tree/main/src/Context.sol#L16)

Returns the address of the Kettle that executes the confidential compute request.

Output:

- `kettleAddress` (`address`): Address of the kettle.
53 changes: 53 additions & 0 deletions docs/tools/suave-std/Random.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Random

Random is a library with utilities to generate random data.

## Functions

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

Generate a random uint8 number.

Output:

- `value` (`uint8`): Is the random number.

### [randomUint16](https://github.com/flashbots/suave-std/tree/main/src/Random.sol#L19)

Generate a random uint16 number.

Output:

- `value` (`uint16`): Is the random number.

### [randomUint32](https://github.com/flashbots/suave-std/tree/main/src/Random.sol#L28)

Generate a random uint32 number.

Output:

- `value` (`uint32`): Is the random number.

### [randomUint64](https://github.com/flashbots/suave-std/tree/main/src/Random.sol#L37)

Generate a random uint64 number.

Output:

- `value` (`uint64`): Is the random number.

### [randomUint128](https://github.com/flashbots/suave-std/tree/main/src/Random.sol#L46)

Generate a random uint128 number.

Output:

- `value` (`uint128`): Is the random number.

### [randomUint256](https://github.com/flashbots/suave-std/tree/main/src/Random.sol#L55)

Generate a random uint256 number.

Output:

- `value` (`uint256`): Is the random number.
9 changes: 9 additions & 0 deletions docs/tools/suave-std/Suapp.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Suapp

Suapp is a contract with general utilities for a Suapp.

## Functions

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

Modifier to emit the offchain logs.
189 changes: 189 additions & 0 deletions docs/tools/suave-std/Transactions.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
# Transactions

Transactions is a library with utilities to encode, decode and sign Ethereum transactions.

## Functions

### [encodeRLP](https://github.com/flashbots/suave-std/tree/main/src/Transactions.sol#L109)

Encode a EIP-155 transaction in RLP.

Input:

- `txStruct` ([EIP155](#eip155)): Is the transaction structure.

Output:

- `output` (`bytes`): The encoded RLP bytes.

### [encodeRLP](https://github.com/flashbots/suave-std/tree/main/src/Transactions.sol#L133)

Encode a EIP-1559 request transaction in RLP.

Input:

- `txStruct` ([EIP155Request](#eip155request)): Is the transaction structure.

Output:

- `output` (`bytes`): The encoded RLP bytes.

### [encodeRLP](https://github.com/flashbots/suave-std/tree/main/src/Transactions.sol#L157)

Encode a EIP-1559 transaction in RLP.

Input:

- `txStruct` ([EIP1559](#eip1559)): Is the transaction structure.

Output:

- `output` (`bytes`): The encoded RLP bytes.

### [encodeRLP](https://github.com/flashbots/suave-std/tree/main/src/Transactions.sol#L200)

Encode a EIP-1559 request transaction in RLP.

Input:

- `txStruct` ([EIP1559Request](#eip1559request)): Is the transaction structure.

Output:

- `output` (`bytes`): The encoded RLP bytes.

### [decodeRLP_EIP155](https://github.com/flashbots/suave-std/tree/main/src/Transactions.sol#L239)

Decode a EIP-155 transaction from RLP.

Input:

- `rlp` (`bytes`): Is the encoded RLP bytes.

Output:

- `txStruct` ([EIP155](#eip155)): The transaction structure.

### [decodeRLP_EIP155Request](https://github.com/flashbots/suave-std/tree/main/src/Transactions.sol#L267)

Decode a EIP-155 request transaction from RLP.

Input:

- `rlp` (`bytes`): Is the encoded RLP bytes.

Output:

- `txStruct` ([EIP155Request](#eip155request)): The transaction structure.

### [decodeRLP_EIP1559](https://github.com/flashbots/suave-std/tree/main/src/Transactions.sol#L293)

Decode a EIP-1559 transaction from RLP.

Input:

- `rlp` (`bytes`): Is the encoded RLP bytes.

Output:

- `txStruct` ([EIP1559](#eip1559)): The transaction structure.

### [decodeRLP_EIP1559Request](https://github.com/flashbots/suave-std/tree/main/src/Transactions.sol#L330)

Decode a EIP-1559 request transaction from RLP.

Input:

- `rlp` (`bytes`): Is the encoded RLP bytes.

Output:

- `txStruct` ([EIP1559Request](#eip1559request)): The transaction structure.

### [signTxn](https://github.com/flashbots/suave-std/tree/main/src/Transactions.sol#L371)

Sign a EIP-155 transaction request.

Input:

- `request` ([EIP1559Request](#eip1559request)): Is the transaction request.

- `signingKey` (`string`): Is the private key to sign the transaction.

Output:

- `response` ([EIP1559](#eip1559)): The signed transaction.

### [signTxn](https://github.com/flashbots/suave-std/tree/main/src/Transactions.sol#L400)

Sign a EIP-155 transaction request.

Input:

- `request` ([EIP155Request](#eip155request)): Is the transaction request.

- `signingKey` (`string`): Is the private key to sign the transaction.

Output:

- `response` ([EIP155](#eip155)): The signed transaction.

## Structs

### [EIP155](https://github.com/flashbots/suave-std/tree/main/src/Transactions.sol#L25)

EIP-155 transaction structure.

- `to` (`address`): Is the target address.
- `gas` (`uint256`): Is the gas limit.
- `gasPrice` (`uint256`): Is the gas price.
- `value` (`uint256`): Is the transfer value in gwei.
- `nonce` (`uint256`): Is the latest nonce of the sender.
- `data` (`bytes`): Is the transaction data.
- `chainId` (`uint256`): Is the id of the chain where the transaction will be executed.
- `r` (`bytes32`): Is the 'r' signature value.
- `s` (`bytes32`): Is the 's' signature value.
- `v` (`uint256`): Is the 'v' signature value.

### [EIP155Request](https://github.com/flashbots/suave-std/tree/main/src/Transactions.sol#L46)

EIP-155 transaction request structure.

- `to` (`address`): Is the target address.
- `gas` (`uint256`): Is the gas limit.
- `gasPrice` (`uint256`): Is the gas price.
- `value` (`uint256`): Is the transfer value in gwei.
- `nonce` (`uint256`): Is the latest nonce of the sender.
- `data` (`bytes`): Is the transaction data.
- `chainId` (`uint256`): Is the id of the chain where the transaction will be executed.

### [EIP1559](https://github.com/flashbots/suave-std/tree/main/src/Transactions.sol#L69)

EIP-1559 transaction structure.

- `to` (`address`): Is the target address.
- `gas` (`uint256`): Is the gas limit.
- `maxFeePerGas` (`uint256`): Is the maximum fee per gas.
- `maxPriorityFeePerGas` (`uint256`): Is the maximum priority fee per gas.
- `value` (`uint256`): Is the transfer value in gwei.
- `nonce` (`uint256`): Is the latest nonce of the sender.
- `data` (`bytes`): Is the transaction data.
- `chainId` (`uint256`): Is the id of the chain where the transaction will be executed.
- `accessList` (`bytes`): Is the access list.
- `r` (`bytes32`): Is the 'r' signature value.
- `s` (`bytes32`): Is the 's' signature value.
- `v` (`uint256`): Is the 'v' signature value.

### [EIP1559Request](https://github.com/flashbots/suave-std/tree/main/src/Transactions.sol#L94)

EIP-1559 transaction request structure.

- `to` (`address`): Is the target address.
- `gas` (`uint256`): Is the gas limit.
- `maxFeePerGas` (`uint256`): Is the maximum fee per gas.
- `maxPriorityFeePerGas` (`uint256`): Is the maximum priority fee per gas.
- `value` (`uint256`): Is the transfer value in gwei.
- `nonce` (`uint256`): Is the latest nonce of the sender.
- `data` (`bytes`): Is the transaction data.
- `chainId` (`uint256`): Is the id of the chain where the transaction will be executed.
- `accessList` (`bytes`): Is the access list.
42 changes: 42 additions & 0 deletions docs/tools/suave-std/protocols/Bundle.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Bundle

Bundle is a library with utilities to interact with the Flashbots bundle API described in https://docs.flashbots.net/flashbots-auction/advanced/rpc-endpoint#eth_sendbundle.

## Functions

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

Send a bundle to the Flashbots relay.

Input:

- `url` (`string`): The URL of the Flashbots relay.

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

Output:

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

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

Decode a bundle from a JSON string.

Input:

- `bundleJson` (`string`): The JSON string of the bundle.

Output:

- `bundle` ([BundleObj](#bundleobj)): The decoded bundle.

## Structs

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

BundleObj is a struct that represents a bundle to be sent to the Flashbots relay.

- `blockNumber` (`uint64`): The block number at which the bundle should be executed.
- `minTimestamp` (`uint64`): The minimum timestamp at which the bundle should be executed.
- `maxTimestamp` (`uint64`): The maximum timestamp at which the bundle should be executed.
- `txns` (``): The transactions to be included in the bundle.
Loading
Loading