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

Commit

Permalink
merge main
Browse files Browse the repository at this point in the history
  • Loading branch information
ciaranightingale committed Sep 15, 2023
2 parents 9298a84 + 9b9aa53 commit 7c1fda1
Show file tree
Hide file tree
Showing 10 changed files with 146 additions and 56 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ npx thirdweb create contract
[Deploy](/deploy) your contract using the deploy cli command:

```bash
npx thirdweb create
npx thirdweb deploy
```

Or import the contract into your existing project and inherit from it.
Expand Down
2 changes: 1 addition & 1 deletion docs/onboarding/23 Smart Wallet/3 Getting Started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Deployable via the [explore page](https://thirdweb.com/explore/smart-wallet) or

Choose the right smart wallet setup for your app. thirdweb offers the following three different kinds of smart wallets:

| | [`Account`](/solidity/base-contracts/account) setup | [`DynamicAccount`](/solidity/base-contracts/dynamic-account) setup | [`ManagedAccount`](/solidity/base-contracts/managed-account) setup |
| | [`Account`](https://thirdweb.com/thirdweb.eth/AccountFactory) setup | [`DynamicAccount`](https://thirdweb.com/thirdweb.eth/DynamicAccountFactory) setup | [`ManagedAccount`](https://thirdweb.com/thirdweb.eth/ManagedAccountFactory) setup |
| ------------------ | --------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Upgradeability** | Non-upgradeable | Account upgrades controlled locally by account admin. | Account upgrades controlled centrally by account factory admin. |
| **User persona** | Developer wants to issue simple smart wallets to their users. They do not anticipate that users wallets will need any feature upgrades. | Developer wants to issue smart wallets to their users. They do anticipate feature upgrades to user wallets but do not want to push upgrades to user wallets without consent. | Developer wants to issue smart wallets to their users. They do anticipate feature upgrades to user wallets, and want to push upgrades to user wallets for seamless/invisible UX for upgrades. |
Expand Down
29 changes: 18 additions & 11 deletions docs/onboarding/3 EVM SDK/0 Overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,28 @@ title: Overview

import SupportedLanguagesSection from "@components/SupportedLanguagesSection";

# SDK
# Contract SDK

The SDK covers all aspects of the web3 development stack, including connecting to user’s wallets,
interacting with the blockchain and smart contracts, decentralized storage, authentication, and more;
enabling you to build scalable and performant web3 applications on any EVM-compatible blockchain.
The Contract SDK functions as a comprehensive interface for interacting with contracts
across all EVM-compatible blockchain networks.
Created to be versatile, this SDK offers intuitive tools for constructing web and mobile applications,
games, and scripts with blockchain connectivity.

Out of the box, infrastructure is provided for everything required to create decentralized applications, including
connection to the blockchain ([RPC](/glossary/rpc)), decentralized storage ([IPFS](/glossary/ipfs) + pinning services),
and tools to create powerful user experiences; such as [gasless transactions](/glossary/gasless-transactions), [wallet](/wallet) connection components, FIAT on-ramps, data APIs, and more.
The Contract SDK removes the need to manage complex, repetitive logic,
allowing developers to focus on the unique features and functionalities of their applications.

The SDK is fully composable, meaning you can provide your own
configuration for any component of your application and customize the SDK to your needs. In addition, each SDK is
completely [open-source](https://github.com/orgs/thirdweb-dev/repositories) for you to verify and audit what’s happening under the hood.
## Features

Depending on your use case, we support a variety of languages and frameworks to help build your apps and games.
- **Extension-Driven Framework**: The SDK uses an extension-driven approach, automatically recognizing and enabling functionality based on common standards that your contract implements like [ERC20](/solidity/extensions/erc20), [ERC721](/solidity/extensions/erc721), and [ERC1155](/solidity/extensions/erc1155). The full list of extensions can be found in the [Solidity documentation](/solidity/extensions).
- **Multi-Lingual Support**: SDKs for Unity, TypeScript, React, Python, and GO.
- **Any EVM Compatibility**: Designed to operate with any EVM-compatible network.
- **Cross-Platform Integration**: Suitable for web, mobile, gaming applications and scripting.
- **High-Level Abstractions**: Simplifies complex contract interactions into easy-to-use APIs.
- **Flexibility and No Vendor Lock-in**: The SDK is modular and composible enabling customizations and replacements of the default settings and tools.

The Contract SDK is a scalable and straightforward avenue for integrating smart contract functionalities across multiple platforms and languages.

## Supported Languages

<SupportedLanguagesSection
languages={["React", "React Native", "TypeScript", "Python", "Go", "Unity"]}
Expand Down
53 changes: 29 additions & 24 deletions docs/onboarding/3 EVM SDK/1 How it works.mdx
Original file line number Diff line number Diff line change
@@ -1,38 +1,43 @@
---
slug: /sdk/how-it-works
title: Contract-driven development
title: Architecture
---

# SDK Architecture
# Architecture

The SDK covers the full spectrum of decentralized application development, from the blockchain connection to the user interface.
To enable customization and flexibility, the SDK is architected to be modular and composable,
allowing you to provide any custom configurations or integrations with other services and tools to replace or enhance the default functionality.
The Contract SDK streamlines decentralized application development by managing everything from
blockchain connections to user interfaces.
The design is modular and highly composable,
offering a mix of default settings and customization options to suit your project's unique requirements best.

## Contract-driven Framework
## Extension-Driven Framework

When using the SDK to interact with smart contracts, the SDK uses a **contract-driven** framework; meaning the SDK detects common standards and patterns
such as ERC20, ERC721, ERC1155, permissions, and more, by resolving the smart contract [ABI](https://docs.soliditylang.org/en/v0.8.19/abi-spec.html) and
extracting the standards the contract implements; known as [extensions](/solidity).
The Contract SDK has an **extension-driven**, contract-centric architecture.
This allows the SDK to automatically identify and enable functionalities based on
common contract standards such as ERC20, ERC721, and ERC1155.
This is achieved by resolving the smart contract's ABI and extracting the implemented standards; known as extensions.

Each detected extension unlocks functionality in the SDK for you to use; enabling sets of methods and components
to be used in the language of your choice to interact directly with the smart contract.
**Each detected extension unlocks functionality in the SDK for you to use**;
enabling sets of methods and components to be used in the language of your choice to interact directly with the smart contract.

Our ecosystem of tools such as our [dashboard](/dashboard) and [import](https://thirdweb.com/dashboard/contracts) feature make using smart contracts simpler and more efficient.
Connecting to a smart contract just requires the contract address, (no ABI), and are resolved from our on-chain registry of smart contracts automatically. Each contract&rsquo;s information
is automatically cached by the SDK, so your operations to read and write data to the smart contract are fast and efficient.
## No ABI Required

## Batteries Included
Our ecosystem of tools such as our [dashboard](/dashboard) and [import](/dashboard/import) feature make using smart contracts simpler and more efficient.
Connecting to a smart contract just requires the contract address, (no ABI), and is resolved from our on-chain registry of smart contracts automatically.
Each contract’s information is automatically cached by the SDK,
so your operations to read and write data to the smart contract are fast and efficient.

Out of the box, infrastructure to power the essential components of decentralized applications is included in the SDK.
Connection to the blockchain via RPC, IPFS pinning service and gateways, elegant wallet onboarding flow, gasless relayers, FIAT on-ramps,
and more are pre-configured by default, with easy configuration to customize to your needs.
## Infrastructure

All of our offerings work together seamlessly, allowing you to build performant decentralized applications without sacrificing
your developer experience.
The SDK comes **pre-configured with essential infrastructure** to create decentralized applications.
These include blockchain RPC connections, IPFS pinning services, wallet onboarding flows,
gasless relayers, FIAT on-ramps, and more.
These defaults are designed to streamline the developer experience to build performant and scalable applications,
they can also be customized to fit the requirements of a project.

## No Vendor Lock-in
## Flexibility and No Vendor Lock-In

All aspects of the SDK are modular and composable, allowing you to customize any part of our tooling to your needs, or integrate
with other services for specific use cases. Whether you want to provide your own RPC, use a different wallet connection flow,
provide your own decentralized storage solution, or use a different gasless relayer, you can do so with ease.
All components of the SDK are **modular and customizable**,
offering the flexibility to adapt the tooling to specific needs or to integrate
with alternative services for unique use cases. This enables custom RPC providers,
wallet connection flows, decentralized storage solutions, or gasless relayers as needed.
73 changes: 73 additions & 0 deletions docs/onboarding/3 EVM SDK/2 Getting Started.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
---
slug: /sdk/getting-started
title: Getting Started
---

import SupportedLanguagesSection from "@components/SupportedLanguagesSection";
import Tabs from "@theme/Tabs";
import TabItem from "@theme/TabItem";
import CodeBlock from "@theme/CodeBlock";

# Getting Started

To get started using the Contract SDK to interact with contracts, there are two options:

1. Create a new project with the [CLI](/cli/create) which automatically sets up the relevant package(s).
2. Add to an existing project by [installing](/cli/install) the relevant package(s).

## 1. Create a New Project

To create a new project, use the thirdweb [`create`](/cli/create) command to setup a front-end or scripting project and install the required dependencies:

<Tabs>
<TabItem value="next" label="Next.js" default>
<CodeBlock language="bash">{`npx thirdweb create --next`}</CodeBlock>
</TabItem>
<TabItem value="vite" label="Vite" default>
<CodeBlock language="bash">{`npx thirdweb create --vite`}</CodeBlock>
</TabItem>
<TabItem value="react-app" label="React App" default>
<CodeBlock language="bash">{`npx thirdweb create --cra`}</CodeBlock>
</TabItem>
<TabItem value="react-native" label="React Native" default>
<CodeBlock language="bash">{`npx thirdweb create --reactNative`}</CodeBlock>
</TabItem>
<TabItem value="node" label="Node" default>
<CodeBlock language="bash">{`npx thirdweb create --node`}</CodeBlock>
</TabItem>
<TabItem value="express" label="Express" default>
<CodeBlock language="bash">{`npx thirdweb create --express`}</CodeBlock>
</TabItem>
</Tabs>

## 2. Add to an Existing Project

To add to an existing project, install the relevant package(s) and import into the desired files. For example, to install the [React](/react) and [TypeScript SDKs](/typescript), run the following command:

<Tabs>
<TabItem value="npm" label="npm" default>
<CodeBlock language="bash">{`npm i @thirdweb-dev/react @thirdweb-dev/sdk`}</CodeBlock>
</TabItem>
<TabItem value="yarn" label="yarn">
<CodeBlock language="bash">{`yarn add @thirdweb-dev/react @thirdweb-dev/sdk`}</CodeBlock>
</TabItem>
<TabItem value="pnpm" label="pnpm">
<CodeBlock language="bash">{`pnpm i @thirdweb-dev/react @thirdweb-dev/sdk`}</CodeBlock>
</TabItem>
</Tabs>

Then, you can import the relevant hooks and functions, e.g. the `useContract` hook, which you need to install from the React SDK:

```tsx
import { useContract } from "@thirdweb-dev/react";
```

For more information on how to get started using each of the SDKs, see the [full references](#full-reference).

## Full Reference

How and what can be done with the SDKs depends on the required language. The same base set of functionality is included but consult the full references:

<SupportedLanguagesSection
languages={["React", "React Native", "TypeScript", "Python", "Go", "Unity"]}
/>
4 changes: 2 additions & 2 deletions docs/react/storage/usestorage.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ You will require an API key to use thirdweb’s storage services with the SDK. I
You can then obtain a `clientId` from the API key which you will need to pass to the [`ThirdwebProvider`](/react/react.thirdwebprovider) component:

```jsx
import { ThirdwebProvider } from "@thirdweb/react";
import { ThirdwebProvider } from "@thirdweb-dev/react";

const App = () => {
return (
Expand All @@ -31,7 +31,7 @@ Configurable in the [`storageInterface`](/react/react.thirdwebprovider#storagein
The hook returns a [`ThirdwebStorage`](/typescript/storage) instance. View the [TypeScript Storage](/typescript/storage) documentation for more information.

```jsx
import { useStorage } from "@thirdweb/react";
import { useStorage } from "@thirdweb-dev/react";
```

## Usage
Expand Down
8 changes: 5 additions & 3 deletions docs/unity/interacting-with-contracts/write.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ The call will be awaited until the transaction is mined and the transaction rece
## Usage

```csharp
var data = await contract.Write("functionName");
TransactionResult result = await contract.Write("functionName");
```

## Configuration
Expand All @@ -33,7 +33,7 @@ Optional transaction overrides to change parameters like `value` or `gasLimit`.
Must be of type `TransactionRequest`

```csharp
var data = await contract.Write("functionName", new TransactionRequest() { value = "100000" });
TransactionResult result = await contract.Write("functionName", new TransactionRequest() { value = "100000", gasLimit = "100000" });
```

### args
Expand All @@ -43,5 +43,7 @@ The arguments to the function/variable, in the same order they are on your smart
If you provide too few or too many arguments, the function will throw an error.

```csharp
var data = await contract.Write("functionName", arg1, arg2, ...);
BigInteger arg1 = 1234;
string arg2 = "hello world";
TransactionResult result = await contract.Write("functionName", arg1, arg2, ...);
```
12 changes: 6 additions & 6 deletions sidebars/onboarding.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,7 @@ const sidebars = {
},
{
type: "link",
label: "Contract SDKs",
href: "/sdk",
},
{
type: "link",
label: "SDKs",
label: "Contract SDK",
href: "/sdk",
},
{
Expand Down Expand Up @@ -255,6 +250,11 @@ const sidebars = {
label: "Architecture",
id: "3 EVM SDK/1 How it works",
},
{
type: "doc",
label: "Getting Started",
id: "3 EVM SDK/2 Getting Started",
},
{
type: "category",
label: "SDK References",
Expand Down
3 changes: 1 addition & 2 deletions src/theme/DocSidebarItem/Link/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ export const iconMapping = {
Deploy: "/assets/product/deploy.png",
Publish: "/assets/product/publish.png",
SDK: "/assets/product/sdk.png",
"Contract SDKs": "/assets/product/sdk.png",
SDKs: "/assets/product/sdk.png",
"Contract SDK": "/assets/product/sdk.png",
"Solana SDK": "/assets/product/sdk.png",
Solana: "/assets/product/sdk.png",
"Wallet SDK": "/assets/product/wallet.png",
Expand Down
16 changes: 10 additions & 6 deletions src/theme/DocSidebarItems/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function DocSidebarItems({ items, ...props }) {
{
title: "Contracts",
items: [
"Contract SDKs",
"Contract SDK",
"Pre-Built Contracts",
"Solidity SDK",
"Deploy",
Expand All @@ -57,7 +57,7 @@ function DocSidebarItems({ items, ...props }) {
},
{
title: "Tools",
items: ["CLI", "Dashboard", "SDKs", "Web3 API"],
items: ["CLI", "Dashboard", "Web3 API"],
},
{
title: "SDK References",
Expand Down Expand Up @@ -86,11 +86,15 @@ function DocSidebarItems({ items, ...props }) {
name.split("/")[1].charAt(0).toUpperCase() + name.split("/")[1].slice(1);

if (formatted === "Sdk") {
return "SDK";
return "Contract SDK";
}

if (formatted === "Pre-built-contracts") {
return "Explore";
return "Pre-Built Contracts";
}

if (formatted === "Web3-api") {
return "Web3 API";
}

if (formatted === "Ui-components") {
Expand All @@ -105,8 +109,8 @@ function DocSidebarItems({ items, ...props }) {
return "CommerceKit";
}

if (formatted === "Wallet" || formatted === "Wallets") {
return "Wallet";
if (formatted === "Wallet") {
return "Wallet SDK";
}

if (formatted === "Typescript") {
Expand Down

0 comments on commit 7c1fda1

Please sign in to comment.