Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0f54e99141 | ||
|
|
c701c388c6 | ||
|
|
328ef5dc9c | ||
|
|
07fbb799be | ||
|
|
699f31c20a | ||
|
|
c97e51b855 | ||
|
|
e10173bf8a | ||
|
|
dbfa73d75a | ||
|
|
1b1212d9fb | ||
|
|
065f85bf71 | ||
|
|
09bafa9aeb | ||
|
|
fe30c88cc3 | ||
|
|
3a9538259c | ||
|
|
0c730e57e0 | ||
|
|
33c9f6b1ab | ||
|
|
2346396bdf | ||
|
|
de5ebc9093 | ||
|
|
42c4c33d30 | ||
|
|
046603ac54 | ||
|
|
bcfa9463bb |
@@ -1,5 +1,26 @@
|
||||
# @thirdweb-dev/auth
|
||||
|
||||
## 4.1.18
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies []:
|
||||
- @thirdweb-dev/wallets@2.3.1
|
||||
|
||||
## 4.1.17
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`33c9f6b1`](https://github.com/thirdweb-dev/js/commit/33c9f6b1ab3e65187b2c49c083412d39a1334bba), [`de5ebc90`](https://github.com/thirdweb-dev/js/commit/de5ebc9093aaf5fc08bc0d2d414138b520fe17fe), [`e10173bf`](https://github.com/thirdweb-dev/js/commit/e10173bf8aeaaabdb45231109b4da0c52c91b9da), [`09bafa9a`](https://github.com/thirdweb-dev/js/commit/09bafa9aebadb01641214747148c67d0b39c1275)]:
|
||||
- @thirdweb-dev/wallets@2.3.0
|
||||
|
||||
## 4.1.16
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies []:
|
||||
- @thirdweb-dev/wallets@2.2.1
|
||||
|
||||
## 4.1.15
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/auth",
|
||||
"version": "4.1.15",
|
||||
"version": "4.1.18",
|
||||
"main": "dist/thirdweb-dev-auth.cjs.js",
|
||||
"module": "dist/thirdweb-dev-auth.esm.js",
|
||||
"browser": {
|
||||
|
||||
@@ -1,5 +1,31 @@
|
||||
# thirdweb
|
||||
|
||||
## 0.13.26
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`c701c388`](https://github.com/thirdweb-dev/js/commit/c701c388c65a1e531b88991d8fd67d25f153992e)]:
|
||||
- @thirdweb-dev/sdk@4.0.22
|
||||
- @thirdweb-dev/wallets@2.3.1
|
||||
- @thirdweb-dev/auth@4.1.18
|
||||
|
||||
## 0.13.25
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`33c9f6b1`](https://github.com/thirdweb-dev/js/commit/33c9f6b1ab3e65187b2c49c083412d39a1334bba), [`de5ebc90`](https://github.com/thirdweb-dev/js/commit/de5ebc9093aaf5fc08bc0d2d414138b520fe17fe), [`e10173bf`](https://github.com/thirdweb-dev/js/commit/e10173bf8aeaaabdb45231109b4da0c52c91b9da), [`09bafa9a`](https://github.com/thirdweb-dev/js/commit/09bafa9aebadb01641214747148c67d0b39c1275)]:
|
||||
- @thirdweb-dev/wallets@2.3.0
|
||||
- @thirdweb-dev/auth@4.1.17
|
||||
|
||||
## 0.13.24
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`bcfa9463`](https://github.com/thirdweb-dev/js/commit/bcfa9463bbae6bf1d3b6389b7a141f65ef3e1173)]:
|
||||
- @thirdweb-dev/sdk@4.0.21
|
||||
- @thirdweb-dev/wallets@2.2.1
|
||||
- @thirdweb-dev/auth@4.1.16
|
||||
|
||||
## 0.13.23
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "thirdweb",
|
||||
"main": "dist/cli/index.js",
|
||||
"version": "0.13.23",
|
||||
"version": "0.13.26",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/cli",
|
||||
"author": "thirdweb eng <[email protected]>",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@@ -1,5 +1,33 @@
|
||||
# @thirdweb-dev/react-core
|
||||
|
||||
## 4.1.16
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#2082](https://github.com/thirdweb-dev/js/pull/2082) [`699f31c2`](https://github.com/thirdweb-dev/js/commit/699f31c20a76cd284dbed1629c4a19d93aca7b7f) Thanks [@iketw](https://github.com/iketw)! - Better comments
|
||||
|
||||
- Updated dependencies [[`c701c388`](https://github.com/thirdweb-dev/js/commit/c701c388c65a1e531b88991d8fd67d25f153992e)]:
|
||||
- @thirdweb-dev/sdk@4.0.22
|
||||
- @thirdweb-dev/wallets@2.3.1
|
||||
- @thirdweb-dev/auth@4.1.18
|
||||
|
||||
## 4.1.15
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`33c9f6b1`](https://github.com/thirdweb-dev/js/commit/33c9f6b1ab3e65187b2c49c083412d39a1334bba), [`de5ebc90`](https://github.com/thirdweb-dev/js/commit/de5ebc9093aaf5fc08bc0d2d414138b520fe17fe), [`e10173bf`](https://github.com/thirdweb-dev/js/commit/e10173bf8aeaaabdb45231109b4da0c52c91b9da), [`09bafa9a`](https://github.com/thirdweb-dev/js/commit/09bafa9aebadb01641214747148c67d0b39c1275)]:
|
||||
- @thirdweb-dev/wallets@2.3.0
|
||||
- @thirdweb-dev/auth@4.1.17
|
||||
|
||||
## 4.1.14
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`bcfa9463`](https://github.com/thirdweb-dev/js/commit/bcfa9463bbae6bf1d3b6389b7a141f65ef3e1173)]:
|
||||
- @thirdweb-dev/sdk@4.0.21
|
||||
- @thirdweb-dev/wallets@2.2.1
|
||||
- @thirdweb-dev/auth@4.1.16
|
||||
|
||||
## 4.1.13
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/react-core",
|
||||
"version": "4.1.13",
|
||||
"version": "4.1.16",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-core",
|
||||
"author": "thirdweb eng <[email protected]>",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@@ -84,11 +84,10 @@ export interface ThirdwebProviderCoreProps<TChains extends Chain[]>
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const ThirdwebProviderCore = <TChains extends Chain[]>({
|
||||
createWalletStorage = createAsyncLocalStorage,
|
||||
...props
|
||||
}: React.PropsWithChildren<ThirdwebProviderCoreProps<TChains>>) => {
|
||||
const { activeChain } = props;
|
||||
export const ThirdwebProviderCore = <TChains extends Chain[]>(
|
||||
props: React.PropsWithChildren<ThirdwebProviderCoreProps<TChains>>,
|
||||
) => {
|
||||
const { activeChain, createWalletStorage = createAsyncLocalStorage } = props;
|
||||
|
||||
const supportedChains = (props.supportedChains || defaultChains) as Chain[];
|
||||
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
import { createContext, useContext } from "react";
|
||||
|
||||
/**
|
||||
* Secure storage interface for storing auth tokens.
|
||||
*
|
||||
* The implementation of this interface should provide a secure way to store values. Either by encrypting the values or by storing them in a secure location.
|
||||
*/
|
||||
export interface ISecureStorage {
|
||||
getItem(key: string): Promise<string | null>;
|
||||
setItem(key: string, value: string): Promise<void>;
|
||||
@@ -7,7 +12,7 @@ export interface ISecureStorage {
|
||||
}
|
||||
|
||||
/**
|
||||
* The configuration to use the react SDK with an [auth](https://portal.thirdweb.com/auth) server.
|
||||
* The configuration to use by the React and React Native SDKs with an [auth](https://portal.thirdweb.com/auth) server.
|
||||
*
|
||||
*/
|
||||
export interface ThirdwebAuthConfig {
|
||||
|
||||
@@ -12,8 +12,33 @@ import { AUTH_TOKEN_STORAGE_KEY } from "../../../core/constants/auth";
|
||||
*
|
||||
* @returns - A function to invoke to login with the connected wallet, and an isLoading state.
|
||||
*
|
||||
* @see {@link https://portal.thirdweb.com/react/react.uselogin?utm_source=sdk | Documentation}
|
||||
* @example
|
||||
* ```tsx
|
||||
* function App() {
|
||||
* const { isLoading, login } = useLogin();
|
||||
*
|
||||
* return (
|
||||
* <button onClick={() => login()}>
|
||||
* {isLoading ? "Loading..." : "Sign in with Ethereum"}
|
||||
* </button>
|
||||
* );
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* ```tsx
|
||||
* // options
|
||||
* login({
|
||||
* domain: "https://your-domain.com", // Your dapp domain
|
||||
* statement: "My statement", // Text that the user will sign
|
||||
* uri: "https://your-domain.com/login", // RFC 3986 URI referring to the resource that is the subject of the signing
|
||||
* version: "1.0", // The current version of the message, which MUST be 1 for this specification.
|
||||
* chainId: "mainnet", // Chain ID to which the session is bound
|
||||
* nonce: "my-nonce", // randomized token typically used to prevent replay attacks
|
||||
* expirationTime: new Date(2021, 1, 1), // When this message expires
|
||||
* invalidBefore: new Date(2020, 12, 1), // When this message becomes valid
|
||||
* resources: ["balance", "history", "info"], // A list of information or references to information the user wishes to have resolved
|
||||
* })
|
||||
* ```
|
||||
*/
|
||||
export function useLogin() {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
@@ -10,8 +10,18 @@ import invariant from "tiny-invariant";
|
||||
*
|
||||
* @returns - A function to invoke to logout.
|
||||
*
|
||||
* @see {@link https://portal.thirdweb.com/react/react.uselogout?utm_source=sdk | Documentation}
|
||||
* @example
|
||||
* ```tsx
|
||||
* function App() {
|
||||
* const { logout, isLoading } = useLogout();
|
||||
*
|
||||
* return (
|
||||
* <button onClick={() => logout()}>
|
||||
* {isLoading ? "Logging out..." : "Logout"}
|
||||
* </button>
|
||||
* );
|
||||
*}
|
||||
* ```
|
||||
*/
|
||||
export function useLogout() {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
@@ -16,9 +16,23 @@ export interface UserWithData<
|
||||
* Hook to get the currently logged in user.
|
||||
*
|
||||
* @returns - The currently logged in user or null if not logged in, as well as a loading state.
|
||||
* ```tsx
|
||||
* {
|
||||
* user: {
|
||||
* address: string;
|
||||
* session?: Json;
|
||||
* } | undefined;
|
||||
* isLoggedIn: boolean;
|
||||
* isLoading: boolean;
|
||||
*}
|
||||
* ```
|
||||
*
|
||||
* @see {@link https://portal.thirdweb.com/react/react.useuser?utm_source=sdk | Documentation}
|
||||
*
|
||||
* @example
|
||||
* ```tsx
|
||||
* function App() {
|
||||
* const { user, isLoggedIn, isLoading } = useUser();
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
export function useUser<
|
||||
TData extends Json = Json,
|
||||
|
||||
@@ -1,9 +1,27 @@
|
||||
import { useSDK } from "../useSDK";
|
||||
|
||||
/**
|
||||
* Get the configured `ThirdwebStorage` instance
|
||||
* Get the configured `ThirdwebStorage` instance in the `ThirdwebProvider`.
|
||||
*
|
||||
* @returns The `storageInterface` configured on the `ThirdwebProvider`
|
||||
* @see {@link https://portal.thirdweb.com/react/react.usestorage?utm_source=sdk | Documentation}
|
||||
*
|
||||
* @example
|
||||
* ```tsx
|
||||
* const storage = useStorage();
|
||||
*
|
||||
* cost resp = storage?.download("ipfs-url"); // Download a file from IPFS
|
||||
* if (resp.ok) {
|
||||
* const value = await resp?.json();
|
||||
* }
|
||||
*
|
||||
* const fileIpfsHash = await storage?.upload({
|
||||
* name: 'file1',
|
||||
* type: 'file-mime-type',
|
||||
* uri: 'file-uri-on-device',
|
||||
* }); // Upload a file to IPFS
|
||||
* const objIpfsHash = await storage?.upload({key: 'value'}); // Upload an object to IPFS
|
||||
* const strIpfsHash = await storage?.upload('string-to-upload'); // Upload a string to IPFS
|
||||
* ```
|
||||
*/
|
||||
export function useStorage() {
|
||||
const sdk = useSDK();
|
||||
|
||||
@@ -3,9 +3,7 @@ import type {
|
||||
AirdropInput,
|
||||
Amount,
|
||||
Erc721,
|
||||
Erc721Mintable,
|
||||
Erc1155,
|
||||
Erc1155Mintable,
|
||||
ListingType,
|
||||
NFTMetadataInput,
|
||||
Price,
|
||||
@@ -150,9 +148,9 @@ export type MintNFTParams = {
|
||||
*
|
||||
*/
|
||||
export type MintNFTReturnType<TContract> = TContract extends Erc721
|
||||
? Awaited<ReturnType<Erc721Mintable["to"]>>
|
||||
? Awaited<ReturnType<Erc721["mintTo"]>>
|
||||
: TContract extends Erc1155
|
||||
? Awaited<ReturnType<Erc1155Mintable["to"]>>
|
||||
? Awaited<ReturnType<Erc1155["mintTo"]>>
|
||||
: never;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# @thirdweb-dev/react-native-compat
|
||||
|
||||
## 0.5.1
|
||||
|
||||
## 0.5.0
|
||||
|
||||
## 0.4.14
|
||||
|
||||
## 0.4.13
|
||||
|
||||
## 0.4.12
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/react-native-compat",
|
||||
"description": "Shims for Thirdweb in React Native Projects",
|
||||
"version": "0.4.13",
|
||||
"version": "0.5.1",
|
||||
"author": "thirdweb eng <[email protected]>",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-native-compat",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@@ -1,5 +1,61 @@
|
||||
# @thirdweb-dev/react-native
|
||||
|
||||
## 0.5.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#2074](https://github.com/thirdweb-dev/js/pull/2074) [`07fbb799`](https://github.com/thirdweb-dev/js/commit/07fbb799be87c1c5229ae3183fa8bc67ae15c756) Thanks [@iketw](https://github.com/iketw)! - Adds the ability to login with any arbitrary login payload
|
||||
|
||||
```typescript
|
||||
await embeddedWallet.authenticate({
|
||||
strategy: "auth_endpoint",
|
||||
payload: "SOME_STRING",
|
||||
encryptionKey: "",
|
||||
});
|
||||
```
|
||||
|
||||
- [#2082](https://github.com/thirdweb-dev/js/pull/2082) [`699f31c2`](https://github.com/thirdweb-dev/js/commit/699f31c20a76cd284dbed1629c4a19d93aca7b7f) Thanks [@iketw](https://github.com/iketw)! - Better comments
|
||||
|
||||
- [#2086](https://github.com/thirdweb-dev/js/pull/2086) [`328ef5dc`](https://github.com/thirdweb-dev/js/commit/328ef5dc9c628a89a022a559852dfa2a788f70cb) Thanks [@iketw](https://github.com/iketw)! - Hide WC modal back button when only WC is defined as a supportedWallet
|
||||
|
||||
- Updated dependencies [[`c701c388`](https://github.com/thirdweb-dev/js/commit/c701c388c65a1e531b88991d8fd67d25f153992e), [`699f31c2`](https://github.com/thirdweb-dev/js/commit/699f31c20a76cd284dbed1629c4a19d93aca7b7f)]:
|
||||
- @thirdweb-dev/[email protected]
|
||||
- @thirdweb-dev/[email protected]
|
||||
- @thirdweb-dev/[email protected]
|
||||
|
||||
## 0.5.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- [#2018](https://github.com/thirdweb-dev/js/pull/2018) [`33c9f6b1`](https://github.com/thirdweb-dev/js/commit/33c9f6b1ab3e65187b2c49c083412d39a1334bba) Thanks [@iketw](https://github.com/iketw)! - Enforces passing an encryption key for custom jwt auth
|
||||
|
||||
```typescript
|
||||
const embedded = useEmbeddedWallet();
|
||||
|
||||
embedded.connect({
|
||||
jwt: "<token>",
|
||||
encryptionKey: "<my-key>",
|
||||
strategy: "jwt",
|
||||
});
|
||||
```
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#2072](https://github.com/thirdweb-dev/js/pull/2072) [`2346396b`](https://github.com/thirdweb-dev/js/commit/2346396bdffeed169cdfc15839bfb42d87f24303) Thanks [@iketw](https://github.com/iketw)! - Adds analytics nonce to embedded wallet
|
||||
|
||||
- Updated dependencies [[`33c9f6b1`](https://github.com/thirdweb-dev/js/commit/33c9f6b1ab3e65187b2c49c083412d39a1334bba), [`de5ebc90`](https://github.com/thirdweb-dev/js/commit/de5ebc9093aaf5fc08bc0d2d414138b520fe17fe), [`e10173bf`](https://github.com/thirdweb-dev/js/commit/e10173bf8aeaaabdb45231109b4da0c52c91b9da), [`09bafa9a`](https://github.com/thirdweb-dev/js/commit/09bafa9aebadb01641214747148c67d0b39c1275)]:
|
||||
- @thirdweb-dev/[email protected]
|
||||
- @thirdweb-dev/[email protected]
|
||||
|
||||
## 0.4.14
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`bcfa9463`](https://github.com/thirdweb-dev/js/commit/bcfa9463bbae6bf1d3b6389b7a141f65ef3e1173)]:
|
||||
- @thirdweb-dev/[email protected]
|
||||
- @thirdweb-dev/[email protected]
|
||||
- @thirdweb-dev/[email protected]
|
||||
|
||||
## 0.4.13
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/react-native",
|
||||
"version": "0.4.13",
|
||||
"version": "0.5.1",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-native",
|
||||
"author": "thirdweb eng <[email protected]>",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@@ -12,17 +12,16 @@ import { DEFAULT_WALLETS } from "../constants/wallets";
|
||||
import { DappContextProvider } from "./context-provider";
|
||||
import { UIContextProvider } from "./ui-context-provider";
|
||||
import { MainModal } from "../components/MainModal";
|
||||
import { ThemeProvider } from "../styles/ThemeProvider";
|
||||
import { ThemeProvider, ThemeType } from "../styles/ThemeProvider";
|
||||
import { SafeAreaProvider } from "react-native-safe-area-context";
|
||||
import { walletIds } from "@thirdweb-dev/wallets";
|
||||
import { ThirdwebStorage } from "../../core/storage/storage";
|
||||
import { useColorScheme } from "react-native";
|
||||
import type { Locale } from "../i18n/types";
|
||||
|
||||
interface ThirdwebProviderProps<TChains extends Chain[]>
|
||||
extends Omit<
|
||||
ThirdwebProviderCoreProps<TChains>,
|
||||
"supportedWallets" | "secretKey" | "signer"
|
||||
"supportedWallets" | "secretKey" | "signer" | "theme"
|
||||
> {
|
||||
/**
|
||||
* Wallets that will be supported by the dApp
|
||||
@@ -47,6 +46,27 @@ interface ThirdwebProviderProps<TChains extends Chain[]>
|
||||
*/
|
||||
supportedWallets?: WalletConfig<any>[];
|
||||
|
||||
/**
|
||||
* Set the theme for all thirdweb components
|
||||
*
|
||||
* By default it is set to "dark".
|
||||
*
|
||||
* theme can be set to either "dark" or "light" or a custom theme object.
|
||||
*
|
||||
* You can also import `lightTheme` or `darkTheme` functions from `@thirdweb-dev/react-native` to use the default themes as base and overrides parts of it.
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* import { darkTheme } from "@thirdweb-dev/react-native";
|
||||
* const customTheme = darkTheme({
|
||||
* colors: {
|
||||
* accentButtonColor: 'black',
|
||||
* },
|
||||
* })
|
||||
* ```
|
||||
*/
|
||||
theme?: ThemeType;
|
||||
|
||||
/**
|
||||
* Locale that the app will be displayed in
|
||||
*
|
||||
@@ -87,10 +107,15 @@ interface ThirdwebProviderProps<TChains extends Chain[]>
|
||||
locale?: Locale;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of default supported chains by the thirdweb SDK
|
||||
*/
|
||||
export type DefaultChains = typeof defaultChains;
|
||||
|
||||
/**
|
||||
*
|
||||
* The `<ThirdwebProvider />` component lets you control what networks you want users to connect to,
|
||||
* what types of wallets can connect to your app, and the settings for the [Thirdweb SDK](https://docs.thirdweb.com/typescript).
|
||||
* what types of wallets can connect to your app, and the settings for the Thirdweb SDK.
|
||||
*
|
||||
* @example
|
||||
* You can wrap your application with the provider as follows:
|
||||
@@ -107,21 +132,21 @@ interface ThirdwebProviderProps<TChains extends Chain[]>
|
||||
* };
|
||||
* ```
|
||||
*/
|
||||
export const ThirdwebProvider = <
|
||||
TChains extends Chain[] = typeof defaultChains,
|
||||
>({
|
||||
children,
|
||||
createWalletStorage = createAsyncLocalStorage,
|
||||
supportedWallets = DEFAULT_WALLETS,
|
||||
authConfig,
|
||||
theme,
|
||||
storageInterface,
|
||||
clientId,
|
||||
sdkOptions,
|
||||
locale = "en",
|
||||
...restProps
|
||||
}: PropsWithChildren<ThirdwebProviderProps<TChains>>) => {
|
||||
const colorScheme = useColorScheme();
|
||||
export const ThirdwebProvider = <TChains extends Chain[] = DefaultChains>(
|
||||
props: PropsWithChildren<ThirdwebProviderProps<TChains>>,
|
||||
) => {
|
||||
const {
|
||||
children,
|
||||
createWalletStorage = createAsyncLocalStorage,
|
||||
supportedWallets = DEFAULT_WALLETS,
|
||||
authConfig,
|
||||
theme,
|
||||
storageInterface,
|
||||
clientId,
|
||||
sdkOptions,
|
||||
locale = "en",
|
||||
...restProps
|
||||
} = props;
|
||||
|
||||
const coinbaseWalletObj = supportedWallets.find(
|
||||
(w) => w.id === walletIds.coinbase,
|
||||
@@ -161,9 +186,7 @@ export const ThirdwebProvider = <
|
||||
{...sdkOptions}
|
||||
{...restProps}
|
||||
>
|
||||
<ThemeProvider
|
||||
theme={theme ? theme : colorScheme === "dark" ? "dark" : "light"}
|
||||
>
|
||||
<ThemeProvider theme={theme ? theme : "dark"}>
|
||||
<UIContextProvider locale={locale}>
|
||||
{hasMagicConfig ? (
|
||||
<SafeAreaProvider>
|
||||
|
||||
@@ -5,8 +5,10 @@ import { PropsWithChildren, useContext } from "react";
|
||||
import { useColorScheme } from "react-native";
|
||||
import { useUIContext } from "../providers/ui-context-provider";
|
||||
|
||||
export type ThemeType = "dark" | "light" | Theme;
|
||||
|
||||
export type ThemeProviderProps = {
|
||||
theme?: Theme | "light" | "dark";
|
||||
theme?: ThemeType;
|
||||
};
|
||||
|
||||
export function ThemeProvider({
|
||||
|
||||
+36
-1
@@ -1,4 +1,5 @@
|
||||
import {
|
||||
AuthEndpointOptions,
|
||||
AuthOptions,
|
||||
AuthParams,
|
||||
AuthResult,
|
||||
@@ -11,6 +12,7 @@ import type { Chain } from "@thirdweb-dev/chains";
|
||||
import { providers, Signer } from "ethers";
|
||||
import { utils } from "ethers";
|
||||
import {
|
||||
authEndpoint,
|
||||
customJwt,
|
||||
sendVerificationEmail,
|
||||
socialLogin,
|
||||
@@ -101,7 +103,13 @@ export class EmbeddedWalletConnector extends Connector<EmbeddedWalletConnectionA
|
||||
case "jwt": {
|
||||
return this.customJwt({
|
||||
jwt: params.jwt,
|
||||
password: params.encryptionKey || "",
|
||||
password: params.encryptionKey,
|
||||
});
|
||||
}
|
||||
case "auth_endpoint": {
|
||||
return this.authEndpoint({
|
||||
payload: params.payload,
|
||||
encryptionKey: params.encryptionKey,
|
||||
});
|
||||
}
|
||||
default:
|
||||
@@ -230,6 +238,33 @@ export class EmbeddedWalletConnector extends Connector<EmbeddedWalletConnectionA
|
||||
}
|
||||
}
|
||||
|
||||
private async authEndpoint(
|
||||
authOptions: AuthEndpointOptions,
|
||||
): Promise<AuthResult> {
|
||||
try {
|
||||
const { verifiedToken, email } = await authEndpoint(
|
||||
authOptions,
|
||||
this.options.clientId,
|
||||
);
|
||||
this.email = email;
|
||||
return {
|
||||
user: {
|
||||
status: UserWalletStatus.LOGGED_IN_WALLET_INITIALIZED,
|
||||
recoveryShareManagement:
|
||||
verifiedToken.authDetails.recoveryShareManagement,
|
||||
},
|
||||
isNewUser: verifiedToken.isNewUser,
|
||||
needsRecoveryCode:
|
||||
verifiedToken.authDetails.recoveryShareManagement ===
|
||||
RecoveryShareManagement.USER_MANAGED,
|
||||
};
|
||||
} catch (error) {
|
||||
console.error(`Error while verifying auth_endpoint auth: ${error}`);
|
||||
this.disconnect();
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
async disconnect(): Promise<void> {
|
||||
clearConnectedEmail();
|
||||
clearConnectedAuthStrategy();
|
||||
|
||||
@@ -27,10 +27,17 @@ import { Auth } from "aws-amplify";
|
||||
import {
|
||||
DOMAIN_URL_2023,
|
||||
EWS_VERSION_HEADER,
|
||||
ROUTE_AUTH_ENDPOINT_CALLBACK,
|
||||
ROUTE_AUTH_JWT_CALLBACK,
|
||||
ROUTE_HEADLESS_OAUTH_LOGIN,
|
||||
THIRDWEB_SESSION_NONCE_HEADER,
|
||||
} from "./helpers/constants";
|
||||
import { AuthOptions, OauthOption, VerifiedTokenResponse } from "../types";
|
||||
import {
|
||||
AuthEndpointOptions,
|
||||
AuthOptions,
|
||||
OauthOption,
|
||||
VerifiedTokenResponse,
|
||||
} from "../types";
|
||||
import { InAppBrowser } from "react-native-inappbrowser-reborn";
|
||||
import { createErrorMessage } from "./helpers/errors";
|
||||
import {
|
||||
@@ -38,6 +45,7 @@ import {
|
||||
reactNativePackageVersion,
|
||||
} from "../../../../utils/version";
|
||||
import { BUNDLE_ID_HEADER } from "../../../../constants/headers";
|
||||
import { ANALYTICS } from "./helpers/analytics";
|
||||
|
||||
export async function sendVerificationEmail(options: {
|
||||
email: string;
|
||||
@@ -189,6 +197,7 @@ export async function socialLogin(oauthOptions: OauthOption, clientId: string) {
|
||||
headers: {
|
||||
[EWS_VERSION_HEADER]: reactNativePackageVersion,
|
||||
[BUNDLE_ID_HEADER]: appBundleId,
|
||||
[THIRDWEB_SESSION_NONCE_HEADER]: ANALYTICS.nonce,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -271,6 +280,7 @@ export async function customJwt(authOptions: AuthOptions, clientId: string) {
|
||||
"Content-Type": "application/json",
|
||||
[EWS_VERSION_HEADER]: reactNativePackageVersion,
|
||||
[BUNDLE_ID_HEADER]: appBundleId,
|
||||
[THIRDWEB_SESSION_NONCE_HEADER]: ANALYTICS.nonce,
|
||||
},
|
||||
body: JSON.stringify({
|
||||
jwt: jwt,
|
||||
@@ -303,7 +313,62 @@ export async function customJwt(authOptions: AuthOptions, clientId: string) {
|
||||
return { verifiedToken, email: verifiedToken.authDetails.email };
|
||||
} catch (e) {
|
||||
throw new Error(
|
||||
createErrorMessage("Malformed response from post authentication", e),
|
||||
createErrorMessage("Malformed response from post jwt authentication", e),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export async function authEndpoint(
|
||||
authOptions: AuthEndpointOptions,
|
||||
clientId: string,
|
||||
) {
|
||||
const { payload, encryptionKey } = authOptions;
|
||||
|
||||
const resp = await fetch(ROUTE_AUTH_ENDPOINT_CALLBACK, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
[EWS_VERSION_HEADER]: reactNativePackageVersion,
|
||||
[BUNDLE_ID_HEADER]: appBundleId,
|
||||
[THIRDWEB_SESSION_NONCE_HEADER]: ANALYTICS.nonce,
|
||||
},
|
||||
body: JSON.stringify({
|
||||
payload: payload,
|
||||
developerClientId: clientId,
|
||||
}),
|
||||
});
|
||||
if (!resp.ok) {
|
||||
const error = await resp.json();
|
||||
throw new Error(
|
||||
`Custom auth endpoint authentication error: ${error.message}`,
|
||||
);
|
||||
}
|
||||
|
||||
try {
|
||||
const { verifiedToken, verifiedTokenJwtString } = await resp.json();
|
||||
|
||||
const toStoreToken: AuthStoredTokenWithCookieReturnType["storedToken"] = {
|
||||
jwtToken: verifiedToken.jwtToken,
|
||||
authProvider: verifiedToken.authProvider,
|
||||
authDetails: {
|
||||
...verifiedToken.authDetails,
|
||||
email: verifiedToken.authDetails.email,
|
||||
},
|
||||
developerClientId: verifiedToken.developerClientId,
|
||||
cookieString: verifiedTokenJwtString,
|
||||
shouldStoreCookieString: true,
|
||||
isNewUser: verifiedToken.isNewUser,
|
||||
};
|
||||
|
||||
await postPaperAuthUserManaged(toStoreToken, clientId, encryptionKey);
|
||||
|
||||
return { verifiedToken, email: verifiedToken.authDetails.email };
|
||||
} catch (e) {
|
||||
throw new Error(
|
||||
createErrorMessage(
|
||||
"Malformed response from post auth_endpoint authentication",
|
||||
e,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
import { getRandomString } from "./getRandomValues";
|
||||
|
||||
export const ANALYTICS = {
|
||||
nonce: getRandomString(16),
|
||||
};
|
||||
+5
@@ -8,6 +8,7 @@ import {
|
||||
ROUTE_VALIDATE_USER_MANAGED_OTP,
|
||||
ROUTE_IS_VALID_USER_MANAGED_OTP,
|
||||
EWS_VERSION_HEADER,
|
||||
THIRDWEB_SESSION_NONCE_HEADER,
|
||||
} from "../constants";
|
||||
import { getAuthTokenClient } from "../storage/local";
|
||||
import {
|
||||
@@ -24,6 +25,7 @@ import {
|
||||
reactNativePackageVersion,
|
||||
} from "../../../../../../utils/version";
|
||||
import { BUNDLE_ID_HEADER } from "../../../../../../constants/headers";
|
||||
import { ANALYTICS } from "../analytics";
|
||||
|
||||
const EMBEDDED_WALLET_TOKEN_HEADER = "embedded-wallet-token";
|
||||
const PAPER_CLIENT_ID_HEADER = "x-thirdweb-client-id";
|
||||
@@ -31,6 +33,7 @@ const HEADERS = {
|
||||
"Content-Type": "application/json",
|
||||
[BUNDLE_ID_HEADER]: appBundleId,
|
||||
[EWS_VERSION_HEADER]: reactNativePackageVersion,
|
||||
[THIRDWEB_SESSION_NONCE_HEADER]: ANALYTICS.nonce,
|
||||
};
|
||||
|
||||
export const verifyClientId = async (clientId: string) => {
|
||||
@@ -68,6 +71,7 @@ export const authFetchEmbeddedWalletUser = async (
|
||||
[BUNDLE_ID_HEADER]: appBundleId,
|
||||
[PAPER_CLIENT_ID_HEADER]: clientId,
|
||||
[EWS_VERSION_HEADER]: reactNativePackageVersion,
|
||||
[THIRDWEB_SESSION_NONCE_HEADER]: ANALYTICS.nonce,
|
||||
}
|
||||
: {
|
||||
Authorization: `Bearer ${EMBEDDED_WALLET_TOKEN_HEADER}:${
|
||||
@@ -76,6 +80,7 @@ export const authFetchEmbeddedWalletUser = async (
|
||||
[BUNDLE_ID_HEADER]: appBundleId,
|
||||
[PAPER_CLIENT_ID_HEADER]: clientId,
|
||||
[EWS_VERSION_HEADER]: reactNativePackageVersion,
|
||||
[THIRDWEB_SESSION_NONCE_HEADER]: ANALYTICS.nonce,
|
||||
};
|
||||
return fetch(url, params);
|
||||
};
|
||||
|
||||
+1
-8
@@ -4,7 +4,7 @@ import {
|
||||
COGNITO_APP_CLIENT_ID,
|
||||
COGNITO_USER_POOL_ID,
|
||||
} from "../constants";
|
||||
import { getRandomValues } from "../getRandomValues";
|
||||
import { getRandomString } from "../getRandomValues";
|
||||
|
||||
Amplify.configure({
|
||||
Auth: {
|
||||
@@ -25,13 +25,6 @@ export async function cognitoEmailSignUp(email: string, clientId: string) {
|
||||
await Auth.signOut();
|
||||
}
|
||||
|
||||
function getRandomString(bytes: number) {
|
||||
const randomValues = getRandomValues(new Uint8Array(bytes));
|
||||
return Array.from(randomValues)
|
||||
.map((nr) => nr.toString(16).padStart(2, "0"))
|
||||
.join("");
|
||||
}
|
||||
|
||||
export async function cognitoEmailSignIn(email: string, clientId: string) {
|
||||
const cognitoUser = await Auth.signIn(`${email}:email:${clientId}`);
|
||||
return cognitoUser;
|
||||
|
||||
+6
-27
@@ -127,15 +127,16 @@ async function getRecoveryCode(
|
||||
storedToken.authDetails.recoveryShareManagement ===
|
||||
RecoveryShareManagement.CLOUD_MANAGED
|
||||
) {
|
||||
if (storedToken.authProvider === AuthProvider.CUSTOM_JWT) {
|
||||
// derive sub here
|
||||
const code = extractSubFromJwt(storedToken.jwtToken);
|
||||
if (!code) {
|
||||
if (
|
||||
storedToken.authProvider === AuthProvider.CUSTOM_JWT ||
|
||||
storedToken.authProvider === AuthProvider.CUSTOM_AUTH_ENDPOINT
|
||||
) {
|
||||
if (!recoveryCode) {
|
||||
throw new Error(
|
||||
`GetRecoveryCode error: ${ErrorMessages.missingRecoveryCode}`,
|
||||
);
|
||||
}
|
||||
return code;
|
||||
return recoveryCode;
|
||||
} else {
|
||||
try {
|
||||
const code = await getCognitoRecoveryPassword(clientId);
|
||||
@@ -156,25 +157,3 @@ async function getRecoveryCode(
|
||||
throw new Error("Invalid recovery share management option");
|
||||
}
|
||||
}
|
||||
|
||||
function extractSubFromJwt(jwtToken: string): string | undefined {
|
||||
const parts = jwtToken.split(".");
|
||||
if (parts.length !== 3) {
|
||||
throw new Error("Invalid JWT format.");
|
||||
}
|
||||
|
||||
const encodedPayload = parts[1];
|
||||
if (!encodedPayload) {
|
||||
throw new Error("Invalid JWT format.");
|
||||
}
|
||||
const decodedPayload = Buffer.from(encodedPayload, "base64").toString("utf8");
|
||||
|
||||
try {
|
||||
const payloadObject = JSON.parse(decodedPayload);
|
||||
if (payloadObject && payloadObject.sub) {
|
||||
return payloadObject.sub;
|
||||
}
|
||||
} catch (error) {
|
||||
throw new Error("Error parsing JWT payload as JSON.");
|
||||
}
|
||||
}
|
||||
|
||||
+2
@@ -13,6 +13,7 @@ export const RECOVERY_SHARE_INDEX = RECOVERY_SHARE_ID - 1;
|
||||
export const AWS_REGION = "us-west-2";
|
||||
|
||||
export const EWS_VERSION_HEADER = "x-embedded-wallet-version";
|
||||
export const THIRDWEB_SESSION_NONCE_HEADER = "x-session-nonce";
|
||||
|
||||
export const COGNITO_USER_POOL_ID = "us-west-2_UFwLcZIpq";
|
||||
export const COGNITO_APP_CLIENT_ID = "2e02ha2ce6du13ldk8pai4h3d0";
|
||||
@@ -33,6 +34,7 @@ export const ROUTE_STORE_USER_SHARES = `${ROUTE_2023_10_20_API_BASE_PATH}/embedd
|
||||
export const ROUTE_GET_USER_SHARES = `${ROUTE_2023_10_20_API_BASE_PATH}/embedded-wallet/embedded-wallet-shares`;
|
||||
export const ROUTE_VERIFY_THIRDWEB_CLIENT_ID = `${ROUTE_2023_10_20_API_BASE_PATH}/embedded-wallet/verify-thirdweb-client-id`;
|
||||
export const ROUTE_AUTH_JWT_CALLBACK = `${ROUTE_2023_10_20_API_BASE_PATH}/embedded-wallet/validate-custom-jwt`;
|
||||
export const ROUTE_AUTH_ENDPOINT_CALLBACK = `${ROUTE_2023_10_20_API_BASE_PATH}/embedded-wallet/validate-custom-auth-endpoint`;
|
||||
|
||||
export const ROUTE_USER_MANAGED_OTP = `${ROUTE_2023_10_20_API_BASE_PATH}/embedded-wallet/send-user-managed-email-otp`;
|
||||
export const ROUTE_VALIDATE_USER_MANAGED_OTP = `${ROUTE_2023_10_20_API_BASE_PATH}/embedded-wallet/validate-thirdweb-email-otp`;
|
||||
|
||||
+7
@@ -11,3 +11,10 @@ export function getRandomValues<T extends IntArrayBufferView>(array: T): T {
|
||||
// @ts-ignore getRandomValues is polyfilled
|
||||
return crypto.getRandomValues(array);
|
||||
}
|
||||
|
||||
export function getRandomString(bytes: number) {
|
||||
const randomValues = getRandomValues(new Uint8Array(bytes));
|
||||
return Array.from(randomValues)
|
||||
.map((nr) => nr.toString(16).padStart(2, "0"))
|
||||
.join("");
|
||||
}
|
||||
|
||||
@@ -44,6 +44,11 @@ export interface AuthOptions {
|
||||
password: string;
|
||||
}
|
||||
|
||||
export interface AuthEndpointOptions {
|
||||
payload: string;
|
||||
encryptionKey: string;
|
||||
}
|
||||
|
||||
export type SendEmailOtpReturnType = {
|
||||
isNewUser: boolean;
|
||||
isNewDevice: boolean;
|
||||
@@ -70,14 +75,21 @@ type SocialAuthParams = {
|
||||
type JwtAuthParams = {
|
||||
strategy: "jwt";
|
||||
jwt: string;
|
||||
encryptionKey?: string;
|
||||
encryptionKey: string;
|
||||
};
|
||||
|
||||
type AuthEndpointParams = {
|
||||
strategy: "auth_endpoint";
|
||||
payload: string;
|
||||
encryptionKey: string;
|
||||
};
|
||||
|
||||
// this is the input to 'authenticate'
|
||||
export type AuthParams =
|
||||
| EmailVerificationAuthParams
|
||||
| SocialAuthParams
|
||||
| JwtAuthParams;
|
||||
| JwtAuthParams
|
||||
| AuthEndpointParams;
|
||||
|
||||
// TODO typed based off AuthParams["strategy"]
|
||||
export type AuthResult = {
|
||||
|
||||
@@ -66,6 +66,26 @@ export class CoinbaseWallet extends AbstractClientWallet<CoinbaseWalletConnector
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Wallet config for the Coinbase Wallet.
|
||||
*
|
||||
* @param config - The config for the Coinbase Wallet
|
||||
* @returns The wallet config to be used by the ThirdwebProvider
|
||||
*
|
||||
* @example
|
||||
* ```jsx
|
||||
* import { ThirdwebProvider, coinbaseWallet } from "@thirdweb-dev/react-native";
|
||||
*
|
||||
* <ThirdwebProvider
|
||||
* supportedWallets={[
|
||||
* coinbaseWallet({
|
||||
* callbackURL: new URL('app-redirect-url://'),
|
||||
* }),
|
||||
* ]}>
|
||||
* <YourApp />
|
||||
* </ThirdwebProvider>
|
||||
* ```
|
||||
*/
|
||||
export const coinbaseWallet = (config?: {
|
||||
callbackURL?: URL;
|
||||
recommended?: boolean;
|
||||
|
||||
@@ -13,6 +13,8 @@ import {
|
||||
import { EMAIL_WALLET_ICON } from "../../../assets/svgs";
|
||||
import { WalletMeta } from "@thirdweb-dev/wallets/dist/declarations/src/evm/wallets/base";
|
||||
import { AUTH_OPTIONS_ICONS } from "../../types/embedded-wallet";
|
||||
import { getRandomString } from "../../connectors/embedded-wallet/embedded/helpers/getRandomValues";
|
||||
import { ANALYTICS } from "../../connectors/embedded-wallet/embedded/helpers/analytics";
|
||||
|
||||
export type EmbeddedWalletOptions = WalletOptions<
|
||||
EmbeddedWalletAdditionalOptions & WalletConnectReceiverConfig
|
||||
@@ -103,6 +105,7 @@ export class EmbeddedWallet extends AbstractClientWallet<
|
||||
|
||||
onDisconnect = () => {
|
||||
this.removeListeners();
|
||||
ANALYTICS.nonce = getRandomString(16);
|
||||
};
|
||||
|
||||
onChange = async (payload: any) => {
|
||||
|
||||
@@ -3,6 +3,24 @@ import { WalletOptions, walletIds } from "@thirdweb-dev/wallets";
|
||||
import { createSecureStorage } from "../../../core/SecureStorage";
|
||||
import { createAsyncLocalStorage } from "../../../core/AsyncStorage";
|
||||
|
||||
/**
|
||||
* Wallet config for a Local Wallet
|
||||
*
|
||||
* @param config - The config for the Local Wallet
|
||||
* @returns The wallet config to be used by the ThirdwebProvider
|
||||
*
|
||||
* @example
|
||||
* ```jsx
|
||||
* import { ThirdwebProvider, localWallet } from "@thirdweb-dev/react-native";
|
||||
*
|
||||
* <ThirdwebProvider
|
||||
* supportedWallets={[
|
||||
* localWallet(),
|
||||
* ]}>
|
||||
* <YourApp />
|
||||
* </ThirdwebProvider>
|
||||
* ```
|
||||
*/
|
||||
export const localWallet = () => {
|
||||
const secureStorage = createSecureStorage(walletIds.localWallet);
|
||||
const asyncStorage = createAsyncLocalStorage(walletIds.localWallet);
|
||||
|
||||
@@ -21,6 +21,22 @@ export class MetaMaskWallet extends WalletConnectBase {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Wallet config for MetaMask Wallet.
|
||||
*
|
||||
* @param config - The config for MetamaskWallet
|
||||
* @returns The wallet config to be used by the ThirdwebProvider
|
||||
*
|
||||
* @example
|
||||
* ```jsx
|
||||
* import { ThirdwebProvider, metamaskWallet } from "@thirdweb-dev/react-native";
|
||||
*
|
||||
* <ThirdwebProvider
|
||||
* supportedWallets={[metamaskWallet()]}>
|
||||
* <YourApp />
|
||||
* </ThirdwebProvider>
|
||||
* ```
|
||||
*/
|
||||
export const metamaskWallet = (config?: WalletConnectConfig) => {
|
||||
return {
|
||||
id: MetaMaskWallet.id,
|
||||
|
||||
@@ -22,6 +22,22 @@ export class RainbowWallet extends WalletConnectBase {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Wallet config for Rainbow Wallet.
|
||||
*
|
||||
* @param config - The config for RainbowWallet
|
||||
* @returns The wallet config to be used by the ThirdwebProvider
|
||||
*
|
||||
* @example
|
||||
* ```jsx
|
||||
* import { ThirdwebProvider, rainbowWallet } from "@thirdweb-dev/react-native";
|
||||
*
|
||||
* <ThirdwebProvider
|
||||
* supportedWallets={[rainbowWallet()]}>
|
||||
* <YourApp />
|
||||
* </ThirdwebProvider>
|
||||
* ```
|
||||
*/
|
||||
export const rainbowWallet = (config?: WalletConnectConfig) => {
|
||||
return {
|
||||
id: RainbowWallet.id,
|
||||
|
||||
@@ -3,6 +3,28 @@ import { SmartWallet, createAsyncLocalStorage } from "@thirdweb-dev/wallets";
|
||||
import { SmartWalletConfig } from "../types/smart-wallet";
|
||||
import { SmartWalletFlow } from "../../components/ConnectWalletFlow/SmartWallet/SmartWalletFlow";
|
||||
|
||||
/**
|
||||
* Wallet config for Smart Wallet.
|
||||
*
|
||||
* @param wallet - The EOA wallet config to be connected to the SmartWallet
|
||||
* @param config - The config for SmartWallet
|
||||
* @returns The wallet config to be used by the ThirdwebProvider
|
||||
*
|
||||
* @example
|
||||
* ```jsx
|
||||
* import { ThirdwebProvider, smartWallet, metamaskWallet } from "@thirdweb-dev/react-native";
|
||||
*
|
||||
* <ThirdwebProvider
|
||||
* supportedWallets={[
|
||||
* smartWallet(metamaskWallet(), {
|
||||
* factoryAddress: 'factory-address',
|
||||
* gasless: true,
|
||||
* }),
|
||||
* ]}>
|
||||
* <YourApp />
|
||||
* </ThirdwebProvider>
|
||||
* ```
|
||||
*/
|
||||
export const smartWallet = (
|
||||
wallet: WalletConfig<any>,
|
||||
config: SmartWalletConfig,
|
||||
|
||||
@@ -20,6 +20,22 @@ export class TrustWallet extends WalletConnectBase {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Wallet config for Trust Wallet.
|
||||
*
|
||||
* @param config - The config for TrustWallet
|
||||
* @returns The wallet config to be used by the ThirdwebProvider
|
||||
*
|
||||
* @example
|
||||
* ```jsx
|
||||
* import { ThirdwebProvider, trustWallet } from "@thirdweb-dev/react-native";
|
||||
*
|
||||
* <ThirdwebProvider
|
||||
* supportedWallets={[trustWallet()]}>
|
||||
* <YourApp />
|
||||
* </ThirdwebProvider>
|
||||
* ```
|
||||
*/
|
||||
export const trustWallet = (config?: WalletConnectConfig) => {
|
||||
return {
|
||||
id: TrustWallet.id,
|
||||
|
||||
@@ -41,8 +41,9 @@ const MODAL_HEIGHT = Dimensions.get("window").height * 0.5;
|
||||
export function WalletConnectUI({
|
||||
connected,
|
||||
walletConfig,
|
||||
goBack,
|
||||
projectId,
|
||||
goBack,
|
||||
supportedWallets,
|
||||
}: ConnectUIProps<WalletConnect> & { projectId: string }) {
|
||||
const l = useLocale();
|
||||
const theme = useGlobalTheme();
|
||||
@@ -163,7 +164,7 @@ export function WalletConnectUI({
|
||||
style={[styles.modal, { backgroundColor: theme.colors.background }]}
|
||||
>
|
||||
<ModalHeaderTextClose
|
||||
onBackPress={goBack}
|
||||
onBackPress={supportedWallets.length === 1 ? undefined : goBack}
|
||||
headerText="WalletConnect"
|
||||
onClose={onClosePress}
|
||||
paddingHorizontal="md"
|
||||
|
||||
@@ -9,6 +9,22 @@ export type WalletConnectConfig = {
|
||||
recommended?: boolean;
|
||||
};
|
||||
|
||||
/**
|
||||
* Wallet config for WalletConnect.
|
||||
*
|
||||
* @param config - The config for WalletConnect
|
||||
* @returns The wallet config to be used by the ThirdwebProvider
|
||||
*
|
||||
* @example
|
||||
* ```jsx
|
||||
* import { ThirdwebProvider, walletConnect } from "@thirdweb-dev/react-native";
|
||||
*
|
||||
* <ThirdwebProvider
|
||||
* supportedWallets={[walletConnect()]}>
|
||||
* <YourApp />
|
||||
* </ThirdwebProvider>
|
||||
* ```
|
||||
*/
|
||||
export const walletConnect = (
|
||||
config?: WalletConnectConfig,
|
||||
): WalletConfig<WalletConnect> => {
|
||||
|
||||
@@ -1,5 +1,31 @@
|
||||
# @thirdweb-dev/react
|
||||
|
||||
## 4.1.16
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`c701c388`](https://github.com/thirdweb-dev/js/commit/c701c388c65a1e531b88991d8fd67d25f153992e), [`699f31c2`](https://github.com/thirdweb-dev/js/commit/699f31c20a76cd284dbed1629c4a19d93aca7b7f)]:
|
||||
- @thirdweb-dev/sdk@4.0.22
|
||||
- @thirdweb-dev/react-core@4.1.16
|
||||
- @thirdweb-dev/wallets@2.3.1
|
||||
|
||||
## 4.1.15
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`33c9f6b1`](https://github.com/thirdweb-dev/js/commit/33c9f6b1ab3e65187b2c49c083412d39a1334bba), [`de5ebc90`](https://github.com/thirdweb-dev/js/commit/de5ebc9093aaf5fc08bc0d2d414138b520fe17fe), [`e10173bf`](https://github.com/thirdweb-dev/js/commit/e10173bf8aeaaabdb45231109b4da0c52c91b9da), [`09bafa9a`](https://github.com/thirdweb-dev/js/commit/09bafa9aebadb01641214747148c67d0b39c1275)]:
|
||||
- @thirdweb-dev/wallets@2.3.0
|
||||
- @thirdweb-dev/react-core@4.1.15
|
||||
|
||||
## 4.1.14
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`bcfa9463`](https://github.com/thirdweb-dev/js/commit/bcfa9463bbae6bf1d3b6389b7a141f65ef3e1173)]:
|
||||
- @thirdweb-dev/sdk@4.0.21
|
||||
- @thirdweb-dev/react-core@4.1.14
|
||||
- @thirdweb-dev/wallets@2.2.1
|
||||
|
||||
## 4.1.13
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/react",
|
||||
"version": "4.1.13",
|
||||
"version": "4.1.16",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react",
|
||||
"author": "thirdweb eng <[email protected]>",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@@ -1,5 +1,26 @@
|
||||
# @thirdweb-dev/sdk
|
||||
|
||||
## 4.0.22
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#2085](https://github.com/thirdweb-dev/js/pull/2085) [`c701c388`](https://github.com/thirdweb-dev/js/commit/c701c388c65a1e531b88991d8fd67d25f153992e) Thanks [@hsynlms](https://github.com/hsynlms)! - Fix error when fetching data on `vite-node` environment by setting a global variable `TW_SKIP_FETCH_SETUP` to `true`. Fixes https://github.com/thirdweb-dev/js/issues/2002
|
||||
|
||||
Setting this flag sets `skipFetchSetup` to `true` in [ethers ConnectionInfo](https://docs.ethers.org/v5/api/utils/web/#ConnectionInfo)
|
||||
|
||||
```ts
|
||||
// set this global variable
|
||||
globalThis.TW_SKIP_FETCH_SETUP = true;
|
||||
|
||||
// use the thirdweb sdk...
|
||||
```
|
||||
|
||||
## 4.0.21
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#2067](https://github.com/thirdweb-dev/js/pull/2067) [`bcfa9463`](https://github.com/thirdweb-dev/js/commit/bcfa9463bbae6bf1d3b6389b7a141f65ef3e1173) Thanks [@kumaryash90](https://github.com/kumaryash90)! - fix deployments
|
||||
|
||||
## 4.0.20
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/sdk",
|
||||
"version": "4.0.20",
|
||||
"version": "4.0.22",
|
||||
"description": "The main thirdweb SDK.",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/sdk",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export function getRpcUrl(network: string, clientId?: string) {
|
||||
return `https://${network}.rpc.thirdweb.com/${clientId || ""}`;
|
||||
}
|
||||
|
||||
@@ -1,13 +1,21 @@
|
||||
let alreadyChecked = false;
|
||||
export function checkClientIdOrSecretKey(message: string, clientId?: string, secretKey?: string) {
|
||||
if (alreadyChecked) {
|
||||
return;
|
||||
}
|
||||
alreadyChecked = true;
|
||||
|
||||
if (clientId || secretKey) {
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export function checkClientIdOrSecretKey(
|
||||
message: string,
|
||||
clientId?: string,
|
||||
secretKey?: string,
|
||||
) {
|
||||
if (alreadyChecked) {
|
||||
return;
|
||||
}
|
||||
alreadyChecked = true;
|
||||
|
||||
console.warn(message);
|
||||
}
|
||||
if (clientId || secretKey) {
|
||||
return;
|
||||
}
|
||||
|
||||
console.warn(message);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import { GENERATED_ABI } from "@thirdweb-dev/generated-abis";
|
||||
import { ContractInterface } from "ethers/lib/ethers";
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export function getCachedAbiForContract(
|
||||
address: string,
|
||||
): ContractInterface | undefined {
|
||||
|
||||
@@ -4,7 +4,7 @@ import { getSaltHash } from "./getSaltHash";
|
||||
/**
|
||||
* Pre-compute a contract's deployment address for a CREATE2 deployment.
|
||||
*
|
||||
* @public
|
||||
* @internal
|
||||
* @param bytecode - Creation bytecode of the contract to deploy
|
||||
* @param encodedArgs - Abi-encoded constructor params
|
||||
* @param create2FactoryAddress - The create2 factory address to use
|
||||
|
||||
@@ -23,6 +23,9 @@ import { extractConstructorParamsFromAbi } from "../feature-detection/extractCon
|
||||
import { caches } from "./caches";
|
||||
import { getRoyaltyEngineV1ByChainId } from "../../constants/royaltyEngine";
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export async function computeDeploymentInfo(
|
||||
contractType: DeployedContractType,
|
||||
provider: providers.Provider,
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const CREATE2_FACTORY_BYTECODE =
|
||||
"0x604580600e600039806000f350fe7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe03601600081602082378035828234f58015156039578182fd5b8082525050506014600cf3";
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const SIGNATURE = {
|
||||
v: 27,
|
||||
r: "0x2222222222222222222222222222222222222222222222222222222222222222",
|
||||
@@ -7,9 +13,18 @@ export const SIGNATURE = {
|
||||
};
|
||||
export const COMMON_FACTORY = "0x4e59b44847b379578588920cA78FbF26c0B4956C"; // for pre-eip-155 supporting chains
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const GAS_LIMIT_FOR_DEPLOYER = 5000000;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const DEPLOYER_BYTECODE =
|
||||
"0x60806040526040516107f33803806107f383398101604081905261002291610359565b805160005b818110156100c157828181518110610041576100416104c9565b6020026020010151600001516001600160a01b03163b600014156100af576100ad838281518110610074576100746104c9565b602002602001015160200151848381518110610092576100926104c9565b6020026020010151604001516100c960201b6100091760201c565b505b806100b9816104df565b915050610027565b505050610557565b606061011183836040518060400160405280601e81526020017f416464726573733a206c6f772d6c6576656c2063616c6c206661696c6564000081525061011860201b60201c565b9392505050565b6060610127848460008561012f565b949350505050565b6060824710156101955760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084015b60405180910390fd5b6001600160a01b0385163b6101ec5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161018c565b600080866001600160a01b031685876040516102089190610508565b60006040518083038185875af1925050503d8060008114610245576040519150601f19603f3d011682016040523d82523d6000602084013e61024a565b606091505b50909250905061025b828286610266565b979650505050505050565b60608315610275575081610111565b8251156102855782518084602001fd5b8160405162461bcd60e51b815260040161018c9190610524565b634e487b7160e01b600052604160045260246000fd5b604051606081016001600160401b03811182821017156102d7576102d761029f565b60405290565b604051601f8201601f191681016001600160401b03811182821017156103055761030561029f565b604052919050565b80516001600160a01b038116811461032457600080fd5b919050565b60005b8381101561034457818101518382015260200161032c565b83811115610353576000848401525b50505050565b6000602080838503121561036c57600080fd5b82516001600160401b038082111561038357600080fd5b818501915085601f83011261039757600080fd5b8151818111156103a9576103a961029f565b8060051b6103b88582016102dd565b91825283810185019185810190898411156103d257600080fd5b86860192505b838310156104bc578251858111156103f05760008081fd5b86016060601f19828d0381018213156104095760008081fd5b6104116102b5565b61041c8b850161030d565b8152604061042b81860161030d565b828d01529284015192898411156104425760008081fd5b83850194508e603f86011261045957600093508384fd5b8b85015193508984111561046f5761046f61029f565b61047f8c84601f870116016102dd565b92508383528e818587010111156104965760008081fd5b6104a5848d8501838801610329565b8101919091528452505091860191908601906103d8565b9998505050505050505050565b634e487b7160e01b600052603260045260246000fd5b600060001982141561050157634e487b7160e01b600052601160045260246000fd5b5060010190565b6000825161051a818460208701610329565b9190910192915050565b6020815260008251806020840152610543816040850160208701610329565b601f01601f19169190910160400192915050565b61028d806105666000396000f3fe6080604052600080fd5b606061004b83836040518060400160405280601e81526020017f416464726573733a206c6f772d6c6576656c2063616c6c206661696c65640000815250610052565b9392505050565b60606100618484600085610069565b949350505050565b6060824710156100cf5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084015b60405180910390fd5b6001600160a01b0385163b6101265760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016100c6565b600080866001600160a01b031685876040516101429190610208565b60006040518083038185875af1925050503d806000811461017f576040519150601f19603f3d011682016040523d82523d6000602084013e610184565b606091505b509150915061019482828661019f565b979650505050505050565b606083156101ae57508161004b565b8251156101be5782518084602001fd5b8160405162461bcd60e51b81526004016100c69190610224565b60005b838110156101f35781810151838201526020016101db565b83811115610202576000848401525b50505050565b6000825161021a8184602087016101d8565b9190910192915050565b60208152600082518060208401526102438160408501602087016101d8565b601f01601f1916919091016040019291505056fea26469706673582212200b524eb8ceaafe6c603273ee859fddbc2d6f1b7860c3d853dcf6f129f9d9371364736f6c634300080c0033";
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const DEPLOYER_ABI = [
|
||||
{
|
||||
inputs: [
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import { BigNumber, utils } from "ethers";
|
||||
import invariant from "tiny-invariant";
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export function convertParamValues(
|
||||
constructorParamTypes: string[],
|
||||
constructorParamValues: any[],
|
||||
|
||||
@@ -2,6 +2,9 @@ import { PrecomputedDeploymentTransaction } from "../../types/any-evm/deploy-dat
|
||||
import { GAS_LIMIT_FOR_DEPLOYER } from "./constants";
|
||||
import { estimateGasForDeploy } from "./estimateGasForDeploy";
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export function createTransactionBatches(
|
||||
transactions: PrecomputedDeploymentTransaction[],
|
||||
upperGasLimit: number = GAS_LIMIT_FOR_DEPLOYER,
|
||||
|
||||
@@ -8,7 +8,7 @@ import { isContractDeployed } from "./isContractDeployed";
|
||||
* Deploy a contract at a deterministic address, using Create2 method
|
||||
* Address depends on the Create2 factory address.
|
||||
*
|
||||
* @public
|
||||
* @internal
|
||||
*
|
||||
* @param signer - The signer to use
|
||||
* @param bytecode - The bytecode to deploy
|
||||
|
||||
@@ -13,7 +13,7 @@ import { getInitBytecodeWithSalt } from "./getInitBytecodeWithSalt";
|
||||
* Deploy a contract at a deterministic address, using Create2 method
|
||||
* Address depends on the Create2 factory address.
|
||||
*
|
||||
* @public
|
||||
* @internal
|
||||
*
|
||||
* @param signer - The signer to use
|
||||
* @param bytecode - The bytecode to deploy
|
||||
|
||||
@@ -4,6 +4,9 @@ import type { DeployOptions } from "../../types/deploy/deploy-options";
|
||||
import { DEPLOYER_ABI, DEPLOYER_BYTECODE } from "./constants";
|
||||
import { createTransactionBatches } from "./createTransactionBatches";
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export async function deployWithThrowawayDeployer(
|
||||
signer: Signer,
|
||||
transactions: PrecomputedDeploymentTransaction[],
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
import { utils } from "ethers";
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export function estimateGasForDeploy(initCode: string) {
|
||||
let gasLimit =
|
||||
utils
|
||||
|
||||
@@ -5,6 +5,9 @@ import type { DeployMetadata } from "../../types/deploy/deploy-options";
|
||||
|
||||
const deployMetadataCache: Record<string, any> = {};
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export async function fetchAndCacheDeployMetadata(
|
||||
publishMetadataUri: string,
|
||||
storage: ThirdwebStorage,
|
||||
|
||||
@@ -13,6 +13,9 @@ import { PublishedContractSchema } from "../../schema/contracts/custom";
|
||||
|
||||
export const THIRDWEB_DEPLOYER = "0xdd99b75f095d0c4d5112aCe938e4e6ed962fb024";
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export async function fetchPublishedContractFromPolygon(
|
||||
publisherAddress: AddressOrEns,
|
||||
contractName: string,
|
||||
|
||||
@@ -5,7 +5,7 @@ import { getKeylessTxn } from "./getKeylessTxn";
|
||||
|
||||
/**
|
||||
*
|
||||
* @public
|
||||
* @internal
|
||||
* @param transaction - Unsigned transaction object
|
||||
* @param signature - Signature bytes
|
||||
*/
|
||||
|
||||
@@ -3,7 +3,7 @@ import { providers } from "ethers";
|
||||
/**
|
||||
* Check if a contract exists at the given address
|
||||
*
|
||||
* @internal
|
||||
* @public
|
||||
* @param address - The address to check
|
||||
* @param provider - The provider to use
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { NATIVE_TOKEN_ADDRESS } from "../../constants/currency";
|
||||
import { ContractWrapper } from "../../core/classes/contract-wrapper";
|
||||
import { ContractWrapper } from "../../core/classes/internal/contract-wrapper";
|
||||
import { Address } from "../../schema/shared/Address";
|
||||
import type { Price } from "../../types/currency";
|
||||
import { BigNumberish, CallOverrides } from "ethers";
|
||||
|
||||
@@ -9,6 +9,9 @@ import {
|
||||
import { ThirdwebStorage } from "@thirdweb-dev/storage";
|
||||
import type { providers } from "ethers";
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export async function fetchSnapshotEntryForAddress(
|
||||
address: string,
|
||||
merkleRoot: string,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ContractWrapper } from "../../core/classes/contract-wrapper";
|
||||
import { ContractWrapper } from "../../core/classes/internal/contract-wrapper";
|
||||
import type {
|
||||
ClaimCondition,
|
||||
ClaimVerification,
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
import type { IERC20 } from "@thirdweb-dev/contracts-js";
|
||||
import { BigNumber, utils, type BigNumberish } from "ethers";
|
||||
import { ContractWrapper } from "../../core/classes/contract-wrapper";
|
||||
import { ContractWrapper } from "../../core/classes/internal/contract-wrapper";
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export async function approveErc20Allowance(
|
||||
contractToApprove: ContractWrapper<any>,
|
||||
currencyAddress: string,
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import { NATIVE_TOKEN_ADDRESS } from "../../constants/currency";
|
||||
import { isNativeToken } from "./isNativeToken";
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export function cleanCurrencyAddress(currencyAddress: string): string {
|
||||
if (isNativeToken(currencyAddress)) {
|
||||
return NATIVE_TOKEN_ADDRESS;
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
import type { IERC20 } from "@thirdweb-dev/contracts-js";
|
||||
import { BigNumber } from "ethers";
|
||||
import { ContractWrapper } from "../../core/classes/contract-wrapper";
|
||||
import { ContractWrapper } from "../../core/classes/internal/contract-wrapper";
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export async function hasERC20Allowance(
|
||||
contractToApprove: ContractWrapper<any>,
|
||||
currencyAddress: string,
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
import { BigNumber, utils } from "ethers";
|
||||
import { AmountSchema } from "../../../core/schema/shared";
|
||||
import { ContractWrapper } from "../../core/classes/contract-wrapper";
|
||||
import { ContractWrapper } from "../../core/classes/internal/contract-wrapper";
|
||||
import { Amount } from "../../types/currency";
|
||||
import { BaseERC20 } from "../../types/eips";
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export async function normalizeAmount(
|
||||
contractWrapper: ContractWrapper<BaseERC20>,
|
||||
amount: Amount,
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
import type { IERC20 } from "@thirdweb-dev/contracts-js";
|
||||
import { BigNumber } from "ethers";
|
||||
import { ContractWrapper } from "../../core/classes/contract-wrapper";
|
||||
import { ContractWrapper } from "../../core/classes/internal/contract-wrapper";
|
||||
import { isNativeToken } from "./isNativeToken";
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export async function setErc20Allowance(
|
||||
contractToApprove: ContractWrapper<any>,
|
||||
value: BigNumber,
|
||||
|
||||
@@ -11,6 +11,9 @@ let provider: providers.Provider | undefined;
|
||||
|
||||
const ENS_CACHE = new Map<string, Promise<CachedEns>>();
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export async function resolveEns(
|
||||
ens: string,
|
||||
depth = 0,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { FeatureName } from "../../constants/contract-features";
|
||||
import { ContractWrapper } from "../../core/classes/contract-wrapper";
|
||||
import { ContractWrapper } from "../../core/classes/internal/contract-wrapper";
|
||||
import { AbiSchema } from "../../schema/contracts/custom";
|
||||
import { BaseContract } from "ethers";
|
||||
import { isExtensionEnabled } from "./isFeatureEnabled";
|
||||
|
||||
@@ -31,6 +31,9 @@ export function detectFeatures(
|
||||
return results;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export function detectFeaturesFromBytecode(
|
||||
bytecode: string,
|
||||
features: Record<string, Feature> = SUPPORTED_FEATURES,
|
||||
|
||||
@@ -20,6 +20,9 @@ export function getAllDetectedFeatures(abi: AbiInput): FeatureWithEnabled[] {
|
||||
return features;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export function getAllDetectedExtensionsFromBytecode(
|
||||
bytecode: string,
|
||||
): FeatureWithEnabled[] {
|
||||
@@ -28,6 +31,9 @@ export function getAllDetectedExtensionsFromBytecode(
|
||||
return features;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export function constructAbiFromBytecode(bytecode: string): AbiInput {
|
||||
let extensions = getAllDetectedExtensionsFromBytecode(bytecode);
|
||||
// special deduping for ERC721 and ERC20
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { ContractWrapper } from "../../core/classes/contract-wrapper";
|
||||
import type { ContractWrapper } from "../../core/classes/internal/contract-wrapper";
|
||||
import type { BaseContract } from "ethers";
|
||||
|
||||
/**
|
||||
|
||||
@@ -40,6 +40,9 @@ export function hasMatchingAbi(
|
||||
return intersection.length === interfaceFn.length;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export function matchesAbiFromBytecode(
|
||||
contractBytecode: string,
|
||||
featureAbis: readonly AbiInput[],
|
||||
|
||||
@@ -10,6 +10,7 @@ import { detectFeatures } from "./detectFeatures";
|
||||
* @deprecated use isExtensionEnabled instead
|
||||
* @param abi - The abi to check
|
||||
* @param featureName - The feature name to check
|
||||
* @internal
|
||||
*/
|
||||
export function isFeatureEnabled(
|
||||
abi: AbiInput,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ContractWrapper } from "../../core/classes/contract-wrapper";
|
||||
import { ContractWrapper } from "../../core/classes/internal/contract-wrapper";
|
||||
import { AbiInput, AbiSchema } from "../../schema/contracts/custom";
|
||||
import { BaseContract } from "ethers";
|
||||
import { hasMatchingAbi } from "./hasMatchingAbi";
|
||||
|
||||
@@ -15,6 +15,9 @@ export async function resolveContractUriFromAddress(
|
||||
return extractIPFSHashFromBytecode(bytecode);
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export async function resolveContractUriAndBytecode(
|
||||
address: string,
|
||||
provider: providers.Provider,
|
||||
|
||||
@@ -28,6 +28,9 @@ export async function fetchContractMetadata(
|
||||
return formatCompilerMetadata(metadata);
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export function formatCompilerMetadata(metadata: any): PublishedMetadata {
|
||||
const abi = AbiSchema.parse(metadata.output.abi);
|
||||
const compilationTarget = metadata.settings.compilationTarget;
|
||||
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
InterfaceId_IERC1155,
|
||||
InterfaceId_IERC721,
|
||||
} from "../constants/contract";
|
||||
import { ContractWrapper } from "../core/classes/contract-wrapper";
|
||||
import { ContractWrapper } from "../core/classes/internal/contract-wrapper";
|
||||
import { fetchCurrencyValue } from "./currency/fetchCurrencyValue";
|
||||
import { NewDirectListing } from "../types/marketplace/NewDirectListing";
|
||||
import { NewAuctionListing } from "../types/marketplace/NewAuctionListing";
|
||||
|
||||
@@ -32,6 +32,9 @@ function putInCache(
|
||||
metadataCache[getCacheKey(address, chainId)] = metadata;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export function getContractMetadataFromCache(
|
||||
address: string,
|
||||
chainId: number,
|
||||
@@ -96,6 +99,9 @@ export async function fetchContractMetadataFromAddress(
|
||||
return metadata;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export async function fetchContractMetadataFromBytecode(
|
||||
address: Address,
|
||||
chainId: number,
|
||||
|
||||
@@ -2,7 +2,7 @@ import {
|
||||
getAllExtensionsAbi,
|
||||
getAllPluginsAbi,
|
||||
} from "../../constants/thirdweb-features";
|
||||
import { ContractWrapper } from "../../core/classes/contract-wrapper";
|
||||
import { ContractWrapper } from "../../core/classes/internal/contract-wrapper";
|
||||
import { Abi, AbiSchema } from "../../schema/contracts/custom";
|
||||
import { SDKOptions } from "../../schema/sdk-options";
|
||||
import { isExtensionEnabled } from "../feature-detection/isFeatureEnabled";
|
||||
|
||||
@@ -58,6 +58,9 @@ export function isIncrementalVersion(current: string, next: string) {
|
||||
return eqMajor && eqMinor && nextSemver.patch > currentSemver.patch;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export function isDowngradeVersion(current: string, next: string) {
|
||||
const currentSemver = toSemver(current);
|
||||
const nextSemver = toSemver(next);
|
||||
|
||||
@@ -79,6 +79,9 @@ export function getChainProvider(
|
||||
return getProviderFromRpcUrl(rpcUrl, sdkOptions, chainId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export function getChainIdFromNetwork(
|
||||
network: ChainOrRpcUrl,
|
||||
options: SDKOptionsOutput,
|
||||
@@ -109,6 +112,9 @@ export function getChainIdFromNetwork(
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export async function getChainIdOrName(
|
||||
network: NetworkInput,
|
||||
): Promise<number | string> {
|
||||
@@ -134,6 +140,7 @@ export async function getChainIdOrName(
|
||||
|
||||
/**
|
||||
* Check whether a NetworkInput value is a Chain config (naively, without parsing)
|
||||
* @internal
|
||||
*/
|
||||
export function isChainConfig(
|
||||
network: NetworkInput,
|
||||
@@ -277,6 +284,16 @@ export function getProviderFromRpcUrl(
|
||||
if (existingProvider) {
|
||||
return existingProvider;
|
||||
}
|
||||
|
||||
// TODO: remove below `skipFetchSetup` logic when ethers.js v6 support arrives
|
||||
let _skipFetchSetup = false;
|
||||
if (
|
||||
typeof globalThis !== "undefined" &&
|
||||
"TW_SKIP_FETCH_SETUP" in globalThis &&
|
||||
typeof (globalThis as any).TW_SKIP_FETCH_SETUP === "boolean"
|
||||
) {
|
||||
_skipFetchSetup = (globalThis as any).TW_SKIP_FETCH_SETUP as boolean;
|
||||
}
|
||||
|
||||
// Otherwise, create a new provider on the specific network
|
||||
const newProvider = chainId
|
||||
@@ -285,6 +302,7 @@ export function getProviderFromRpcUrl(
|
||||
{
|
||||
url: rpcUrl,
|
||||
headers,
|
||||
skipFetchSetup: _skipFetchSetup,
|
||||
},
|
||||
chainId,
|
||||
)
|
||||
@@ -292,6 +310,7 @@ export function getProviderFromRpcUrl(
|
||||
new providers.JsonRpcBatchProvider({
|
||||
url: rpcUrl,
|
||||
headers,
|
||||
skipFetchSetup: _skipFetchSetup,
|
||||
});
|
||||
|
||||
// Save the provider in our cache
|
||||
|
||||
@@ -60,6 +60,9 @@ type InitalizeParams = [
|
||||
options?: SDKOptions,
|
||||
];
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const EditionDropInitializer = {
|
||||
name: "DropERC1155" as const,
|
||||
contractType: prebuiltContractTypes["edition-drop"],
|
||||
@@ -106,6 +109,9 @@ export const EditionDropInitializer = {
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const EditionInitializer = {
|
||||
name: "TokenERC1155" as const,
|
||||
contractType: prebuiltContractTypes["edition"],
|
||||
@@ -146,6 +152,9 @@ export const EditionInitializer = {
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const MarketplaceInitializer = {
|
||||
name: "Marketplace" as const,
|
||||
contractType: prebuiltContractTypes.marketplace,
|
||||
@@ -187,6 +196,9 @@ export const MarketplaceInitializer = {
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const MarketplaceV3Initializer = {
|
||||
name: "MarketplaceV3" as const,
|
||||
contractType: prebuiltContractTypes["marketplace-v3"],
|
||||
@@ -256,6 +268,9 @@ export const MarketplaceV3Initializer = {
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const MultiwrapInitializer = {
|
||||
name: "Multiwrap" as const,
|
||||
contractType: prebuiltContractTypes.multiwrap,
|
||||
@@ -295,6 +310,9 @@ export const MultiwrapInitializer = {
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const NFTCollectionInitializer = {
|
||||
name: "TokenERC721" as const,
|
||||
contractType: prebuiltContractTypes["nft-collection"],
|
||||
@@ -336,6 +354,9 @@ export const NFTCollectionInitializer = {
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const NFTDropInitializer = {
|
||||
name: "DropERC721" as const,
|
||||
contractType: prebuiltContractTypes["nft-drop"],
|
||||
@@ -382,6 +403,9 @@ export const NFTDropInitializer = {
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const PackInitializer = {
|
||||
name: "Pack" as const,
|
||||
contractType: prebuiltContractTypes["pack"],
|
||||
@@ -424,6 +448,9 @@ export const PackInitializer = {
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const SignatureDropInitializer = {
|
||||
name: "SignatureDrop" as const,
|
||||
contractType: prebuiltContractTypes["signature-drop"],
|
||||
@@ -474,6 +501,9 @@ export const SignatureDropInitializer = {
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const SplitInitializer = {
|
||||
name: "Split" as const,
|
||||
contractType: prebuiltContractTypes["split"],
|
||||
@@ -514,6 +544,9 @@ export const SplitInitializer = {
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const TokenDropInitializer = {
|
||||
name: "DropERC20" as const,
|
||||
contractType: prebuiltContractTypes["token-drop"],
|
||||
@@ -558,6 +591,9 @@ export const TokenDropInitializer = {
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const TokenInitializer = {
|
||||
name: "TokenERC20" as const,
|
||||
contractType: prebuiltContractTypes.token,
|
||||
@@ -598,6 +634,9 @@ export const TokenInitializer = {
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const VoteInitializer = {
|
||||
name: "VoteERC20" as const,
|
||||
contractType: prebuiltContractTypes.vote,
|
||||
@@ -666,6 +705,9 @@ export const PREBUILT_CONTRACTS_MAP = /* @__PURE__ */ {
|
||||
[prebuiltContractTypes.vote]: VoteInitializer,
|
||||
} as const;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const PREBUILT_CONTRACTS_APPURI_MAP = /* @__PURE__ */ {
|
||||
[prebuiltContractTypes["edition-drop"]]:
|
||||
"ipfs://QmNm3wRzpKYWo1SRtJfgfxtvudp5p2nXD6EttcsQJHwTmk",
|
||||
@@ -695,6 +737,9 @@ const SmartContract = {
|
||||
roles: ALL_ROLES,
|
||||
};
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const CONTRACTS_MAP = /* @__PURE__ */ {
|
||||
...PREBUILT_CONTRACTS_MAP,
|
||||
[SmartContract.contractType]: SmartContract,
|
||||
@@ -710,6 +755,9 @@ export function getContractTypeForRemoteName(name: string): ContractType {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export function getContractName(
|
||||
type: PrebuiltContractType,
|
||||
): string | undefined {
|
||||
@@ -718,28 +766,47 @@ export function getContractName(
|
||||
)?.name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export type PrebuiltContractsMap = typeof PREBUILT_CONTRACTS_MAP;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export type PrebuiltContractsInstances = {
|
||||
[K in keyof PrebuiltContractsMap]: Awaited<
|
||||
ReturnType<(typeof PREBUILT_CONTRACTS_MAP)[K]["initialize"]>
|
||||
>;
|
||||
};
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export type ContractsMap = typeof CONTRACTS_MAP;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export type ValidContractInstance =
|
||||
| Awaited<ReturnType<ContractsMap[keyof PrebuiltContractsMap]["initialize"]>>
|
||||
| SmartContractType;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export type SchemaForPrebuiltContractType<
|
||||
TContractType extends PrebuiltContractType,
|
||||
> = PrebuiltContractsMap[TContractType]["schema"];
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export type ContractForPrebuiltContractType<
|
||||
TContractType extends PrebuiltContractType,
|
||||
> = PrebuiltContractsInstances[TContractType];
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export type ContractType = keyof ContractsMap;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export type DeploySchemaForPrebuiltContractType<
|
||||
TContractType extends PrebuiltContractType,
|
||||
> = SchemaForPrebuiltContractType<TContractType>["deploy"];
|
||||
|
||||
@@ -14,10 +14,10 @@ import { ContractPlatformFee } from "../../core/classes/contract-platform-fee";
|
||||
import { ContractRoles } from "../../core/classes/contract-roles";
|
||||
import { ContractRoyalty } from "../../core/classes/contract-royalty";
|
||||
import { ContractPrimarySale } from "../../core/classes/contract-sales";
|
||||
import { ContractWrapper } from "../../core/classes/contract-wrapper";
|
||||
import { ContractWrapper } from "../../core/classes/internal/contract-wrapper";
|
||||
import { DropErc1155ClaimConditions } from "../../core/classes/drop-erc1155-claim-conditions";
|
||||
import { DropErc1155History } from "../../core/classes/drop-erc1155-history";
|
||||
import { StandardErc1155 } from "../../core/classes/erc-1155-standard";
|
||||
import { DropErc1155History } from "../../core/classes/internal/erc1155/drop-erc1155-history";
|
||||
import { StandardErc1155 } from "../../core/classes/internal/erc1155/erc-1155-standard";
|
||||
import { GasCostEstimator } from "../../core/classes/gas-cost-estimator";
|
||||
import { Transaction } from "../../core/classes/transactions";
|
||||
import { NetworkInput, TransactionResultWithId } from "../../core/types";
|
||||
@@ -42,14 +42,15 @@ import { NFT_BASE_CONTRACT_ROLES } from "../contractRoles";
|
||||
* const contract = await sdk.getContract("{{contract_address}}", "edition-drop");
|
||||
* ```
|
||||
*
|
||||
* @public
|
||||
* @internal
|
||||
* @deprecated use contract.erc1155 instead
|
||||
*/
|
||||
export class EditionDrop extends StandardErc1155<PrebuiltEditionDrop> {
|
||||
private static contractRoles = NFT_BASE_CONTRACT_ROLES;
|
||||
|
||||
public abi: Abi;
|
||||
public sales: ContractPrimarySale;
|
||||
public platformFees: ContractPlatformFee<PrebuiltEditionDrop>;
|
||||
public platformFees: ContractPlatformFee;
|
||||
public encoder: ContractEncoder<PrebuiltEditionDrop>;
|
||||
public estimator: GasCostEstimator<PrebuiltEditionDrop>;
|
||||
public events: ContractEvents<PrebuiltEditionDrop>;
|
||||
@@ -117,7 +118,7 @@ export class EditionDrop extends StandardErc1155<PrebuiltEditionDrop> {
|
||||
|
||||
public history: DropErc1155History;
|
||||
public interceptor: ContractInterceptor<PrebuiltEditionDrop>;
|
||||
public owner: ContractOwner<PrebuiltEditionDrop>;
|
||||
public owner: ContractOwner;
|
||||
|
||||
constructor(
|
||||
network: NetworkInput,
|
||||
|
||||
@@ -15,9 +15,9 @@ import { ContractPlatformFee } from "../../core/classes/contract-platform-fee";
|
||||
import { ContractRoles } from "../../core/classes/contract-roles";
|
||||
import { ContractRoyalty } from "../../core/classes/contract-royalty";
|
||||
import { ContractPrimarySale } from "../../core/classes/contract-sales";
|
||||
import { ContractWrapper } from "../../core/classes/contract-wrapper";
|
||||
import { ContractWrapper } from "../../core/classes/internal/contract-wrapper";
|
||||
import { Erc1155SignatureMintable } from "../../core/classes/erc-1155-signature-mintable";
|
||||
import { StandardErc1155 } from "../../core/classes/erc-1155-standard";
|
||||
import { StandardErc1155 } from "../../core/classes/internal/erc1155/erc-1155-standard";
|
||||
import { GasCostEstimator } from "../../core/classes/gas-cost-estimator";
|
||||
import { Transaction } from "../../core/classes/transactions";
|
||||
import { NetworkInput, TransactionResultWithId } from "../../core/types";
|
||||
@@ -41,7 +41,8 @@ import { NFT_BASE_CONTRACT_ROLES } from "../contractRoles";
|
||||
* const contract = await sdk.getContract("{{contract_address}}", "edition");
|
||||
* ```
|
||||
*
|
||||
* @public
|
||||
* @internal
|
||||
* @deprecated use contract.erc1155 instead
|
||||
*/
|
||||
export class Edition extends StandardErc1155<TokenERC1155> {
|
||||
static contractRoles = NFT_BASE_CONTRACT_ROLES;
|
||||
@@ -57,7 +58,7 @@ export class Edition extends StandardErc1155<TokenERC1155> {
|
||||
(typeof Edition.contractRoles)[number]
|
||||
>;
|
||||
public sales: ContractPrimarySale;
|
||||
public platformFees: ContractPlatformFee<TokenERC1155>;
|
||||
public platformFees: ContractPlatformFee;
|
||||
public encoder: ContractEncoder<TokenERC1155>;
|
||||
public estimator: GasCostEstimator<TokenERC1155>;
|
||||
public events: ContractEvents<TokenERC1155>;
|
||||
@@ -98,7 +99,7 @@ export class Edition extends StandardErc1155<TokenERC1155> {
|
||||
*/
|
||||
public signature: Erc1155SignatureMintable;
|
||||
public interceptor: ContractInterceptor<TokenERC1155>;
|
||||
public owner: ContractOwner<TokenERC1155>;
|
||||
public owner: ContractOwner;
|
||||
|
||||
constructor(
|
||||
network: NetworkInput,
|
||||
|
||||
@@ -18,10 +18,10 @@ import { ContractInterceptor } from "../../core/classes/contract-interceptor";
|
||||
import { ContractMetadata } from "../../core/classes/contract-metadata";
|
||||
import { ContractPlatformFee } from "../../core/classes/contract-platform-fee";
|
||||
import { ContractRoles } from "../../core/classes/contract-roles";
|
||||
import { ContractWrapper } from "../../core/classes/contract-wrapper";
|
||||
import { ContractWrapper } from "../../core/classes/internal/contract-wrapper";
|
||||
import { GasCostEstimator } from "../../core/classes/gas-cost-estimator";
|
||||
import { MarketplaceAuction } from "../../core/classes/marketplace-auction";
|
||||
import { MarketplaceDirect } from "../../core/classes/marketplace-direct";
|
||||
import { MarketplaceAuction } from "../../core/classes/internal/marketplace/marketplace-auction";
|
||||
import { MarketplaceDirect } from "../../core/classes/internal/marketplace/marketplace-direct";
|
||||
import { Transaction } from "../../core/classes/transactions";
|
||||
import { UpdateableNetwork } from "../../core/interfaces/contract";
|
||||
import { NetworkInput } from "../../core/types";
|
||||
@@ -50,7 +50,8 @@ import { Offer } from "../../types/marketplace/Offer";
|
||||
* const contract = await sdk.getContract("{{contract_address}}", "marketplace");
|
||||
* ```
|
||||
*
|
||||
* @public
|
||||
* @internal
|
||||
* @deprecated use contract.directListings / contract.auctions / contract.offers instead
|
||||
*/
|
||||
export class Marketplace implements UpdateableNetwork {
|
||||
static contractRoles = MARKETPLACE_CONTRACT_ROLES;
|
||||
@@ -62,7 +63,7 @@ export class Marketplace implements UpdateableNetwork {
|
||||
public encoder: ContractEncoder<MarketplaceContract>;
|
||||
public events: ContractEvents<MarketplaceContract>;
|
||||
public estimator: GasCostEstimator<MarketplaceContract>;
|
||||
public platformFees: ContractPlatformFee<MarketplaceContract>;
|
||||
public platformFees: ContractPlatformFee;
|
||||
public metadata: ContractMetadata<
|
||||
MarketplaceContract,
|
||||
typeof MarketplaceContractSchema
|
||||
|
||||
@@ -20,7 +20,7 @@ import { ContractInterceptor } from "../../core/classes/contract-interceptor";
|
||||
import { ContractMetadata } from "../../core/classes/contract-metadata";
|
||||
import { ContractPlatformFee } from "../../core/classes/contract-platform-fee";
|
||||
import { ContractRoles } from "../../core/classes/contract-roles";
|
||||
import { ContractWrapper } from "../../core/classes/contract-wrapper";
|
||||
import { ContractWrapper } from "../../core/classes/internal/contract-wrapper";
|
||||
import { GasCostEstimator } from "../../core/classes/gas-cost-estimator";
|
||||
import { MarketplaceV3DirectListings } from "../../core/classes/marketplacev3-direct-listings";
|
||||
import { MarketplaceV3EnglishAuctions } from "../../core/classes/marketplacev3-english-auction";
|
||||
@@ -46,7 +46,8 @@ import { MARKETPLACE_CONTRACT_ROLES } from "../contractRoles";
|
||||
* const contract = await sdk.getContract("{{contract_address}}", "marketplace");
|
||||
* ```
|
||||
*
|
||||
* @public
|
||||
* @internal
|
||||
* @deprecated use contract.directListings / contract.auctions / contract.offers instead
|
||||
*/
|
||||
export class MarketplaceV3 implements UpdateableNetwork {
|
||||
static contractRoles = MARKETPLACE_CONTRACT_ROLES;
|
||||
@@ -58,7 +59,7 @@ export class MarketplaceV3 implements UpdateableNetwork {
|
||||
public encoder: ContractEncoder<MarketplaceV3Contract>;
|
||||
public events: ContractEvents<MarketplaceV3Contract>;
|
||||
public estimator: GasCostEstimator<MarketplaceV3Contract>;
|
||||
public platformFees: ContractPlatformFee<MarketplaceV3Contract>;
|
||||
public platformFees: ContractPlatformFee;
|
||||
public metadata: ContractMetadata<
|
||||
MarketplaceV3Contract,
|
||||
typeof MarketplaceContractSchema
|
||||
|
||||
@@ -20,8 +20,8 @@ import { ContractMetadata } from "../../core/classes/contract-metadata";
|
||||
import { ContractOwner } from "../../core/classes/contract-owner";
|
||||
import { ContractRoles } from "../../core/classes/contract-roles";
|
||||
import { ContractRoyalty } from "../../core/classes/contract-royalty";
|
||||
import { ContractWrapper } from "../../core/classes/contract-wrapper";
|
||||
import { StandardErc721 } from "../../core/classes/erc-721-standard";
|
||||
import { ContractWrapper } from "../../core/classes/internal/contract-wrapper";
|
||||
import { StandardErc721 } from "../../core/classes/internal/erc721/erc-721-standard";
|
||||
import { GasCostEstimator } from "../../core/classes/gas-cost-estimator";
|
||||
import { Transaction } from "../../core/classes/transactions";
|
||||
import { NetworkInput, TransactionResultWithId } from "../../core/types";
|
||||
@@ -52,6 +52,7 @@ import { MULTIWRAP_CONTRACT_ROLES } from "../contractRoles";
|
||||
*
|
||||
* @beta
|
||||
*/
|
||||
// TODO create extension wrappers for this
|
||||
export class Multiwrap extends StandardErc721<MultiwrapContract> {
|
||||
static contractRoles = MULTIWRAP_CONTRACT_ROLES;
|
||||
|
||||
@@ -90,7 +91,7 @@ export class Multiwrap extends StandardErc721<MultiwrapContract> {
|
||||
MultiwrapContract,
|
||||
typeof MultiwrapContractSchema
|
||||
>;
|
||||
public owner: ContractOwner<MultiwrapContract>;
|
||||
public owner: ContractOwner;
|
||||
|
||||
constructor(
|
||||
network: NetworkInput,
|
||||
|
||||
@@ -14,8 +14,8 @@ import { ContractPlatformFee } from "../../core/classes/contract-platform-fee";
|
||||
import { ContractRoles } from "../../core/classes/contract-roles";
|
||||
import { ContractRoyalty } from "../../core/classes/contract-royalty";
|
||||
import { ContractPrimarySale } from "../../core/classes/contract-sales";
|
||||
import { ContractWrapper } from "../../core/classes/contract-wrapper";
|
||||
import { StandardErc721 } from "../../core/classes/erc-721-standard";
|
||||
import { ContractWrapper } from "../../core/classes/internal/contract-wrapper";
|
||||
import { StandardErc721 } from "../../core/classes/internal/erc721/erc-721-standard";
|
||||
import { Erc721WithQuantitySignatureMintable } from "../../core/classes/erc-721-with-quantity-signature-mintable";
|
||||
import { GasCostEstimator } from "../../core/classes/gas-cost-estimator";
|
||||
import { Transaction } from "../../core/classes/transactions";
|
||||
@@ -39,7 +39,8 @@ import { NFT_BASE_CONTRACT_ROLES } from "../contractRoles";
|
||||
* const contract = await sdk.getContract("{{contract_address}}", "nft-collection");
|
||||
* ```
|
||||
*
|
||||
* @public
|
||||
* @internal
|
||||
* @deprecated use contract.erc721 instead
|
||||
*/
|
||||
export class NFTCollection extends StandardErc721<TokenERC721> {
|
||||
static contractRoles = NFT_BASE_CONTRACT_ROLES;
|
||||
@@ -59,7 +60,7 @@ export class NFTCollection extends StandardErc721<TokenERC721> {
|
||||
public estimator: GasCostEstimator<TokenERC721>;
|
||||
public events: ContractEvents<TokenERC721>;
|
||||
public sales: ContractPrimarySale;
|
||||
public platformFees: ContractPlatformFee<TokenERC721>;
|
||||
public platformFees: ContractPlatformFee;
|
||||
/**
|
||||
* Configure royalties
|
||||
* @remarks Set your own royalties for the entire contract or per token
|
||||
@@ -81,7 +82,7 @@ export class NFTCollection extends StandardErc721<TokenERC721> {
|
||||
TokenERC721,
|
||||
typeof TokenErc721ContractSchema
|
||||
>;
|
||||
public owner: ContractOwner<TokenERC721>;
|
||||
public owner: ContractOwner;
|
||||
|
||||
/**
|
||||
* Signature Minting
|
||||
|
||||
@@ -18,10 +18,10 @@ import { ContractPlatformFee } from "../../core/classes/contract-platform-fee";
|
||||
import { ContractRoles } from "../../core/classes/contract-roles";
|
||||
import { ContractRoyalty } from "../../core/classes/contract-royalty";
|
||||
import { ContractPrimarySale } from "../../core/classes/contract-sales";
|
||||
import { ContractWrapper } from "../../core/classes/contract-wrapper";
|
||||
import { ContractWrapper } from "../../core/classes/internal/contract-wrapper";
|
||||
import { DelayedReveal } from "../../core/classes/delayed-reveal";
|
||||
import { DropClaimConditions } from "../../core/classes/drop-claim-conditions";
|
||||
import { StandardErc721 } from "../../core/classes/erc-721-standard";
|
||||
import { StandardErc721 } from "../../core/classes/internal/erc721/erc-721-standard";
|
||||
import { GasCostEstimator } from "../../core/classes/gas-cost-estimator";
|
||||
import { Transaction } from "../../core/classes/transactions";
|
||||
import { NetworkInput, TransactionResultWithId } from "../../core/types";
|
||||
@@ -47,7 +47,8 @@ import { NFT_BASE_CONTRACT_ROLES } from "../contractRoles";
|
||||
* const contract = await sdk.getContract("{{contract_address}}", "nft-drop");
|
||||
* ```
|
||||
*
|
||||
* @public
|
||||
* @internal
|
||||
* @deprecated use contract.erc721 instead
|
||||
*/
|
||||
export class NFTDrop extends StandardErc721<PrebuiltNFTDrop> {
|
||||
static contractRoles = NFT_BASE_CONTRACT_ROLES;
|
||||
@@ -61,7 +62,7 @@ export class NFTDrop extends StandardErc721<PrebuiltNFTDrop> {
|
||||
>;
|
||||
public app: ContractAppURI<PrebuiltNFTDrop>;
|
||||
public sales: ContractPrimarySale;
|
||||
public platformFees: ContractPlatformFee<PrebuiltNFTDrop>;
|
||||
public platformFees: ContractPlatformFee;
|
||||
public events: ContractEvents<PrebuiltNFTDrop>;
|
||||
public roles: ContractRoles<
|
||||
PrebuiltNFTDrop,
|
||||
@@ -154,7 +155,7 @@ export class NFTDrop extends StandardErc721<PrebuiltNFTDrop> {
|
||||
*/
|
||||
public checkout: PaperCheckout<PrebuiltNFTDrop>;
|
||||
|
||||
public owner: ContractOwner<PrebuiltNFTDrop>;
|
||||
public owner: ContractOwner;
|
||||
|
||||
constructor(
|
||||
network: NetworkInput,
|
||||
|
||||
@@ -37,8 +37,8 @@ import { ContractMetadata } from "../../core/classes/contract-metadata";
|
||||
import { ContractOwner } from "../../core/classes/contract-owner";
|
||||
import { ContractRoles } from "../../core/classes/contract-roles";
|
||||
import { ContractRoyalty } from "../../core/classes/contract-royalty";
|
||||
import { ContractWrapper } from "../../core/classes/contract-wrapper";
|
||||
import { StandardErc1155 } from "../../core/classes/erc-1155-standard";
|
||||
import { ContractWrapper } from "../../core/classes/internal/contract-wrapper";
|
||||
import { StandardErc1155 } from "../../core/classes/internal/erc1155/erc-1155-standard";
|
||||
import { GasCostEstimator } from "../../core/classes/gas-cost-estimator";
|
||||
import { PackVRF } from "../../core/classes/pack-vrf";
|
||||
import { Transaction } from "../../core/classes/transactions";
|
||||
@@ -71,6 +71,7 @@ import { PACK_CONTRACT_ROLES } from "../contractRoles";
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
// TODO create extension wrappers
|
||||
export class Pack extends StandardErc1155<PackContract> {
|
||||
static contractRoles = PACK_CONTRACT_ROLES;
|
||||
|
||||
@@ -107,7 +108,7 @@ export class Pack extends StandardErc1155<PackContract> {
|
||||
*/
|
||||
public interceptor: ContractInterceptor<PackContract>;
|
||||
|
||||
public owner: ContractOwner<PackContract>;
|
||||
public owner: ContractOwner;
|
||||
|
||||
private _vrf?: PackVRF;
|
||||
|
||||
|
||||
@@ -19,10 +19,10 @@ import { ContractPlatformFee } from "../../core/classes/contract-platform-fee";
|
||||
import { ContractRoles } from "../../core/classes/contract-roles";
|
||||
import { ContractRoyalty } from "../../core/classes/contract-royalty";
|
||||
import { ContractPrimarySale } from "../../core/classes/contract-sales";
|
||||
import { ContractWrapper } from "../../core/classes/contract-wrapper";
|
||||
import { ContractWrapper } from "../../core/classes/internal/contract-wrapper";
|
||||
import { DelayedReveal } from "../../core/classes/delayed-reveal";
|
||||
import { DropClaimConditions } from "../../core/classes/drop-claim-conditions";
|
||||
import { StandardErc721 } from "../../core/classes/erc-721-standard";
|
||||
import { StandardErc721 } from "../../core/classes/internal/erc721/erc-721-standard";
|
||||
import { Erc721WithQuantitySignatureMintable } from "../../core/classes/erc-721-with-quantity-signature-mintable";
|
||||
import { GasCostEstimator } from "../../core/classes/gas-cost-estimator";
|
||||
import { Transaction } from "../../core/classes/transactions";
|
||||
@@ -51,13 +51,14 @@ import { NFT_BASE_CONTRACT_ROLES } from "../contractRoles";
|
||||
* const contract = await sdk.getContract("{{contract_address}}", "signature-drop");
|
||||
* ```
|
||||
*
|
||||
* @public
|
||||
* @internal
|
||||
* @deprecated use contract.erc721 instead
|
||||
*/
|
||||
export class SignatureDrop extends StandardErc721<SignatureDropContract> {
|
||||
static contractRoles = NFT_BASE_CONTRACT_ROLES;
|
||||
|
||||
public abi: Abi;
|
||||
public owner: ContractOwner<SignatureDropContract>;
|
||||
public owner: ContractOwner;
|
||||
public encoder: ContractEncoder<SignatureDropContract>;
|
||||
public estimator: GasCostEstimator<SignatureDropContract>;
|
||||
public metadata: ContractMetadata<
|
||||
@@ -66,7 +67,7 @@ export class SignatureDrop extends StandardErc721<SignatureDropContract> {
|
||||
>;
|
||||
public app: ContractAppURI<SignatureDropContract>;
|
||||
public sales: ContractPrimarySale;
|
||||
public platformFees: ContractPlatformFee<SignatureDropContract>;
|
||||
public platformFees: ContractPlatformFee;
|
||||
public events: ContractEvents<SignatureDropContract>;
|
||||
public roles: ContractRoles<
|
||||
SignatureDropContract,
|
||||
|
||||
@@ -13,7 +13,7 @@ import { ContractEvents } from "../../core/classes/contract-events";
|
||||
import { ContractInterceptor } from "../../core/classes/contract-interceptor";
|
||||
import { ContractMetadata } from "../../core/classes/contract-metadata";
|
||||
import { ContractRoles } from "../../core/classes/contract-roles";
|
||||
import { ContractWrapper } from "../../core/classes/contract-wrapper";
|
||||
import { ContractWrapper } from "../../core/classes/internal/contract-wrapper";
|
||||
import { GasCostEstimator } from "../../core/classes/gas-cost-estimator";
|
||||
import { Transaction } from "../../core/classes/transactions";
|
||||
import { UpdateableNetwork } from "../../core/interfaces/contract";
|
||||
@@ -41,6 +41,7 @@ import { ADMIN_ROLE } from "../contractRoles";
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
// TODO create extension wrappers for this
|
||||
export class Split implements UpdateableNetwork {
|
||||
static contractRoles = ADMIN_ROLE;
|
||||
|
||||
|
||||
@@ -11,9 +11,9 @@ import { ContractMetadata } from "../../core/classes/contract-metadata";
|
||||
import { ContractPlatformFee } from "../../core/classes/contract-platform-fee";
|
||||
import { ContractRoles } from "../../core/classes/contract-roles";
|
||||
import { ContractPrimarySale } from "../../core/classes/contract-sales";
|
||||
import { ContractWrapper } from "../../core/classes/contract-wrapper";
|
||||
import { ContractWrapper } from "../../core/classes/internal/contract-wrapper";
|
||||
import { DropClaimConditions } from "../../core/classes/drop-claim-conditions";
|
||||
import { StandardErc20 } from "../../core/classes/erc-20-standard";
|
||||
import { StandardErc20 } from "../../core/classes/internal/erc20/erc-20-standard";
|
||||
import { GasCostEstimator } from "../../core/classes/gas-cost-estimator";
|
||||
import { Transaction } from "../../core/classes/transactions";
|
||||
import { NetworkInput } from "../../core/types";
|
||||
@@ -37,7 +37,8 @@ import { TOKEN_DROP_CONTRACT_ROLES } from "../contractRoles";
|
||||
* const sdk = new ThirdwebSDK("{{chainName}}");
|
||||
* const contract = await sdk.getContract("{{contract_address}}", "token-drop");
|
||||
* ```
|
||||
*
|
||||
* @internal
|
||||
* @deprecated use contract.erc20 instead
|
||||
*/
|
||||
export class TokenDrop extends StandardErc20<PrebuiltTokenDrop> {
|
||||
static contractRoles = TOKEN_DROP_CONTRACT_ROLES;
|
||||
@@ -55,7 +56,7 @@ export class TokenDrop extends StandardErc20<PrebuiltTokenDrop> {
|
||||
public encoder: ContractEncoder<PrebuiltTokenDrop>;
|
||||
public estimator: GasCostEstimator<PrebuiltTokenDrop>;
|
||||
public sales: ContractPrimarySale;
|
||||
public platformFees: ContractPlatformFee<PrebuiltTokenDrop>;
|
||||
public platformFees: ContractPlatformFee;
|
||||
public events: ContractEvents<PrebuiltTokenDrop>;
|
||||
/**
|
||||
* Configure claim conditions
|
||||
|
||||
@@ -12,10 +12,10 @@ import { ContractMetadata } from "../../core/classes/contract-metadata";
|
||||
import { ContractPlatformFee } from "../../core/classes/contract-platform-fee";
|
||||
import { ContractRoles } from "../../core/classes/contract-roles";
|
||||
import { ContractPrimarySale } from "../../core/classes/contract-sales";
|
||||
import { ContractWrapper } from "../../core/classes/contract-wrapper";
|
||||
import { TokenERC20History } from "../../core/classes/erc-20-history";
|
||||
import { ContractWrapper } from "../../core/classes/internal/contract-wrapper";
|
||||
import { TokenERC20History } from "../../core/classes/internal/erc20/erc-20-history";
|
||||
import { Erc20SignatureMintable } from "../../core/classes/erc-20-signature-mintable";
|
||||
import { StandardErc20 } from "../../core/classes/erc-20-standard";
|
||||
import { StandardErc20 } from "../../core/classes/internal/erc20/erc-20-standard";
|
||||
import { GasCostEstimator } from "../../core/classes/gas-cost-estimator";
|
||||
import { Transaction } from "../../core/classes/transactions";
|
||||
import { NetworkInput } from "../../core/types";
|
||||
@@ -40,7 +40,8 @@ import { NFT_BASE_CONTRACT_ROLES } from "../contractRoles";
|
||||
* const contract = await sdk.getContract("{{contract_address}}", "token");
|
||||
* ```
|
||||
*
|
||||
* @public
|
||||
* @internal
|
||||
* @deprecated use contract.erc20 instead
|
||||
*/
|
||||
export class Token extends StandardErc20<TokenERC20> {
|
||||
static contractRoles = NFT_BASE_CONTRACT_ROLES;
|
||||
@@ -57,7 +58,7 @@ export class Token extends StandardErc20<TokenERC20> {
|
||||
public estimator: GasCostEstimator<TokenERC20>;
|
||||
public history: TokenERC20History;
|
||||
public events: ContractEvents<TokenERC20>;
|
||||
public platformFees: ContractPlatformFee<TokenERC20>;
|
||||
public platformFees: ContractPlatformFee;
|
||||
public sales: ContractPrimarySale;
|
||||
/**
|
||||
* Signature Minting
|
||||
|
||||
@@ -17,7 +17,7 @@ import { ContractEncoder } from "../../core/classes/contract-encoder";
|
||||
import { ContractEvents } from "../../core/classes/contract-events";
|
||||
import { ContractInterceptor } from "../../core/classes/contract-interceptor";
|
||||
import { ContractMetadata } from "../../core/classes/contract-metadata";
|
||||
import { ContractWrapper } from "../../core/classes/contract-wrapper";
|
||||
import { ContractWrapper } from "../../core/classes/internal/contract-wrapper";
|
||||
import { GasCostEstimator } from "../../core/classes/gas-cost-estimator";
|
||||
import { Transaction } from "../../core/classes/transactions";
|
||||
import { UpdateableNetwork } from "../../core/interfaces/contract";
|
||||
@@ -50,6 +50,7 @@ import { VoteType } from "../../enums/vote/Vote";
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
// TODO create extension wrappers for this
|
||||
export class Vote implements UpdateableNetwork {
|
||||
private contractWrapper: ContractWrapper<VoteERC20>;
|
||||
private storage: ThirdwebStorage;
|
||||
|
||||
@@ -57,7 +57,7 @@ import { ContractPublishedMetadata } from "../core/classes/contract-published-me
|
||||
import { ContractRoles } from "../core/classes/contract-roles";
|
||||
import { ContractRoyalty } from "../core/classes/contract-royalty";
|
||||
import { ContractPrimarySale } from "../core/classes/contract-sales";
|
||||
import { ContractWrapper } from "../core/classes/contract-wrapper";
|
||||
import { ContractWrapper } from "../core/classes/internal/contract-wrapper";
|
||||
import { Erc1155 } from "../core/classes/erc-1155";
|
||||
import { Erc20 } from "../core/classes/erc-20";
|
||||
import { Erc721 } from "../core/classes/erc-721";
|
||||
@@ -94,17 +94,17 @@ import { ExtensionManager } from "../core/classes/extension-manager";
|
||||
* // call any function in your contract
|
||||
* await contract.call("myCustomFunction", [param1, param2]);
|
||||
*
|
||||
* // if your contract follows the ERC721 standard, contract.nft will be present
|
||||
* const allNFTs = await contract.erc721.query.all()
|
||||
* // if your contract follows an ERC standard, contract.ercXYZ will be present
|
||||
* const allNFTs = await contract.erc721.getAll()
|
||||
*
|
||||
* // if your contract extends IMintableERC721, contract.nft.mint() will be available
|
||||
* // if your contract extends a particular contract extension, the corresponding function will be available
|
||||
* const tx = await contract.erc721.mint({
|
||||
* name: "Cool NFT",
|
||||
* image: readFileSync("some_image.png"),
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* @beta
|
||||
* @public
|
||||
*/
|
||||
export class SmartContract<
|
||||
TContract extends BaseContractInterface = BaseContract,
|
||||
@@ -118,7 +118,7 @@ export class SmartContract<
|
||||
public interceptor: ContractInterceptor<TContract>;
|
||||
public encoder: ContractEncoder<TContract>;
|
||||
public estimator: GasCostEstimator<TContract>;
|
||||
public publishedMetadata: ContractPublishedMetadata<TContract>;
|
||||
public publishedMetadata: ContractPublishedMetadata;
|
||||
public metadata: ContractMetadata<BaseContract, typeof CustomContractSchema>;
|
||||
|
||||
get abi(): Abi {
|
||||
@@ -149,14 +149,14 @@ export class SmartContract<
|
||||
/**
|
||||
* Handle platform fees
|
||||
*/
|
||||
get platformFees(): ContractPlatformFee<IPlatformFee> {
|
||||
get platformFees(): ContractPlatformFee {
|
||||
return assertEnabled(this.detectPlatformFees(), FEATURE_PLATFORM_FEE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set and get the owner of the contract
|
||||
*/
|
||||
get owner(): ContractOwner<Ownable> {
|
||||
get owner(): ContractOwner {
|
||||
return assertEnabled(this.detectOwnable(), FEATURE_OWNER);
|
||||
}
|
||||
|
||||
@@ -352,12 +352,12 @@ export class SmartContract<
|
||||
* const isAccountDeployed = await contract.accountFactory.isAccountDeployed(admin, extraData);
|
||||
* ```
|
||||
*/
|
||||
get accountFactory(): AccountFactory<IAccountFactory> {
|
||||
get accountFactory(): AccountFactory {
|
||||
return assertEnabled(this.detectAccountFactory(), FEATURE_ACCOUNT_FACTORY);
|
||||
}
|
||||
|
||||
// TODO documentation
|
||||
get account(): Account<IAccountCore> {
|
||||
get account(): Account {
|
||||
return assertEnabled(this.detectAccount(), FEATURE_ACCOUNT);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,13 +8,20 @@ import { isContractDeployed } from "../../common/any-evm-utils/isContractDeploye
|
||||
import { buildTransactionFunction } from "../../common/transactions";
|
||||
import { TransactionResultWithAddress } from "../types";
|
||||
import { ContractEvents } from "./contract-events";
|
||||
import { ContractWrapper } from "./contract-wrapper";
|
||||
import { ContractWrapper } from "./internal/contract-wrapper";
|
||||
import { Transaction } from "./transactions";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- TO BE REMOVED IN V4
|
||||
export class AccountFactory<TContract extends IAccountFactory>
|
||||
implements DetectableFeature
|
||||
{
|
||||
/**
|
||||
* Interact with ERC-4337 account factory contracts
|
||||
* @remarks Exposes useful functions available on the account factory contract.
|
||||
* @example
|
||||
* ```javascript
|
||||
* const contract = await sdk.getContract("{{contract_address}}");
|
||||
* await contract.accountFactory.predictAccountAddress(walletAddress);
|
||||
* ```
|
||||
* @public
|
||||
*/
|
||||
export class AccountFactory implements DetectableFeature {
|
||||
featureName = FEATURE_ACCOUNT_FACTORY.name;
|
||||
private contractWrapper: ContractWrapper<IAccountFactory>;
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import {
|
||||
FEATURE_ACCOUNT_PERMISSIONS,
|
||||
} from "../../constants/thirdweb-features";
|
||||
import { DetectableFeature } from "../interfaces/DetectableFeature";
|
||||
import { ContractWrapper } from "./contract-wrapper";
|
||||
import { ContractWrapper } from "./internal/contract-wrapper";
|
||||
|
||||
import type { IAccountCore } from "@thirdweb-dev/contracts-js";
|
||||
import { AddressOrEns } from "../../schema/shared/AddressOrEnsSchema";
|
||||
@@ -13,14 +13,21 @@ import {
|
||||
SignerWithPermissions,
|
||||
} from "../../types/account";
|
||||
import { buildTransactionFunction } from "../../common/transactions";
|
||||
import { AccountPermissions } from "./account-permissions";
|
||||
import { AccountPermissions } from "./internal/erc4337/account-permissions";
|
||||
import { detectContractFeature } from "../../common/feature-detection/detectContractFeature";
|
||||
import { assertEnabled } from "../../common/feature-detection/assertEnabled";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- TO BE REMOVED IN V4
|
||||
export class Account<TContract extends IAccountCore>
|
||||
implements DetectableFeature
|
||||
{
|
||||
/**
|
||||
* Interact with ERC-4337 accounts
|
||||
* @remarks Exposes useful functions available on account contracts.
|
||||
* @example
|
||||
* ```javascript
|
||||
* const contract = await sdk.getContract("{{contract_address}}");
|
||||
* await contract.account.getAllAdminsAndSigners();
|
||||
* ```
|
||||
* @public
|
||||
*/
|
||||
export class Account implements DetectableFeature {
|
||||
featureName = FEATURE_ACCOUNT.name;
|
||||
private contractWrapper: ContractWrapper<IAccountCore>;
|
||||
private accountPermissions: AccountPermissions | undefined;
|
||||
|
||||
@@ -11,7 +11,7 @@ import {
|
||||
Airdrop1155Output,
|
||||
} from "../../types/airdrop/airdrop";
|
||||
import { DetectableFeature } from "../interfaces/DetectableFeature";
|
||||
import { ContractWrapper } from "./contract-wrapper";
|
||||
import { ContractWrapper } from "./internal/contract-wrapper";
|
||||
import { Transaction } from "./transactions";
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,7 +4,7 @@ import { buildTransactionFunction } from "../../common/transactions";
|
||||
import { FEATURE_AIRDROP_ERC20 } from "../../constants/thirdweb-features";
|
||||
import { Address } from "../../schema/shared/Address";
|
||||
import { DetectableFeature } from "../interfaces/DetectableFeature";
|
||||
import { ContractWrapper } from "./contract-wrapper";
|
||||
import { ContractWrapper } from "./internal/contract-wrapper";
|
||||
import { Transaction } from "./transactions";
|
||||
import { Airdrop20Content, Airdrop20Output } from "../../types/airdrop/airdrop";
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
Airdrop721Output,
|
||||
} from "../../types/airdrop/airdrop";
|
||||
import { DetectableFeature } from "../interfaces/DetectableFeature";
|
||||
import { ContractWrapper } from "./contract-wrapper";
|
||||
import { ContractWrapper } from "./internal/contract-wrapper";
|
||||
import { Transaction } from "./transactions";
|
||||
|
||||
/**
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user