This repository has been archived by the owner on Jan 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
146 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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’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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"]} | ||
/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters