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

Commit 5c76595

Browse files
committed
Merge remote-tracking branch 'origin' into kien/dynamic-load-extensions-list
2 parents f51e247 + 29b36f2 commit 5c76595

File tree

20 files changed

+648
-121
lines changed

20 files changed

+648
-121
lines changed

src/app/connect/auth/page.mdx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,16 +80,24 @@ export default function App() {
8080
client={client}
8181
auth={{
8282
getLoginPayload: async (params) => {
83+
// here you should call your backend, using generatePayload to return
84+
// a SIWE compliant login payload to the client
8385
return thirdwebAuth.generatePayload(params)
8486
},
8587
doLogin: async (params) => {
86-
const verifiedPayload = await thirdwebAuth.verifyPayload(params);
88+
// here you should call your backend to verify the signed payload passed in params
89+
// this will verify that the signature matches the intended wallet
90+
const verifiedPayload = await thirdwebAuth.verifyPayload(params);
8791
setLoggedIn(verifiedPayload.valid)
8892
},
8993
isLoggedIn: async () => {
94+
// here you should ask you backend if the user is logged in
95+
// can use cookies, storage, or your method of choice
9096
return loggedIn;
9197
},
9298
doLogout: async () => {
99+
// here you should call your backend to logout the user if needed
100+
// and delete any local auth tokens
93101
setLoggedIn(false);
94102
}
95103
}}

src/app/connect/ecosystems/overview/page.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,6 @@ An ecosystem wallet is your own managed in-app wallet service that allows you to
5858

5959
## Pricing
6060

61-
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.
61+
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.
6262

6363
For pricing on unlimited wallets, contact our sales team.

src/app/connect/pay/customization/connectbutton/page.mdx

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export const metadata = createMetadata({
1111

1212
# Customize ConnectButton
1313

14-
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).
14+
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).
1515

1616
---
1717

@@ -51,21 +51,21 @@ import { base } from "thirdweb/chains";
5151
detailsModal={{
5252
payOptions: {
5353
prefillBuy: {
54-
token: {
55-
address: "0x866a087038f7C12cf33EF91aC5b1AcE6Ac1DA788",
56-
name: "Base ETH",
57-
symbol: "ETH",
58-
icon: "...", // optional
59-
},
60-
chain: base,
61-
allowEdits: {
62-
amount: true, // allow editing buy amount
63-
token: false, // disable selecting buy token
64-
chain: false, // disable selecting buy chain
54+
token: {
55+
address: "0x866a087038f7C12cf33EF91aC5b1AcE6Ac1DA788",
56+
name: "Base ETH",
57+
symbol: "ETH",
58+
icon: "...", // optional
59+
},
60+
chain: base,
61+
allowEdits: {
62+
amount: true, // allow editing buy amount
63+
token: false, // disable selecting buy token
64+
chain: false, // disable selecting buy chain
65+
},
6566
},
6667
},
6768
}}
68-
}
6969
/>;
7070
```
7171

@@ -79,7 +79,7 @@ If you'd like to prefill a purchase with a native token, you can set the chain w
7979
prefillBuy: {
8080
chain: base,
8181
},
82-
}
82+
},
8383
}}
8484
/>
8585
```
@@ -98,7 +98,7 @@ In some cases, you may only want to show users fiat or crypto payment options fo
9898
detailsModal={{
9999
payOptions: {
100100
buyWithCrypto: false,
101-
}
101+
},
102102
}}
103103
/>
104104
```
@@ -111,7 +111,7 @@ In some cases, you may only want to show users fiat or crypto payment options fo
111111
detailsModal={{
112112
payOptions: {
113113
buyWithFiat: false,
114-
}
114+
},
115115
}}
116116
/>
117117
```

src/app/connect/pay/customization/payembed/page.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export const metadata = createMetadata({
1111

1212
# PayEmbed Customization
1313

14-
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).
14+
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).
1515

1616
---
1717

src/app/connect/pay/overview/page.mdx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ Pay allows your users to purchase cryptocurrencies and execute transactions with
5959
description="Use pre-built modals or customize the transaction experience"
6060
iconUrl="/icons/feature-cards/integration-options.svg"
6161
/>
62+
<FeatureCard
63+
title="Secure"
64+
description="Strict one-time approvals mean user funds are not at risk of smart contract allowance exploits"
65+
iconUrl="/icons/feature-cards/security.svg"
66+
/>
6267

6368
</div>
6469

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
import { Tabs, TabsList, TabsTrigger, TabsContent } from "@/components/ui/tabs";
2+
import { createMetadata, Callout } from "@doc";
3+
4+
export const metadata = createMetadata({
5+
image: {
6+
title: "thirdweb Pay - Test Mode",
7+
icon: "thirdweb",
8+
},
9+
title: "thirdweb Pay - Test Mode - thirdweb",
10+
description: "thirdweb Pay - Test Mode",
11+
});
12+
13+
# Enable Test Mode
14+
15+
Developers can turn on Buy With Fiat Test Mode to test fiat-to-crypto transactions through our onramp providers.
16+
17+
<Callout variant="info">
18+
19+
Crypto-to-crypto transactions will remain on mainnet during test mode as Pay
20+
does not currently support testnets.
21+
22+
</Callout>
23+
24+
<Tabs defaultValue="connectbutton">
25+
26+
<TabsList>
27+
<TabsTrigger value="connectbutton">ConnectButton</TabsTrigger>
28+
<TabsTrigger value="payembed">PayEmbed</TabsTrigger>
29+
<TabsTrigger value="sendtxn">sendTransaction</TabsTrigger>
30+
</TabsList>
31+
32+
<TabsContent value='connectbutton'>
33+
34+
```tsx
35+
<ConnectButton
36+
client={client}
37+
detailsModal={{
38+
payOptions: {
39+
buyWithFiat: {
40+
testMode: true, // defaults to false
41+
},
42+
},
43+
}}
44+
/>
45+
```
46+
47+
</TabsContent>
48+
49+
<TabsContent value="payembed">
50+
51+
```tsx
52+
<PayEmbed
53+
client={client}
54+
payOptions={{
55+
buyWithFiat: {
56+
testMode: true, // defaults to false
57+
},
58+
}}
59+
/>
60+
```
61+
62+
</TabsContent>
63+
64+
<TabsContent value="sendtxn">
65+
66+
```tsx
67+
const { mutate: sendTransaction } = useSendTransaction({
68+
payModal: {
69+
buyWithFiat: {
70+
testMode: true, // defaults to false
71+
},
72+
},
73+
});
74+
```
75+
76+
</TabsContent>
77+
78+
</Tabs>

src/app/connect/sidebar.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,6 @@ export const sidebar: SideBar = {
384384
{
385385
name: "Pay",
386386
icon: <PayIcon />,
387-
// isCollapsible: true,
388387
links: [
389388
{
390389
name: "Overview",
@@ -452,6 +451,10 @@ export const sidebar: SideBar = {
452451
},
453452
],
454453
},
454+
{
455+
name: "Enable Test Mode",
456+
href: `${paySlug}/test-mode`,
457+
},
455458
{
456459
name: "Build a Custom Experience",
457460
href: `${paySlug}/build-a-custom-experience`,
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { Details, Callout, DocImage } from "@doc";
2+
import { createMetadata } from "@doc";
3+
4+
export const metadata = createMetadata({
5+
title: "Security | thirdweb Engine",
6+
description:
7+
"thirdweb Engine provides you with security features to configure and restrict access.",
8+
});
9+
10+
# Security
11+
12+
Engine provides you with security features to configure and restrict access to sensitive operations.
13+
14+
## IP Allowlist
15+
16+
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/).
17+
If an IP allowlist is not configured, Engine will allow all incoming requests.
18+
19+
<Callout variant="info" title="Note">
20+
This does not affect calls from the Engine dashboard to your Engine instance.
21+
</Callout>
22+
23+
## Domain Allowlist (CORS)
24+
25+
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/).
26+
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.

src/app/engine/self-host/page.mdx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ docker run \
6464
| `LOG_LEVEL` | Determines the logging severity level. Adjust for finer control over logged information. (Default: `debug`) |
6565
| `PRUNE_TRANSACTIONS` | When `false`, Engine prevents the pruning/deletion of processed transaction data. (Default: `true`) |
6666
| `ENABLE_KEYPAIR_AUTH` | Enables [Keypair Authentication](/engine/features/keypair-authentication). |
67+
| `TRUST_PROXY` | When `true`, trust the `X-Forwarded-For` header to allow Engine to use the correct client IP address for the IP allowlist. |
6768

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

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

132-
### FAQ
133-
134133
#### How do I filter logs in Engine?
135134

136135
Configure log verbosity via the `LOG_LEVEL` environment variable.
@@ -168,3 +167,7 @@ Example configuration:
168167
```bash
169168
POSTGRES_CONNECTION_URL=postgres://postgres:postgres@localhost:5432/postgres?connection_limit=10
170169
```
170+
171+
#### What is `x-forwarded-for` and how does it affect Engine?
172+
173+
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.

src/app/engine/sidebar.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ export const sidebar: SideBar = {
6868
name: "Contract Subscriptions",
6969
href: `${engineSlug}/features/contract-subscriptions`,
7070
},
71+
{
72+
name: "Security",
73+
href: `${engineSlug}/features/security`,
74+
},
7175
],
7276
},
7377
{

0 commit comments

Comments
 (0)