Skip to content

Commit

Permalink
Clarify some of the steps for users
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonVranek committed May 24, 2024
1 parent ab84b71 commit d9dd15a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
4 changes: 3 additions & 1 deletion docs/docs/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,13 @@ const [walletAddress] = await pufferClient.requestAddresses();

### 3. Interact with the Contract

Mint pufETH to your `walletAddress` or set a target recipient:

```ts
const { transact, estimate } = pufferClient.depositETH(walletAddress);

// Returns gas estimate of the transaction.
const gasEstimate = await estimate();
// Execute the transaction for depositing ETH.
const address = await transact(new BigInt(1));
const txHash = await transact(new BigInt(1e18));
```
24 changes: 19 additions & 5 deletions docs/docs/guides/depositing-eth.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ sidebar_position: 1

# Depositing ETH

Using the Puffer SDK to deposit ETH is simple. First, setup the `PufferClient`.
Using the Puffer SDK to mint pufETH is simple. First, setup the `PufferClient`.

```ts
import {
Expand All @@ -20,21 +20,35 @@ const walletClient = PufferClientHelpers.createWalletClient({
const pufferClient = new PufferClient(Chain.Holesky, walletClient);
```

Then connect to the wallet or use an existing wallet address.
Then connect to the wallet to fetch your address.

```ts
const [walletAddress] = await pufferClient.requestAddresses();
```

With the wallet address at hand, make the transacation.
With your address at hand, make the transaction to deposit ETH to mint pufETH.

```ts
const { transact, estimate } = pufferClient.depositETH(walletAddress);

const ethValue = new BigInt(1);
const weiAmount = new BigInt(1e18);

// Returns gas estimate of the transaction.
const gasEstimate = await estimate();
// Execute the transaction for depositing ETH.
const address = await transact(ethValue);
const txHash = await transact(weiAmount);
```


Alternatively, you can set the pufETH recipient to a different address.

```ts
const { transact, estimate } = pufferClient.depositETH(recipientAddress);

const weiAmount = new BigInt(1e18);

// Returns gas estimate of the transaction.
const gasEstimate = await estimate();
// Execute the transaction for depositing ETH.
const txHash = await transact(weiAmount);
```

0 comments on commit d9dd15a

Please sign in to comment.