Skip to content

Commit 046c04b

Browse files
committed
Merge branch 'main' into greg/cnct-2303-viem-ox-transaction-envelopes
2 parents f200de3 + 4ae50f5 commit 046c04b

File tree

45 files changed

+730
-249
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+730
-249
lines changed

.changeset/clever-carrots-march.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/pink-ducks-flash.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/selfish-deers-destroy.md

Lines changed: 0 additions & 30 deletions
This file was deleted.

.changeset/stupid-buses-wink.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
"thirdweb": minor
3+
---
4+
5+
Add 2 new Pay functions: convertFiatToCrypto and convertCryptoToFiat
6+
7+
Examples:
8+
9+
### Convert fiat (USD) to crypto
10+
```ts
11+
import { convertFiatToCrypto } from "thirdweb/pay";
12+
import { ethereum } from "thirdweb/chains";
13+
14+
// Convert 2 cents to ETH
15+
const result = await convertFiatToCrypto({
16+
from: "USD",
17+
// the token address. For native token, use NATIVE_TOKEN_ADDRESS
18+
to: "0x...",
19+
// the chain (of the chain where the token belong to)
20+
chain: ethereum,
21+
// 2 cents
22+
fromAmount: 0.02,
23+
});
24+
// Result: 0.0000057 (a number)
25+
```
26+
27+
### Convert crypto to fiat (USD)
28+
29+
```ts
30+
import { convertCryptoToFiat } from "thirdweb/pay";
31+
32+
// Get Ethereum price
33+
const result = convertCryptoToFiat({
34+
fromTokenAddress: NATIVE_TOKEN_ADDRESS,
35+
to: "USD",
36+
chain: ethereum,
37+
fromAmount: 1,
38+
});
39+
40+
// Result: 3404.11 (number)
41+
```

.changeset/wild-games-vanish.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"thirdweb": patch
3+
---
4+
5+
Handle 0 value for maxPriorityFeePerGas in 712 transactions

apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/_components/claim-conditions/claim-conditions-form/Inputs/ClaimerSelection.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
import { Button } from "@/components/ui/button";
12
import { Box, Flex, Select } from "@chakra-ui/react";
23
import { UploadIcon } from "lucide-react";
3-
import { Button, Text } from "tw-components";
44
import { useClaimConditionsFormContext } from "..";
55
import { CustomFormControl } from "../common";
66

@@ -115,13 +115,13 @@ export const ClaimerSelection = () => {
115115
>
116116
{/* disable the "Edit" button when form is disabled, but not when it's a "See" button */}
117117
<Button
118-
colorScheme="purple"
119-
isDisabled={disabledSnapshotButton}
120-
borderRadius="md"
118+
variant="primary"
119+
disabled={disabledSnapshotButton}
120+
className="gap-2 rounded-md"
121121
onClick={() => setOpenIndex(phaseIndex)}
122-
rightIcon={<UploadIcon className="size-4" />}
123122
>
124123
{isAdmin ? "Edit" : "See"} Claimer Snapshot
124+
<UploadIcon className="size-4" />
125125
</Button>
126126

127127
<Flex
@@ -136,14 +136,14 @@ export const ClaimerSelection = () => {
136136
}}
137137
ml={2}
138138
>
139-
<Text size="body.sm" color="inherit">
139+
<p>
140140
{" "}
141141
<strong>
142142
{field.snapshot?.length} address
143143
{field.snapshot?.length === 1 ? "" : "es"}
144144
</strong>{" "}
145145
in snapshot
146-
</Text>
146+
</p>
147147
</Flex>
148148
</Flex>
149149
) : (

apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/_components/claim-conditions/snapshot-upload.tsx

Lines changed: 25 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import {
99
} from "@/components/ui/sheet";
1010
import { ToolTipLabel } from "@/components/ui/tooltip";
1111
import { cn } from "@/lib/utils";
12-
import { Box, Flex, Link } from "@chakra-ui/react";
1312
import { useCsvUpload } from "hooks/useCsvUpload";
1413
import { CircleAlertIcon, DownloadIcon, UploadIcon } from "lucide-react";
1514
import { type Dispatch, type SetStateAction, useRef } from "react";
@@ -159,13 +158,7 @@ export const SnapshotUpload: React.FC<SnapshotUploadProps> = ({
159158
columns={columns}
160159
/>
161160
) : (
162-
<Flex
163-
flexGrow={1}
164-
align="center"
165-
overflow="auto"
166-
gap={8}
167-
flexDir="column"
168-
>
161+
<div className="flex grow flex-col items-center gap-8 overflow-auto">
169162
<div className="relative aspect-[21/9] w-full">
170163
<div
171164
className={cn(
@@ -204,29 +197,29 @@ export const SnapshotUpload: React.FC<SnapshotUploadProps> = ({
204197
addresses and their <InlineCode code="maxClaimable" />.
205198
(amount each wallet is allowed to claim)
206199
<br />
207-
<Link
200+
<a
201+
className="text-link-foreground hover:text-foreground"
208202
download
209-
color="blue.500"
210203
href="/snapshot-with-maxclaimable.csv"
211204
>
212205
<DownloadIcon className="inline size-3" /> Example
213206
snapshot
214-
</Link>
207+
</a>
215208
</li>
216209
<li>
217210
You may optionally add <InlineCode code="price" /> and
218211
<InlineCode code="currencyAddress" /> overrides as well.
219212
This lets you override the currency and price you would
220213
like to charge per wallet you specified
221214
<br />
222-
<Link
215+
<a
223216
download
224-
color="blue.500"
217+
className="text-link-foreground hover:text-foreground"
225218
href="/snapshot-with-overrides.csv"
226219
>
227220
<DownloadIcon className="inline size-3" /> Example
228221
snapshot
229-
</Link>
222+
</a>
230223
</li>
231224
</>
232225
) : (
@@ -235,10 +228,14 @@ export const SnapshotUpload: React.FC<SnapshotUploadProps> = ({
235228
Files <em>must</em> contain one .csv file with a list of
236229
addresses.
237230
<br />
238-
<Link download color="blue.500" href="/snapshot.csv">
231+
<a
232+
download
233+
className="text-link-foreground hover:text-foreground"
234+
href="/snapshot.csv"
235+
>
239236
<DownloadIcon className="inline size-3" /> Example
240237
snapshot
241-
</Link>
238+
</a>
242239
</li>
243240
<li>
244241
You may optionally add a{" "}
@@ -247,14 +244,14 @@ export const SnapshotUpload: React.FC<SnapshotUploadProps> = ({
247244
claim) If not specified, the default value is the one
248245
you have set on your claim phase.
249246
<br />
250-
<Link
247+
<a
251248
download
252-
color="blue.500"
249+
className="text-link-foreground hover:text-foreground"
253250
href="/snapshot-with-maxclaimable.csv"
254251
>
255252
<DownloadIcon className="inline size-3" /> Example
256253
snapshot
257-
</Link>
254+
</a>
258255
</li>
259256
<li>
260257
You may optionally add <InlineCode code="price" /> and
@@ -266,14 +263,14 @@ export const SnapshotUpload: React.FC<SnapshotUploadProps> = ({
266263
define a price override.
267264
</strong>
268265
<br />
269-
<Link
266+
<a
270267
download
271-
color="blue.500"
268+
className="text-link-foreground hover:text-foreground"
272269
href="/snapshot-with-overrides.csv"
273270
>
274271
<DownloadIcon className="inline size-3" /> Example
275272
snapshot
276-
</Link>
273+
</a>
277274
</li>
278275
</>
279276
)}
@@ -287,25 +284,12 @@ export const SnapshotUpload: React.FC<SnapshotUploadProps> = ({
287284
</li>
288285
</UnorderedList>
289286
</div>
290-
</Flex>
287+
</div>
291288
)}
292-
<Flex
293-
align="center"
294-
justify="space-between"
295-
p={{ base: 0, md: 4 }}
296-
flexDir={{ base: "column", md: "row" }}
297-
mt={{ base: 4, md: 0 }}
298-
borderTop="1px solid"
299-
borderTopColor="borderColor"
300-
>
301-
<Box ref={paginationPortalRef} />
289+
<div className="mt-4 flex flex-col items-center justify-between border-t p-0 md:mt-0 md:flex-row md:p-4">
290+
<div ref={paginationPortalRef} />
302291
{!isDisabled && (
303-
<Flex
304-
gap={2}
305-
align="center"
306-
mt={{ base: 4, md: 0 }}
307-
w={{ base: "100%", md: "auto" }}
308-
>
292+
<div className="mt-4 flex w-full flex-row items-center gap-2 md:mt-0 md:w-auto">
309293
<Button
310294
className="w-full rounded-md md:w-auto"
311295
disabled={isDisabled || rawData.length === 0}
@@ -336,9 +320,9 @@ export const SnapshotUpload: React.FC<SnapshotUploadProps> = ({
336320
Next
337321
</Button>
338322
)}
339-
</Flex>
323+
</div>
340324
)}
341-
</Flex>
325+
</div>
342326
</div>
343327
</SheetContent>
344328
</Sheet>

apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/account/components/nfts-owned.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import { useWalletNFTs } from "@3rdweb-sdk/react";
44
import type { ThirdwebContract } from "thirdweb";
5-
import { Text } from "tw-components";
65
import { NFTCards } from "../../_components/NFTCards";
76

87
interface NftsOwnedProps {
@@ -35,8 +34,8 @@ export const NftsOwned: React.FC<NftsOwnedProps> = ({ contract }) => {
3534
trackingCategory="account_nfts_owned"
3635
/>
3736
) : isWalletNFTsLoading ? null : error ? (
38-
<Text>Failed to fetch NFTs for this account: {error}</Text>
37+
<p>Failed to fetch NFTs for this account: {error}</p>
3938
) : (
40-
<Text>This account doesn&apos;t own any NFTs.</Text>
39+
<p>This account doesn&apos;t own any NFTs.</p>
4140
);
4241
};

apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/accounts/components/create-account-button.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
"use client";
22

3+
import { Button } from "@/components/ui/button";
4+
import { Card } from "@/components/ui/card";
35
import { Tooltip } from "@chakra-ui/react";
46
import { TransactionButton } from "components/buttons/TransactionButton";
57
import type { ThirdwebContract } from "thirdweb";
@@ -9,7 +11,6 @@ import {
911
useReadContract,
1012
useSendAndConfirmTransaction,
1113
} from "thirdweb/react";
12-
import { Button, Card, Text } from "tw-components";
1314

1415
interface CreateAccountButtonProps {
1516
contract: ThirdwebContract;
@@ -51,8 +52,8 @@ export const CreateAccountButton: React.FC<CreateAccountButtonProps> = ({
5152
return (
5253
<Tooltip
5354
label={
54-
<Card py={2} px={4} bgColor="backgroundHighlight">
55-
<Text>You can only initialize one account per EOA.</Text>
55+
<Card className="bg-card px-4 py-2">
56+
<p>You can only initialize one account per EOA.</p>
5657
</Card>
5758
}
5859
bg="transparent"
@@ -62,7 +63,7 @@ export const CreateAccountButton: React.FC<CreateAccountButtonProps> = ({
6263
placement="right"
6364
shouldWrapChildren
6465
>
65-
<Button colorScheme="primary" isDisabled>
66+
<Button variant="primary" disabled>
6667
Account Created
6768
</Button>
6869
</Tooltip>

apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/[tokenId]/components/airdrop-tab.tsx

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"use client";
22

3+
import { Button } from "@/components/ui/button";
34
import {
45
Sheet,
56
SheetContent,
@@ -18,7 +19,6 @@ import type { ThirdwebContract } from "thirdweb";
1819
import { multicall } from "thirdweb/extensions/common";
1920
import { balanceOf, encodeSafeTransferFrom } from "thirdweb/extensions/erc1155";
2021
import { useActiveAccount, useSendAndConfirmTransaction } from "thirdweb/react";
21-
import { Button, Text } from "tw-components";
2222
import {
2323
type AirdropAddressInput,
2424
AirdropUpload,
@@ -118,12 +118,8 @@ const AirdropTab: React.FC<AirdropTabProps> = ({ contract, tokenId }) => {
118118
<Flex direction={{ base: "column", md: "row" }} gap={4}>
119119
<Sheet open={open} onOpenChange={setOpen}>
120120
<SheetTrigger asChild>
121-
<Button
122-
colorScheme="primary"
123-
borderRadius="md"
124-
rightIcon={<UploadIcon className="size-5" />}
125-
>
126-
Upload addresses
121+
<Button variant="primary" className="rounded-md">
122+
Upload addresses <UploadIcon className="mr-2 size-5" />
127123
</Button>
128124
</SheetTrigger>
129125
<SheetContent className="w-full overflow-y-auto sm:min-w-[540px] lg:min-w-[700px]">
@@ -149,18 +145,18 @@ const AirdropTab: React.FC<AirdropTabProps> = ({ contract, tokenId }) => {
149145
color={addresses.length === 0 ? "orange.500" : "green.500"}
150146
>
151147
{addresses.length > 0 && (
152-
<Text size="body.sm" color="inherit">
148+
<p>
153149
<strong>{addresses.length} addresses</strong> ready to be
154150
airdropped
155-
</Text>
151+
</p>
156152
)}
157153
</Flex>
158154
</Flex>
159155
</div>
160-
<Text>
156+
<p>
161157
You can airdrop to a maximum of 250 addresses at a time. If you have
162158
more, please do it in multiple transactions.
163-
</Text>
159+
</p>
164160
<TransactionButton
165161
txChainID={contract.chain.id}
166162
transactionCount={1}

0 commit comments

Comments
 (0)