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

Commit

Permalink
Merge remote-tracking branch 'origin' into kien/dynamic-load-extensio…
Browse files Browse the repository at this point in the history
…ns-list
  • Loading branch information
kien-ngo committed Jul 19, 2024
2 parents f51e247 + 29b36f2 commit 5c76595
Show file tree
Hide file tree
Showing 20 changed files with 648 additions and 121 deletions.
10 changes: 9 additions & 1 deletion src/app/connect/auth/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,24 @@ export default function App() {
client={client}
auth={{
getLoginPayload: async (params) => {
// here you should call your backend, using generatePayload to return
// a SIWE compliant login payload to the client
return thirdwebAuth.generatePayload(params)
},
doLogin: async (params) => {
const verifiedPayload = await thirdwebAuth.verifyPayload(params);
// here you should call your backend to verify the signed payload passed in params
// this will verify that the signature matches the intended wallet
const verifiedPayload = await thirdwebAuth.verifyPayload(params);
setLoggedIn(verifiedPayload.valid)
},
isLoggedIn: async () => {
// here you should ask you backend if the user is logged in
// can use cookies, storage, or your method of choice
return loggedIn;
},
doLogout: async () => {
// here you should call your backend to logout the user if needed
// and delete any local auth tokens
setLoggedIn(false);
}
}}
Expand Down
2 changes: 1 addition & 1 deletion src/app/connect/ecosystems/overview/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,6 @@ An ecosystem wallet is your own managed in-app wallet service that allows you to

## Pricing

Ecosystem Wallets start at $250/mo per instance. Instances allow for up to 30,000 in-app wallets per month and $0.02 per additional in-app wallet.
Ecosystem Wallets start at $250/mo per instance. Instances allow for up to 30,000 monthly active in-app wallets and $0.02 per additional monthly active in-app wallet.

For pricing on unlimited wallets, contact our sales team.
32 changes: 16 additions & 16 deletions src/app/connect/pay/customization/connectbutton/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const metadata = createMetadata({

# Customize ConnectButton

Learn how to customize Pay within the `ConnectButton` interface. You can find a selection of popular customizations below. For the full list of props, you can [view the full reference](/references/typescript/v5/connectbuttonprops).
Learn how to customize Pay within the `ConnectButton` interface. You can find a selection of popular customizations below. For the full list of props, you can [view the full reference](/references/typescript/v5/ConnectButtonProps).

---

Expand Down Expand Up @@ -51,21 +51,21 @@ import { base } from "thirdweb/chains";
detailsModal={{
payOptions: {
prefillBuy: {
token: {
address: "0x866a087038f7C12cf33EF91aC5b1AcE6Ac1DA788",
name: "Base ETH",
symbol: "ETH",
icon: "...", // optional
},
chain: base,
allowEdits: {
amount: true, // allow editing buy amount
token: false, // disable selecting buy token
chain: false, // disable selecting buy chain
token: {
address: "0x866a087038f7C12cf33EF91aC5b1AcE6Ac1DA788",
name: "Base ETH",
symbol: "ETH",
icon: "...", // optional
},
chain: base,
allowEdits: {
amount: true, // allow editing buy amount
token: false, // disable selecting buy token
chain: false, // disable selecting buy chain
},
},
},
}}
}
/>;
```

Expand All @@ -79,7 +79,7 @@ If you'd like to prefill a purchase with a native token, you can set the chain w
prefillBuy: {
chain: base,
},
}
},
}}
/>
```
Expand All @@ -98,7 +98,7 @@ In some cases, you may only want to show users fiat or crypto payment options fo
detailsModal={{
payOptions: {
buyWithCrypto: false,
}
},
}}
/>
```
Expand All @@ -111,7 +111,7 @@ In some cases, you may only want to show users fiat or crypto payment options fo
detailsModal={{
payOptions: {
buyWithFiat: false,
}
},
}}
/>
```
Expand Down
2 changes: 1 addition & 1 deletion src/app/connect/pay/customization/payembed/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const metadata = createMetadata({

# PayEmbed Customization

Learn how to customize the `PayEmbed`. You can find a selection of popular customizations below. For the full list of props, you can [view the full reference](/references/typescript/v5/payembedprops).
Learn how to customize the `PayEmbed`. You can find a selection of popular customizations below. For the full list of props, you can [view the full reference](/references/typescript/v5/PayEmbedProps).

---

Expand Down
5 changes: 5 additions & 0 deletions src/app/connect/pay/overview/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ Pay allows your users to purchase cryptocurrencies and execute transactions with
description="Use pre-built modals or customize the transaction experience"
iconUrl="/icons/feature-cards/integration-options.svg"
/>
<FeatureCard
title="Secure"
description="Strict one-time approvals mean user funds are not at risk of smart contract allowance exploits"
iconUrl="/icons/feature-cards/security.svg"
/>

</div>

Expand Down
78 changes: 78 additions & 0 deletions src/app/connect/pay/test-mode/page.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
import { Tabs, TabsList, TabsTrigger, TabsContent } from "@/components/ui/tabs";
import { createMetadata, Callout } from "@doc";

export const metadata = createMetadata({
image: {
title: "thirdweb Pay - Test Mode",
icon: "thirdweb",
},
title: "thirdweb Pay - Test Mode - thirdweb",
description: "thirdweb Pay - Test Mode",
});

# Enable Test Mode

Developers can turn on Buy With Fiat Test Mode to test fiat-to-crypto transactions through our onramp providers.

<Callout variant="info">

Crypto-to-crypto transactions will remain on mainnet during test mode as Pay
does not currently support testnets.

</Callout>

<Tabs defaultValue="connectbutton">

<TabsList>
<TabsTrigger value="connectbutton">ConnectButton</TabsTrigger>
<TabsTrigger value="payembed">PayEmbed</TabsTrigger>
<TabsTrigger value="sendtxn">sendTransaction</TabsTrigger>
</TabsList>

<TabsContent value='connectbutton'>

```tsx
<ConnectButton
client={client}
detailsModal={{
payOptions: {
buyWithFiat: {
testMode: true, // defaults to false
},
},
}}
/>
```

</TabsContent>

<TabsContent value="payembed">

```tsx
<PayEmbed
client={client}
payOptions={{
buyWithFiat: {
testMode: true, // defaults to false
},
}}
/>
```

</TabsContent>

<TabsContent value="sendtxn">

```tsx
const { mutate: sendTransaction } = useSendTransaction({
payModal: {
buyWithFiat: {
testMode: true, // defaults to false
},
},
});
```

</TabsContent>

</Tabs>
5 changes: 4 additions & 1 deletion src/app/connect/sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,6 @@ export const sidebar: SideBar = {
{
name: "Pay",
icon: <PayIcon />,
// isCollapsible: true,
links: [
{
name: "Overview",
Expand Down Expand Up @@ -452,6 +451,10 @@ export const sidebar: SideBar = {
},
],
},
{
name: "Enable Test Mode",
href: `${paySlug}/test-mode`,
},
{
name: "Build a Custom Experience",
href: `${paySlug}/build-a-custom-experience`,
Expand Down
26 changes: 26 additions & 0 deletions src/app/engine/features/security/page.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { Details, Callout, DocImage } from "@doc";
import { createMetadata } from "@doc";

export const metadata = createMetadata({
title: "Security | thirdweb Engine",
description:
"thirdweb Engine provides you with security features to configure and restrict access.",
});

# Security

Engine provides you with security features to configure and restrict access to sensitive operations.

## IP Allowlist

You can restrict access to your Engine instance by configuring an IP allowlist. This can be configured in the **Configuration** section of the [Engine dashboard](https://thirdweb.com/dashboard/engine/).
If an IP allowlist is not configured, Engine will allow all incoming requests.

<Callout variant="info" title="Note">
This does not affect calls from the Engine dashboard to your Engine instance.
</Callout>

## Domain Allowlist (CORS)

You can restrict access to your Engine instance by configuring a domain allowlist. This can be configured in the **Configuration** section of the [Engine dashboard](https://thirdweb.com/dashboard/engine/).
Multiple domains can be added to the allowlist, and Engine will only accept requests from these domains. A wildcard domain can also be added to allow requests from any domain.
7 changes: 5 additions & 2 deletions src/app/engine/self-host/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ docker run \
| `LOG_LEVEL` | Determines the logging severity level. Adjust for finer control over logged information. (Default: `debug`) |
| `PRUNE_TRANSACTIONS` | When `false`, Engine prevents the pruning/deletion of processed transaction data. (Default: `true`) |
| `ENABLE_KEYPAIR_AUTH` | Enables [Keypair Authentication](/engine/features/keypair-authentication). |
| `TRUST_PROXY` | When `true`, trust the `X-Forwarded-For` header to allow Engine to use the correct client IP address for the IP allowlist. |

<span style={{ color: "red" }}>*</span> Required

Expand Down Expand Up @@ -129,8 +130,6 @@ See [Production Checklist](/engine/production-checklist#cloud-hosting) for best
- Minimum specs: 2 vCPU, 2 GB memory (AWS equivalent: t4g.small)
- Set the `connection_limit` parameter within your `POSTGRES_CONNECTION_URL` environment variable to `10`.

### FAQ

#### How do I filter logs in Engine?

Configure log verbosity via the `LOG_LEVEL` environment variable.
Expand Down Expand Up @@ -168,3 +167,7 @@ Example configuration:
```bash
POSTGRES_CONNECTION_URL=postgres://postgres:postgres@localhost:5432/postgres?connection_limit=10
```

#### What is `x-forwarded-for` and how does it affect Engine?

If you have engine running on a server behind a reverse proxy, you can set the `TRUST_PROXY` environment variable to `true` to trust the `X-Forwarded-For` header. Reverse proxies like Nginx or Apache will add this header to the request with the original client IP address, and setting this variable will allow Engine to use the correct IP address for the IP Allowlist. For more details on IP Allowlisting, refer to the [Security Features](/engine/features/security) page.
4 changes: 4 additions & 0 deletions src/app/engine/sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ export const sidebar: SideBar = {
name: "Contract Subscriptions",
href: `${engineSlug}/features/contract-subscriptions`,
},
{
name: "Security",
href: `${engineSlug}/features/security`,
},
],
},
{
Expand Down
7 changes: 3 additions & 4 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,10 @@ export default function Page() {
<main className="container grow pb-20">
<Hero />
{/* <TutorialsSection /> */}
<SDKSection />
<WalletsSection />
<ContractsSection />
<EngineSection />

<SDKSection />
<ContractsSection />
</main>
);
}
Expand Down Expand Up @@ -335,7 +334,7 @@ function EngineSection() {
function SDKSection() {
return (
<section className="my-12">
<SectionTitle id="sdk" title="SDKs" />
<SectionTitle id="sdk" title="Get Started" />

<Grid>
<SDKCardIndex
Expand Down
25 changes: 14 additions & 11 deletions src/app/typescript/v5/react-native/getting-started/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,17 @@ We recommend starting a new thirdweb React Native project using our CLI, which s
In your CLI, run:

```bash
npx thirdweb create --react-native
npx thirdweb create --legacy-peer-deps --react-native
```

or clone the [expo-starter](https://github.com/thirdweb-dev/expo-starter) repo using git.

<GithubTemplateCard
title="Expo + thirdweb demo repo"
descrption="A starter template for using the thirdweb package in a React Native app"
href="https://github.com/thirdweb-dev/expo-starter"
/>

### Manual Installation

To manually install the React Native SDK, you'll need to install the `@thirdweb/react-native-adapter` package from npm on top of the `thirdweb` package.
Expand Down Expand Up @@ -48,9 +56,13 @@ amazon-cognito-identity-js // for authentication
react-native-aes-gcm-crypto // for encryption
react-native-quick-crypto@0.7.0-rc.6 // for fast hashing

// optional for coinbase wallet
// needed for coinbase wallet
@coinbase/wallet-mobile-sdk
react-native-mmkv

// needed for UI components
react-native-svg
@react-native-clipboard/clipboard
```

</Step>
Expand Down Expand Up @@ -161,12 +173,3 @@ If the Expo CLI says "Using Expo Go" when starting the app, press `s` to switch

</Callout>

### Starter app

If you want to get started quickly run `npx thirdweb create --react-native`, or clone the [expo-starter](https://github.com/thirdweb-dev/expo-starter) repo using git.

<GithubTemplateCard
title="Expo + thirdweb demo repo"
descrption="A starter template for using the thirdweb package in a React Native app"
href="https://github.com/thirdweb-dev/expo-starter"
/>
Loading

0 comments on commit 5c76595

Please sign in to comment.