From 21925e4e49ec350cc96ff22aa0a68cc549e8d101 Mon Sep 17 00:00:00 2001
From: brock smedley <2791467+zeroXbrock@users.noreply.github.com>
Date: Wed, 20 Mar 2024 12:51:30 -0700
Subject: [PATCH] update suave-viem code examples (#104)
* update suave-viem code examples
* fix invalid code block language
---
docs/tools/typescript-sdk.mdx | 24 ++++++------------------
1 file changed, 6 insertions(+), 18 deletions(-)
diff --git a/docs/tools/typescript-sdk.mdx b/docs/tools/typescript-sdk.mdx
index 5d683c6f..3cf33686 100644
--- a/docs/tools/typescript-sdk.mdx
+++ b/docs/tools/typescript-sdk.mdx
@@ -14,36 +14,26 @@ Sending Confidential Compute Requests works slightly differently, but most other
:::
-This page describes how to work with the SUAVE-viem TypeScript SDK. The SDK simplifies interaction with the SUAVE Chain and provides easy-to-use functions to send transactions and query data. Below, you'll find steps on how to instantiate the library, symlink, and perform some basic actions.
+This page describes how to work with the SUAVE-viem TypeScript SDK. The SDK simplifies interaction with the SUAVE Chain and provides easy-to-use functions to send transactions and query data. Below, you'll find steps on how to install the library and perform some basic actions.
## Installation
The [`@flashbots/suave-viem`](https://www.npmjs.com/package/@flashbots/suave-viem) package is available on NPM, and can be installed with any NPM-based package manager, such as **npm**, **yarn**, or **bun**.
-:::warning
-
-Alpha Release Version
-
-Note: you must use the following reference when importing, or else your project won't import the required types. This is a temporary measure while we fix the tests that are failing in CI, which prevents a full release.
-
-`@flashbots/suave-viem@main`
-
-:::
-
```bash
- npm i @flashbots/suave-viem@main
+ npm i @flashbots/suave-viem
```
```bash
- yarn add @flashbots/suave-viem@main
+ yarn add @flashbots/suave-viem
```
```bash
- bun add @flashbots/suave-viem@main
+ bun add @flashbots/suave-viem
```
@@ -129,7 +119,6 @@ First, instantiate a new wallet of your own, and fetch the current gas price fro
```typescript
const PRIVATE_KEY: Hex = '';
-const gasPrice = await publicClients.suaveLocal.getGasPrice();
const wallet = getSuaveWallet({
transport: http(SUAVE_RPC_URL),
@@ -148,8 +137,7 @@ import {TransactionRequestSuave} from '@flashbots/suave-viem/chains/suave/types'
const fundTx: TransactionRequestSuave = {
type: '0x0',
value: 100000000000000001n,
- gasPrice: gasPrice + 1000000000n,
- chainId: suaveRigil.id,
+ gasPrice: 10000000000n, // 10 gwei is typically fine for testing
to: wallet.account.address,
gas: 21000n,
};
@@ -181,7 +169,7 @@ while (true) {
If you once again run `bun run index.ts`, you should see something like the following logged to your terminal:
-```bash
+```txt
sent fund tx 0xe6f7385c6992c91941fe10e43feaf987cb4377f302915945b747fcb0e0a7f40a
formatting tx receipt
fund tx landed {