Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

Commit

Permalink
Merge branch 'main' into ciara/contract-sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
ciaranightingale committed Sep 13, 2023
2 parents b8d820d + ef37834 commit e56e477
Show file tree
Hide file tree
Showing 36 changed files with 62 additions and 46 deletions.
4 changes: 2 additions & 2 deletions docs/onboarding/14 Wallet/0 Overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ These SDKs provide everything you need to create web3 apps with ease.
repoUrl="https://github.com/thirdweb-dev/js/tree/main/packages/wallets"
/>

## Popular wallets available out of the box
## Popular Wallets Available

The Wallet SDK comes out of the box with support for the most popular wallets that are ready to be used with thirdweb SDKs:

- Custodial wallets like [MetaMask](/wallet/metamask), [WalletConnect](/wallet/wallet-connect-v2), and [Coinbase Wallet](/wallet/coinbase-wallet)
- Non-custodial wallets like [Magic](/wallet/magic) and [Paper](/wallet/paper)
- Self-custodial wallets like [Magic](/wallet/magic) and [Paper](/wallet/paper)
- Multi-sig wallets like [Safe (Gnosis)](/wallet/safe)
- [ERC-4337](https://eips.ethereum.org/EIPS/eip-4337) compliant [Smart Wallet](/wallet/smart-wallet)
- [Local Wallet](/wallet/local-wallet) that allows you to create a "continue as guest" experience
Expand Down
39 changes: 39 additions & 0 deletions docs/onboarding/14 Wallet/1 Architecture.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
slug: /wallet/architecture
title: Architecture
sidebar_position: 3
---

# Architecture

The Wallet SDK allows you to create and connect wallets to your app.
It allows you to easily integrate an existing wallet providers with thirdweb's
[Typescript](/wallet/usage-with-typescript-sdk),
[React](/wallet/usage-with-react-sdk),
[React Native](/wallet/usage-with-react-native-sdk), and
[Unity](/wallet/usage-with-unity-sdk) SDKs or [create your own custom wallet connectors](/wallet/build-a-wallet).

If you are working in React, React Native, or Unity, you can use the `ConnectWallet` component to
connect & create wallets. The `ConnectWallet` component is a pre-built component which uses the Wallet SDK
under the hood. If you'd like to connect wallets in a back-end environment, or if you'd like full control on how
wallets are created or handled, you can use the Wallet SDK directly.

## Using the Wallet SDK Directly

You can use the Wallet SDK directly in any environment that supports TypeScript.
The Wallet SDK enables you to connect and create wallets which you can then use in your app to sign transactions as you usually would.
There are two main instances in which you would use the Wallet SDK directly:

1. Connecting wallets in a back-end environment such as Node.js script to sign transactions without passing a private key.
Instead, a browser popup would be initiated to sign the transaction.

2. In projects where you need low-level control of the wallet

- Example: Needing to pass custom configuration options such as specifying a custom `execute` method for `smartWallet` e.g. [in this template](https://github.com/thirdweb-example/unilogin/tree/main).

## ConnectWallet

If you are in a [React](/wallet/usage-with-react-sdk), [React Native](/wallet/usage-with-react-native-sdk), or [Unity](/wallet/usage-with-unity) environment, you can use the `ConnectWallet` component to connect & create wallets.
This component is a pre-built component which uses the Wallet SDK under the hood and works out of the box!

`ConnectWallet` has a customizable UI and allows you to connect to any of the supported wallets in the Wallet SDK. Read the [`ConnectWallet`](/react/react.connectwallet) documentation to learn more.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ To get started, install the [package](https://github.com/thirdweb-dev/js/tree/ma

<br />

Now you&rsquo;re ready to use any of our supported wallets.
Now you&rsquo;re ready to use any of our supported wallets.

```js
// 1. Import the wallet you want to use from the package
Expand Down
9 changes: 0 additions & 9 deletions docs/onboarding/14 Wallet/Architecture.mdx

This file was deleted.

2 changes: 1 addition & 1 deletion docs/onboarding/22 Web3 API/0 Overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ hide_title: true
---

:::info
Web3 API is currently in Beta. To try it out, please [contact our business team](https://thirdweb.com/contact-us).
Web3 API is currently in Open Beta and requires self-hosting. If you need a managed version, please [contact us](https://thirdweb.com/contact-us).
:::

# Overview
Expand Down
48 changes: 17 additions & 31 deletions docs/onboarding/22 Web3 API/1 Configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Tabs from "@theme/Tabs";
import TabItem from "@theme/TabItem";

:::info
Web3 API is currently in Beta. To try it out, please [contact our business team](https://thirdweb.com/contact-us).
Web3 API is currently in Open Beta and requires self-hosting. If you need a managed version, please [contact us](https://thirdweb.com/contact-us).
:::

# Configuration
Expand All @@ -19,23 +19,20 @@ Before you begin, ensure you have the following:

- [ ] Docker
- [ ] PostgreSQL
- [ ] Wallet with funds
- [ ] thirdweb secret key

## Part 1: Wallet Configuration

To use web3 API, you will need to initiate it with an admin wallet using one of the following options:
To use web3 API, you will need to initiate it with a backend wallet using one of the following options:

### Backend Wallet
### Secret Key

1. Setup a `.env` file at the root of your project’s repository
2. Set the following variables in your `.env` file:

````json
WALLET_PRIVATE_KEY=<YOUR_PRIVATE_KEY>
```
POSTGRES_CONNECTION_URL=<YOUR_CONNECTION_URL>
THIRDWEB_SDK_SECRET_KEY=<YOUR_SECRET_KEY>
```
````

### AWS KMS

Expand All @@ -50,11 +47,8 @@ Web3-API supports AWS KMS for signing & sending transactions over any EVM chain.
```json
# Required for AWS Auth
AWS_ACCESS_KEY_ID=<aws_access_key_id>
AWS_SECRET_ACCESS_KEY=<aws_secret_access_key>
AWS_SECRET_ACCESS_KEY=<aws_secret_access_key>
AWS_REGION=<aws_region>

# Required for AWS KMS Admin Wallet
AWS_KMS_KEY_ID=<kms_key_id>
```

### Google KMS
Expand All @@ -79,7 +73,6 @@ Web3-API supports Google KMS for signing & sending transactions over any EVM cha
GOOGLE_APPLICATION_PROJECT_ID=<google_project_id>
GOOGLE_KMS_KEY_RING_ID=<key_ring_id>
GOOGLE_KMS_LOCATION_ID=<location_of_key_ring>
GOOGLE_KMS_CRYPTO_KEY_ID=<kms_key_id> # If created on Google Console
```

## Part 2: Server Configuration
Expand All @@ -91,40 +84,33 @@ While in beta, Web3 API only offers self-hosted options. To use Web3 API, you wi
To host your own server with Docker:

1. [Install Docker](https://docs.docker.com/get-docker/)
2. Add the following variables to your `.env` file at the root of your repository:

```

# DEFAULT DOCKER
POSTGRES_HOST=host.docker.internal
POSTGRES_DATABASE_NAME=postgres
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
```

3. To obtain the Postgres Docker Image, navigate to the root of your project and run the following command in your command line:
2. To obtain the Postgres Docker Image, navigate to the root of your project and run the following command in your command line:

```python
docker run --env-file ./.env -p 5432:5432 --name my-local-postgres -d postgres
```

4. Afterwards, to get the Web3 API Docker Image, navigate to the root of your project and run the following command in your command line:
3. Afterwards, to get the Web3 API Docker Image, navigate to the root of your project and run the following command in your command line:

```
docker run --env-file ./.env -p 3005:3005 --name web3-api thirdweb/web3-api:nightly
docker run --env-file ./.env -p 3005:3005 --name web3-api thirdweb/web3-api:latest
```

5. To authenticate, open `localhost:3005` in your browser.
6. Select the `Authorize` option on the dashboard.
:::info
For different versions, please see our [Docker Hub](https://hub.docker.com/r/thirdweb/web3-api) page.
:::

4. To authenticate, open `localhost:3005` in your browser.
5. Select the `Authorize` option on the dashboard.

![Screenshot of how to authorize via Swagger](./assets/authorize-api.png)

7. Pass in your corresponding secret key created from the thirdweb dashboard and select Authorize.
6. Pass in your corresponding secret key created from the thirdweb dashboard and select Authorize.

![Screenshot of passing in Bearer auth field](./assets/authorize-bearer.png)

8. You are now ready to begin developing using APIs. To see a demonstration of endpoints, please visit the `Get Started` tutorial.
7. You are now ready to begin developing using APIs. To see a demonstration of endpoints, please visit the `Get Started` tutorial.

### Authorization Header

Expand Down
2 changes: 1 addition & 1 deletion docs/onboarding/22 Web3 API/2 Get Started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ hide_title: true
---

:::info
Web3 API is currently in Beta. To try it out, please [contact our business team](https://thirdweb.com/contact-us).
Web3 API is currently in Open Beta and requires self-hosting. If you need a managed version, please [contact us](https://thirdweb.com/contact-us).
:::

# Get Started
Expand Down
2 changes: 1 addition & 1 deletion docs/onboarding/22 Web3 API/3 References.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ hide_title: true
---

:::info
Web3 API is currently in Beta. To try it out, please [contact our business team](https://thirdweb.com/contact-us).
Web3 API is currently in Open Beta and requires self-hosting. If you need a managed version, please [contact us](https://thirdweb.com/contact-us).
:::

### References
Expand Down

0 comments on commit e56e477

Please sign in to comment.