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

Build, Linting, Formatting #72

Merged
merged 3 commits into from
Dec 12, 2023
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
2 changes: 1 addition & 1 deletion .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
],
"ignorePaths": [
"package.json",
"yarn.lock",
"package-lock.json",
"project-words.txt",
"*.gitignore"
],
Expand Down
14 changes: 3 additions & 11 deletions .github/workflows/pr-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,9 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: '20.x'
cache: 'yarn'

- name: Installing dependencies
run: yarn install --frozen-lockfile
run: npm install

- name: Building the docs
env:
Expand All @@ -35,7 +34,7 @@ jobs:
ALGOLIA_APP_ID: 'example'
ALGOLIA_SEARCH_API_KEY: 'example'
ALGOLIA_INDEX_NAME: 'example'
run: yarn build
run: npm run build

- name: Check for broken links
env:
Expand All @@ -44,7 +43,7 @@ jobs:
run: |
go install github.com/raviqqe/muffet/v2@latest

yarn serve &
npm run serve &
sleep 5

echo "Checking for broken links..."
Expand All @@ -53,15 +52,8 @@ jobs:
--ignore-fragments \
--skip-tls-verification \
--buffer-size=16384 \
--exclude="notion[.]so" \
-e "algolia[.]net" \
-e "arxiv[.]org" \
-e "docs[.]google[.]com/presentation/d/19km1xqXrp6HClAOmyUwtq7lADM7BEUsPbTUE7zCwhCw" \
-e "pathoram[.]jimdofree[.]com/files/" \
-e "flashbots[.]notion[.]site" \
-e "https://github.com/flashbots/suave-docs" \
-e "https://github.com/flashbots/suave-bridge" \
-e "https://github.com/flashbots/suave-specs" \
-e "https://github.com/flashbots/suapp-examples" \
-e "https://github.com/flashbots/suave-viem" \
-e "https://suave.flashbots.net"
4 changes: 0 additions & 4 deletions .stylelintignore

This file was deleted.

4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ CUR_DIR := $(shell pwd)
docker: docker-deps docker-start

docker-deps:
docker run -p 3000:3000 --name suave-docs --rm -it -w /mnt -v $(CUR_DIR):/mnt node:20 /usr/local/bin/yarn install
docker run -p 3000:3000 --name suave-docs --rm -it -w /mnt -v $(CUR_DIR):/mnt node:20 /usr/local/bin/npm install

docker-start:
docker run -p 3000:3000 --name suave-docs --rm -it -w /mnt -v $(CUR_DIR):/mnt node:20 /usr/local/bin/yarn start
docker run -p 3000:3000 --name suave-docs --rm -it -w /mnt -v $(CUR_DIR):/mnt node:20 /usr/local/bin/npm start
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ Then install the dependencies and serve the content:

```bash
# install dependencies
yarn install
npm install

# start dev-server
yarn start
npm start

# doing the same in Docker:
make docker-deps
Expand All @@ -48,7 +48,7 @@ You can open the local docs at [http://localhost:3000/docs](http://localhost:300
## Build

```bash
yarn build
npm run build
```

This command generates static content into the `build` directory and can be served using any static contents hosting service.
Expand Down
4 changes: 2 additions & 2 deletions docs/cheatsheet.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,9 @@ If you want specific formatting for a certain language like for example Javascri
const threeCats = ['cat', 'cat', 'cat'];
```

````md
```md
Mind the indentation here, code blocks in code blocks isn't normal usage `js const threeCats = ["cat", "cat", "cat"] `
````
```

Theres a lot of different formattings to use, `md`, `js`, `ts`, etc. The package used is [Prism react render](https://github.com/FormidableLabs/prism-react-renderer)

Expand Down
2 changes: 1 addition & 1 deletion docs/design-goals.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,4 @@ It should be possible to quantify who benefits, and how much they benefit relati

We do not mean "who" in the personal sense, but rather in terms of the type of actors involved. Specifically, users should enjoy the maximum value possible while ensuring SUAVE is adopted by all parties, with the rest of that value cascading down to those doing the most relevant work.

- [MEV Precedence List](https://youtu.be/6oFNYDBH76Q?t=464)
- [MEV Precedence List](https://youtu.be/6oFNYDBH76Q?t=464)
9 changes: 5 additions & 4 deletions docs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ Once you have SUAVE running:
<div className="intro-desc">Begin building Suave applications</div>
</div>
</div>

</a>
<a href="/tutorials/create-precompiles" className="intro-link">
<div className="intro-block">
Expand Down Expand Up @@ -163,13 +164,13 @@ You can find us in our [Forum](https://collective.flashbots.net/c/suave/27) and
</div>
<div className="intro-text">
<div className="intro-heading">Flashbots Suave Forum</div>
<div className="intro-desc">Discuss your thoughts and ideas with the community</div>
<div className="intro-desc">
Discuss your thoughts and ideas with the community
</div>
</div>
</div>
</a>
<a
href="https://github.com/flashbots/suave-geth"
className="intro-link">
<a href="https://github.com/flashbots/suave-geth" className="intro-link">
<div className="intro-block">
<div className="intro-image">
<svg
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ Here is an up-to-date list of software built by the SUAVE community:

## In this section

<DocCardList />
<DocCardList />
9 changes: 5 additions & 4 deletions docs/resources/rigil.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,20 @@ description: All the relevant information you need to interact with Rigil
---

import RPCButton from '@site/src/components/RPCButton/index';
import List from '@site/src/components/List/List.tsx'
import List from '@site/src/components/List/List.tsx';


Flashbots has a hosted set of RPC nodes you can connect to:

<RPCButton />

Other relavant resources may be found below:
Other relevant resources may be found below:

<List>

[Block Explorer](https://explorer.rigil.suave.flashbots.net)
[Block Explorer](https://explorer.rigil.suave.flashbots.net)

[Faucet](https://faucet.rigil.suave.flashbots.net/)
[Faucet](https://faucet.rigil.suave.flashbots.net/)

[EthStats](https://ethstats.rigil.suave.flashbots.net/)

Expand Down
30 changes: 0 additions & 30 deletions docs/resources/tools-resources.mdx
Original file line number Diff line number Diff line change
@@ -1,30 +0,0 @@
---
title: Tools and Resources
description: An up-to-date list of software to help you build on SUAVE
---

Here is an up-to-date list of software and repositories to help you build on [SUAVE Rigil](/technical/specs/rigil):

**SDKs and Tools:**

- [SUAVE-Forge](/resources/forge)
- [Golang SDK](/resources/golang-sdk)
- [SUAVE-viem Typescript SDK](/resources/typescript-sdk)
- [Example script to deploy and test](/tutorials/send-transactions)

**Docs, examples and code:**

- [SUAPP Examples Repo](https://github.com/flashbots/suapp-examples)
- [SUAVE Rigil Specs](/technical/specs/rigil)
- [suave-geth](https://github.com/flashbots/suave-geth)

## Community

Here is an up-to-date list of software built by the SUAVE community:

1. [SUAVE Playground](https://github.com/halo3mic/suave-playground) by [Miha](https://twitter.com/MihaLotric). This repository serves as a guide for setting up a local environment to build and submit Goerli blocks to Flashbots's relay using Suave.
2. [SUAVE Foundry Template](https://github.com/mehranhydary/suave-template) by [Mehran](https://twitter.com/mehranhydary) is an alternate approach to using Foundry than you'll find in the SUAPP Examples repo.

### Applications

1. [Arena X on SUAVE](https://github.com/mehranhydary/arena-suave) by [Mehran](https://twitter.com/mehranhydary/status/1727849740333703310). This is a MEV application that takes orders from users on any chain, lets searchers execute user orders on any chain, and then returns the outputs to the user. Use Arena X to trade any token and be safe from MEV.
67 changes: 36 additions & 31 deletions docs/resources/typescript-sdk.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Then use bun to install all the dependencies (this can take a while):
bun install
```

### Step 3: Build the project
### Step 3: Build the project

```bash
bun run build
Expand Down Expand Up @@ -86,8 +86,8 @@ You should see something like this logged in your terminal (you can accept the d
```bash
bun init helps you get started with a minimal project and tries to guess sensible defaults. Press ^C anytime to quit

package name (suapp):
entry point (index.ts):
package name (suapp):
entry point (index.ts):

Done! A package.json file was saved in the current directory.
+ index.ts
Expand Down Expand Up @@ -127,8 +127,8 @@ import {http} from 'viem';
import {suaveRigil} from 'viem/chains';

// connect to your local SUAVE node
const SUAVE_RPC_URL = 'http://localhost:8545'
const suaveProvider = suaveRigil.newPublicClient(http(SUAVE_RPC_URL))
const SUAVE_RPC_URL = 'http://localhost:8545';
const suaveProvider = suaveRigil.newPublicClient(http(SUAVE_RPC_URL));
```

## Wallet Creation
Expand All @@ -139,7 +139,8 @@ To interact with the SUAVE network, we'll first need a wallet. When running SUAV
// other imports from above
import {Hex} from 'viem';

const DEFAULT_PRIVATE_KEY: Hex = '0x91ab9a7e53c220e6210460b65a7a3bb2ca181412a8a7b43ff336b3df1737ce12';
const DEFAULT_PRIVATE_KEY: Hex =
'0x91ab9a7e53c220e6210460b65a7a3bb2ca181412a8a7b43ff336b3df1737ce12';

const defaultWallet = getSuaveWallet(
{
Expand Down Expand Up @@ -210,7 +211,7 @@ const wallet = getSuaveWallet(
Create a transaction object to fund your new wallet with the required amount.

```typescript
import { TransactionRequestSuave } from './node_modules/viem/chains/suave/types'
import {TransactionRequestSuave} from './node_modules/viem/chains/suave/types';
// ...

const fundTx: TransactionRequestSuave = {
Expand Down Expand Up @@ -275,24 +276,28 @@ fund tx landed {
Now, let's set up a CCR with the appropriate parameters.

```typescript
import { TransactionRequestSuave, SuaveTxTypes } from './node_modules/viem/chains/suave/types'
import {
TransactionRequestSuave,
SuaveTxTypes,
} from './node_modules/viem/chains/suave/types';
// ...

const ccr: TransactionRequestSuave = {
confidentialInputs: '0x000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000fd7b22626c6f636b4e756d626572223a22307830222c22747873223a5b2230786638363538303064383235323038393461646263653931303332643333396338336463653834316336346566643261393232383165653664383230336538383038343032303131386164613038376337386234353663653762343234386237313565353164326465656236343031363032343832333735663130663037396663666637373934383830653731613035373366336364343133396437323037643165316235623263323365353438623061316361636533373034343739656334653939316362356130623661323930225d2c2270657263656e74223a31307d000000',
kettleAddress: '0xB5fEAfbDD752ad52Afb7e1bD2E40432A485bBB7F', // Address of your local Kettle. Use 0x03493869959C866713C33669cA118E774A30A0E5 if on Rigil.
to: '0x8f21Fdd6B4f4CacD33151777A46c122797c8BF17',
gasPrice: 10000000000n, // Gas price for the transaction
gas: 420000n, // Gas limit for the transaction
type: SuaveTxTypes.ConfidentialRequest, // Type of the SUAVE transaction
chainId: suaveRigil.id,
data: '0x236eb5a70000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000010000000000000000000000008f21fdd6b4f4cacd33151777a46c122797c8bf170000000000000000000000000000000000000000000000000000000000000000', // Data payload for the transaction
confidentialInputs:
'0x000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000fd7b22626c6f636b4e756d626572223a22307830222c22747873223a5b2230786638363538303064383235323038393461646263653931303332643333396338336463653834316336346566643261393232383165653664383230336538383038343032303131386164613038376337386234353663653762343234386237313565353164326465656236343031363032343832333735663130663037396663666637373934383830653731613035373366336364343133396437323037643165316235623263323365353438623061316361636533373034343739656334653939316362356130623661323930225d2c2270657263656e74223a31307d000000',
kettleAddress: '0xB5fEAfbDD752ad52Afb7e1bD2E40432A485bBB7F', // Address of your local Kettle. Use 0x03493869959C866713C33669cA118E774A30A0E5 if on Rigil.
to: '0x8f21Fdd6B4f4CacD33151777A46c122797c8BF17',
gasPrice: 10000000000n, // Gas price for the transaction
gas: 420000n, // Gas limit for the transaction
type: SuaveTxTypes.ConfidentialRequest, // Type of the SUAVE transaction
chainId: suaveRigil.id,
data: '0x236eb5a70000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000010000000000000000000000008f21fdd6b4f4cacd33151777a46c122797c8bf170000000000000000000000000000000000000000000000000000000000000000', // Data payload for the transaction
};
```

:::info
:::info

`confidentialInputs` is a field to store information that should be kept private during computation, and the data field is the typical calldata required to interact with a dapp.
`confidentialInputs` is a field to store information that should be kept private during computation, and the data field is the typical calldata required to interact with a dapp.

If you prefer typescript, you can see how to craft your own CCRs in the [examples directory of suave-viem](https://github.com/flashbots/suave-viem/blob/main/examples/suave-web-demo/src/suave.ts).

Expand All @@ -319,19 +324,19 @@ To fetch the latest block or transaction receipt, you can use the following func

```typescript
async function fetchBlockchainData() {
// Get the number of the latest block
const latestBlockNumber = await suaveProvider.getBlockNumber();

console.log('Block number: ', latestBlockNumber)
// Fetch the latest block
const latestBlock = await suaveProvider.getBlock({
blockNumber: latestBlockNumber,
includeTransactions: false,
});
console.log('Latest Block:', latestBlock);
// Get the number of the latest block
const latestBlockNumber = await suaveProvider.getBlockNumber();

console.log('Block number: ', latestBlockNumber);

// Fetch the latest block
const latestBlock = await suaveProvider.getBlock({
blockNumber: latestBlockNumber,
includeTransactions: false,
});

console.log('Latest Block:', latestBlock);
}

fetchBlockchainData();
```
14 changes: 7 additions & 7 deletions docs/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,43 +4,43 @@ module.exports = {
type: 'category',
label: '👋 Welcome',
collapsed: false,
link: { type: 'doc', id: 'index' },
link: {type: 'doc', id: 'index'},
items: [
'what-is-suave',
'what-to-build',
'technical/specs/rigil/glossary'
'technical/specs/rigil/glossary',
],
},
{
type: 'category',
label: '🗺️ Tutorials',
collapsed: false,
link: { type: 'doc', id: 'tutorials/index' },
link: {type: 'doc', id: 'tutorials/index'},
items: [
'tutorials/run-suave',
'tutorials/deploy-contracts',
'tutorials/send-transactions',
'tutorials/build-suapps',
'tutorials/create-precompiles'
'tutorials/create-precompiles',
]
},
{
type: 'category',
label: '🛠️ Resources',
collapsed: false,
link: { type: 'doc', id: 'resources/index' },
link: {type: 'doc', id: 'resources/index'},
items: [
'resources/rigil',
'resources/forge',
'resources/golang-sdk',
'resources/typescript-sdk'
'resources/typescript-sdk',
],
},
{
type: 'category',
label: '🤖 Technical Specs',
collapsed: false,
link: { type: 'doc', id: 'technical/README' },
link: {type: 'doc', id: 'technical/README'},
items: [
'technical/specs/rigil/README',
'technical/specs/rigil/kettle',
Expand Down
3 changes: 1 addition & 2 deletions docs/tutorials/create-precompiles.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,7 @@ type SuaveRuntime interface {

You will now need to write the logic required for your precompile to work as expected based on this generated skeleton.

Adapter code will be written into [`contracts_suave_runtime_adapter.go`](https://github.com/flashbots/suave-geth/blob/main/core/vm/contracts_suave_runtime_adapter.go), but you will need to add your method to [`suave_contracts.go`](https://github.com/flashbots/suave-geth/blob/main/core/vm/contracts_suave.go).
In our case, the logic is very simple: just a straightforward addition of the values passed in as inputs. Your implementation may be arbitrarily more complex based on what you want the precompile to achieve.
Adapter code will be written into [`contracts_suave_runtime_adapter.go`](https://github.com/flashbots/suave-geth/blob/main/core/vm/contracts_suave_runtime_adapter.go), but you will need to add your method to [`suave_contracts.go`](https://github.com/flashbots/suave-geth/blob/main/core/vm/contracts_suave.go). In our case, the logic is very simple: just a straightforward addition of the values passed in as inputs. Your implementation may be arbitrarily more complex based on what you want the precompile to achieve.

```go
func (b *suaveRuntime) Add(a uint64, b uint64) (uint64, error) {
Expand Down
Loading