Skip to content

Commit 19a7dd6

Browse files
committed
Merge branch 'main' into yash/ref-constructor-params
2 parents 2b38276 + ebf94a6 commit 19a7dd6

File tree

43 files changed

+759
-223
lines changed

Some content is hidden

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

43 files changed

+759
-223
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]/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}

apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/[tokenId]/token-id.tsx

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import type { ThirdwebContract } from "thirdweb";
2727
import { getNFT as getErc721NFT } from "thirdweb/extensions/erc721";
2828
import { getNFT as getErc1155NFT } from "thirdweb/extensions/erc1155";
2929
import { useReadContract } from "thirdweb/react";
30-
import { Button, Card, Heading, Text } from "tw-components";
30+
import { Button, Card } from "tw-components";
3131
import { NFTMediaWithEmptyState } from "tw-components/nft-media";
3232
import { shortenString } from "utils/usedapp-external";
3333
import { NftProperty } from "../components/nft-property";
@@ -103,10 +103,10 @@ export const TokenIdPage: React.FC<TokenIdPageProps> = ({
103103

104104
if (!nft) {
105105
return (
106-
<Text>
106+
<p>
107107
No NFT found with token ID {tokenId}. Please check the token ID and try
108108
again.
109-
</Text>
109+
</p>
110110
);
111111
}
112112

@@ -181,7 +181,7 @@ export const TokenIdPage: React.FC<TokenIdPageProps> = ({
181181
label={
182182
tb.isDisabled ? (
183183
<Card py={2} px={4} bgColor="backgroundHighlight">
184-
<Text size="label.sm">{tb.disabledText}</Text>
184+
<p>{tb.disabledText}</p>
185185
</Card>
186186
) : (
187187
""
@@ -213,7 +213,7 @@ export const TokenIdPage: React.FC<TokenIdPageProps> = ({
213213
<Card as={Flex} flexDir="column" gap={3}>
214214
<SimpleGrid rowGap={3} columns={12} placeItems="center left">
215215
<GridItem colSpan={4}>
216-
<Heading size="label.md">Token ID</Heading>
216+
<p className="font-semibold">Token ID</p>
217217
</GridItem>
218218
<GridItem colSpan={8}>
219219
<CopyTextButton
@@ -227,31 +227,29 @@ export const TokenIdPage: React.FC<TokenIdPageProps> = ({
227227
{nft.owner && (
228228
<>
229229
<GridItem colSpan={4}>
230-
<Heading size="label.md">Owner</Heading>
230+
<p className="font-semibold">Owner</p>
231231
</GridItem>
232232
<GridItem colSpan={8}>
233233
<WalletAddress address={nft.owner} />
234234
</GridItem>
235235
</>
236236
)}
237237
<GridItem colSpan={4}>
238-
<Heading size="label.md">Token Standard</Heading>
238+
<p className="font-semibold">Token Standard</p>
239239
</GridItem>
240240
<GridItem colSpan={8}>{nft.type}</GridItem>
241241
{nft.type !== "ERC721" && (
242242
<>
243243
<GridItem colSpan={4}>
244-
<Heading size="label.md">Supply</Heading>
244+
<p className="font-semibold">Supply</p>
245245
</GridItem>
246246
<GridItem colSpan={8}>
247-
<Text fontFamily="mono" size="body.md">
248-
{nft.supply.toString()}
249-
</Text>
247+
<p>{nft.supply.toLocaleString("en-US")}</p>
250248
</GridItem>
251249
</>
252250
)}
253251
<GridItem colSpan={4}>
254-
<Heading size="label.md">Token URI</Heading>
252+
<p className="font-semibold">Token URI</p>
255253
</GridItem>
256254
<GridItem
257255
colSpan={8}
@@ -274,7 +272,7 @@ export const TokenIdPage: React.FC<TokenIdPageProps> = ({
274272
{nft.metadata.image && (
275273
<>
276274
<GridItem colSpan={4}>
277-
<Heading size="label.md">Media URI</Heading>
275+
<p className="font-semibold">Media URI</p>
278276
</GridItem>
279277
<GridItem
280278
colSpan={8}
@@ -300,7 +298,7 @@ export const TokenIdPage: React.FC<TokenIdPageProps> = ({
300298
</Card>
301299
{properties ? (
302300
<Card as={Flex} flexDir="column" gap={4}>
303-
<Heading size="label.md">Attributes</Heading>
301+
<p className="font-semibold">Attributes</p>
304302
{Array.isArray(properties) &&
305303
String(properties[0]?.value) !== "undefined" ? (
306304
<SimpleGrid columns={{ base: 2, md: 4 }} gap={2}>

0 commit comments

Comments
 (0)