thirdweb 5.105.37 → 5.105.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/adapters/eip1193/to-eip1193.js +12 -3
- package/dist/cjs/adapters/eip1193/to-eip1193.js.map +1 -1
- package/dist/cjs/bridge/Token.js +4 -1
- package/dist/cjs/bridge/Token.js.map +1 -1
- package/dist/cjs/react/web/ui/Bridge/BridgeOrchestrator.js +2 -2
- package/dist/cjs/react/web/ui/Bridge/BridgeOrchestrator.js.map +1 -1
- package/dist/cjs/react/web/ui/Bridge/CheckoutWidget.js +6 -0
- package/dist/cjs/react/web/ui/Bridge/CheckoutWidget.js.map +1 -1
- package/dist/cjs/react/web/ui/Bridge/DirectPayment.js +2 -12
- package/dist/cjs/react/web/ui/Bridge/DirectPayment.js.map +1 -1
- package/dist/cjs/react/web/ui/Bridge/FundWallet.js.map +1 -1
- package/dist/cjs/react/web/ui/Bridge/TransactionPayment.js.map +1 -1
- package/dist/cjs/react/web/ui/Bridge/payment-selection/WalletFiatSelection.js +2 -2
- package/dist/cjs/react/web/ui/Bridge/payment-selection/WalletFiatSelection.js.map +1 -1
- package/dist/cjs/react/web/ui/Bridge/payment-success/SuccessScreen.js +6 -2
- package/dist/cjs/react/web/ui/Bridge/payment-success/SuccessScreen.js.map +1 -1
- package/dist/cjs/stories/Bridge/SuccessScreen.stories.js +14 -1
- package/dist/cjs/stories/Bridge/SuccessScreen.stories.js.map +1 -1
- package/dist/cjs/stories/Bridge/fixtures.js.map +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/wallets/wallet-connect/controller.js +3 -2
- package/dist/cjs/wallets/wallet-connect/controller.js.map +1 -1
- package/dist/esm/adapters/eip1193/to-eip1193.js +12 -3
- package/dist/esm/adapters/eip1193/to-eip1193.js.map +1 -1
- package/dist/esm/bridge/Token.js +4 -1
- package/dist/esm/bridge/Token.js.map +1 -1
- package/dist/esm/react/web/ui/Bridge/BridgeOrchestrator.js +2 -2
- package/dist/esm/react/web/ui/Bridge/BridgeOrchestrator.js.map +1 -1
- package/dist/esm/react/web/ui/Bridge/CheckoutWidget.js +7 -1
- package/dist/esm/react/web/ui/Bridge/CheckoutWidget.js.map +1 -1
- package/dist/esm/react/web/ui/Bridge/DirectPayment.js +2 -12
- package/dist/esm/react/web/ui/Bridge/DirectPayment.js.map +1 -1
- package/dist/esm/react/web/ui/Bridge/FundWallet.js.map +1 -1
- package/dist/esm/react/web/ui/Bridge/TransactionPayment.js.map +1 -1
- package/dist/esm/react/web/ui/Bridge/payment-selection/WalletFiatSelection.js +2 -2
- package/dist/esm/react/web/ui/Bridge/payment-selection/WalletFiatSelection.js.map +1 -1
- package/dist/esm/react/web/ui/Bridge/payment-success/SuccessScreen.js +6 -2
- package/dist/esm/react/web/ui/Bridge/payment-success/SuccessScreen.js.map +1 -1
- package/dist/esm/stories/Bridge/SuccessScreen.stories.js +13 -0
- package/dist/esm/stories/Bridge/SuccessScreen.stories.js.map +1 -1
- package/dist/esm/stories/Bridge/fixtures.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/wallets/wallet-connect/controller.js +3 -2
- package/dist/esm/wallets/wallet-connect/controller.js.map +1 -1
- package/dist/types/adapters/eip1193/to-eip1193.d.ts.map +1 -1
- package/dist/types/bridge/Onramp.d.ts +2 -2
- package/dist/types/bridge/Onramp.d.ts.map +1 -1
- package/dist/types/bridge/Token.d.ts +7 -5
- package/dist/types/bridge/Token.d.ts.map +1 -1
- package/dist/types/bridge/index.d.ts +1 -1
- package/dist/types/bridge/index.d.ts.map +1 -1
- package/dist/types/bridge/types/Route.d.ts +7 -7
- package/dist/types/bridge/types/Route.d.ts.map +1 -1
- package/dist/types/bridge/types/Token.d.ts +2 -0
- package/dist/types/bridge/types/Token.d.ts.map +1 -1
- package/dist/types/pay/convert/get-token.d.ts +2 -2
- package/dist/types/pay/convert/get-token.d.ts.map +1 -1
- package/dist/types/react/core/hooks/usePaymentMethods.d.ts.map +1 -1
- package/dist/types/react/core/hooks/useTransactionDetails.d.ts +2 -2
- package/dist/types/react/core/hooks/useTransactionDetails.d.ts.map +1 -1
- package/dist/types/react/core/machines/paymentMachine.d.ts +4 -4
- package/dist/types/react/core/machines/paymentMachine.d.ts.map +1 -1
- package/dist/types/react/web/ui/Bridge/BridgeOrchestrator.d.ts +3 -3
- package/dist/types/react/web/ui/Bridge/BridgeOrchestrator.d.ts.map +1 -1
- package/dist/types/react/web/ui/Bridge/CheckoutWidget.d.ts.map +1 -1
- package/dist/types/react/web/ui/Bridge/DirectPayment.d.ts +3 -8
- package/dist/types/react/web/ui/Bridge/DirectPayment.d.ts.map +1 -1
- package/dist/types/react/web/ui/Bridge/FundWallet.d.ts +2 -2
- package/dist/types/react/web/ui/Bridge/FundWallet.d.ts.map +1 -1
- package/dist/types/react/web/ui/Bridge/TransactionPayment.d.ts +2 -2
- package/dist/types/react/web/ui/Bridge/TransactionPayment.d.ts.map +1 -1
- package/dist/types/react/web/ui/Bridge/payment-success/SuccessScreen.d.ts +5 -1
- package/dist/types/react/web/ui/Bridge/payment-success/SuccessScreen.d.ts.map +1 -1
- package/dist/types/stories/Bridge/BridgeOrchestrator.stories.d.ts +1 -1
- package/dist/types/stories/Bridge/BridgeOrchestrator.stories.d.ts.map +1 -1
- package/dist/types/stories/Bridge/DirectPayment.stories.d.ts +2 -2
- package/dist/types/stories/Bridge/DirectPayment.stories.d.ts.map +1 -1
- package/dist/types/stories/Bridge/FundWallet.stories.d.ts +2 -2
- package/dist/types/stories/Bridge/FundWallet.stories.d.ts.map +1 -1
- package/dist/types/stories/Bridge/PaymentDetails.stories.d.ts +1 -1
- package/dist/types/stories/Bridge/PaymentSelection.stories.d.ts +1 -1
- package/dist/types/stories/Bridge/SuccessScreen.stories.d.ts +2 -1
- package/dist/types/stories/Bridge/SuccessScreen.stories.d.ts.map +1 -1
- package/dist/types/stories/Bridge/TransactionPayment.stories.d.ts +1 -1
- package/dist/types/stories/Bridge/TransactionPayment.stories.d.ts.map +1 -1
- package/dist/types/stories/Bridge/fixtures.d.ts +4 -4
- package/dist/types/stories/Bridge/fixtures.d.ts.map +1 -1
- package/dist/types/stories/TokenBalanceRow.stories.d.ts +1 -1
- package/dist/types/version.d.ts +1 -1
- package/dist/types/wallets/wallet-connect/controller.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/adapters/eip1193/to-eip1193.test.ts +10 -5
- package/src/adapters/eip1193/to-eip1193.ts +16 -5
- package/src/bridge/Onramp.ts +2 -2
- package/src/bridge/Token.test.ts +20 -2
- package/src/bridge/Token.ts +25 -9
- package/src/bridge/index.ts +1 -1
- package/src/bridge/types/Route.ts +7 -7
- package/src/bridge/types/Token.ts +3 -0
- package/src/pay/convert/get-token.ts +2 -2
- package/src/react/core/hooks/usePaymentMethods.ts +2 -2
- package/src/react/core/hooks/useTransactionDetails.ts +2 -2
- package/src/react/core/machines/paymentMachine.ts +4 -4
- package/src/react/web/ui/Bridge/BridgeOrchestrator.tsx +5 -5
- package/src/react/web/ui/Bridge/CheckoutWidget.tsx +16 -0
- package/src/react/web/ui/Bridge/DirectPayment.tsx +9 -31
- package/src/react/web/ui/Bridge/FundWallet.tsx +6 -2
- package/src/react/web/ui/Bridge/TransactionPayment.tsx +6 -2
- package/src/react/web/ui/Bridge/payment-selection/WalletFiatSelection.tsx +3 -3
- package/src/react/web/ui/Bridge/payment-success/SuccessScreen.tsx +16 -4
- package/src/stories/Bridge/SuccessScreen.stories.tsx +14 -0
- package/src/stories/Bridge/fixtures.ts +4 -4
- package/src/version.ts +1 -1
- package/src/wallets/wallet-connect/controller.ts +3 -2
@@ -22,8 +22,11 @@ import type { ConnectButton_connectModalOptions } from "../../../core/hooks/conn
|
|
22
22
|
import type { SupportedTokens } from "../../../core/utils/defaultTokens.js";
|
23
23
|
import { useConnectLocale } from "../ConnectWallet/locale/getConnectLocale.js";
|
24
24
|
import { EmbedContainer } from "../ConnectWallet/Modal/ConnectEmbed.js";
|
25
|
+
import { Container } from "../components/basic.js";
|
26
|
+
import { Button } from "../components/buttons.js";
|
25
27
|
import { DynamicHeight } from "../components/DynamicHeight.js";
|
26
28
|
import { Spinner } from "../components/Spinner.js";
|
29
|
+
import { Text } from "../components/text.js";
|
27
30
|
import type { LocaleId } from "../types.js";
|
28
31
|
import { BridgeOrchestrator, type UIOptions } from "./BridgeOrchestrator.js";
|
29
32
|
import { UnsupportedTokenScreen } from "./UnsupportedTokenScreen.js";
|
@@ -421,6 +424,19 @@ export function CheckoutWidget(props: CheckoutWidgetProps) {
|
|
421
424
|
);
|
422
425
|
}
|
423
426
|
|
427
|
+
if (bridgeDataQuery.isError) {
|
428
|
+
content = (
|
429
|
+
<Container flex="column" center="both" gap="md" p="md" py="xl">
|
430
|
+
<Text center size="md" weight={600}>
|
431
|
+
Something went wrong.
|
432
|
+
</Text>
|
433
|
+
<Button variant="ghost" onClick={() => bridgeDataQuery.refetch()}>
|
434
|
+
Retry
|
435
|
+
</Button>
|
436
|
+
</Container>
|
437
|
+
);
|
438
|
+
}
|
439
|
+
|
424
440
|
return (
|
425
441
|
<CustomThemeProvider theme={theme}>
|
426
442
|
<EmbedContainer
|
@@ -1,11 +1,8 @@
|
|
1
1
|
"use client";
|
2
|
-
import type {
|
2
|
+
import type { TokenWithPrices } from "../../../../bridge/types/Token.js";
|
3
3
|
import { defineChain } from "../../../../chains/utils.js";
|
4
4
|
import type { ThirdwebClient } from "../../../../client/client.js";
|
5
5
|
import type { Address } from "../../../../utils/address.js";
|
6
|
-
import { useCustomTheme } from "../../../core/design-system/CustomThemeProvider.js";
|
7
|
-
import { useActiveAccount } from "../../../core/hooks/wallets/useActiveAccount.js";
|
8
|
-
import { ConnectButton } from "../ConnectWallet/ConnectButton.js";
|
9
6
|
import { PoweredByThirdweb } from "../ConnectWallet/PoweredByTW.js";
|
10
7
|
import { FiatValue } from "../ConnectWallet/screens/Buy/swap/FiatValue.js";
|
11
8
|
import { Container, Line } from "../components/basic.js";
|
@@ -13,7 +10,6 @@ import { Button } from "../components/buttons.js";
|
|
13
10
|
import { ChainName } from "../components/ChainName.js";
|
14
11
|
import { Spacer } from "../components/Spacer.js";
|
15
12
|
import { Text } from "../components/text.js";
|
16
|
-
import type { PayEmbedConnectOptions } from "../PayEmbed.js";
|
17
13
|
import type { UIOptions } from "./BridgeOrchestrator.js";
|
18
14
|
import { ChainIcon } from "./common/TokenAndChain.js";
|
19
15
|
import { WithHeader } from "./common/WithHeader.js";
|
@@ -32,12 +28,11 @@ export interface DirectPaymentProps {
|
|
32
28
|
/**
|
33
29
|
* Called when user continues with the payment
|
34
30
|
*/
|
35
|
-
onContinue: (
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
connectOptions?: PayEmbedConnectOptions;
|
31
|
+
onContinue: (
|
32
|
+
amount: string,
|
33
|
+
token: TokenWithPrices,
|
34
|
+
receiverAddress: Address,
|
35
|
+
) => void;
|
41
36
|
|
42
37
|
/**
|
43
38
|
* Whether to show thirdweb branding in the widget.
|
@@ -50,12 +45,9 @@ export function DirectPayment({
|
|
50
45
|
uiOptions,
|
51
46
|
client,
|
52
47
|
onContinue,
|
53
|
-
connectOptions,
|
54
48
|
showThirdwebBranding = true,
|
55
49
|
}: DirectPaymentProps) {
|
56
|
-
const activeAccount = useActiveAccount();
|
57
50
|
const chain = defineChain(uiOptions.paymentInfo.token.chainId);
|
58
|
-
const theme = useCustomTheme();
|
59
51
|
const handleContinue = () => {
|
60
52
|
onContinue(
|
61
53
|
uiOptions.paymentInfo.amount,
|
@@ -188,23 +180,9 @@ export function DirectPayment({
|
|
188
180
|
|
189
181
|
{/* Action button */}
|
190
182
|
<Container flex="column">
|
191
|
-
{
|
192
|
-
|
193
|
-
|
194
|
-
</Button>
|
195
|
-
) : (
|
196
|
-
<ConnectButton
|
197
|
-
client={client}
|
198
|
-
connectButton={{
|
199
|
-
label: buyNow,
|
200
|
-
style: {
|
201
|
-
width: "100%",
|
202
|
-
},
|
203
|
-
}}
|
204
|
-
theme={theme}
|
205
|
-
{...connectOptions}
|
206
|
-
/>
|
207
|
-
)}
|
183
|
+
<Button fullWidth onClick={handleContinue} variant="primary">
|
184
|
+
{buyNow}
|
185
|
+
</Button>
|
208
186
|
|
209
187
|
{showThirdwebBranding ? (
|
210
188
|
<div>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
/** biome-ignore-all lint/a11y/useSemanticElements: FIXME */
|
2
2
|
"use client";
|
3
3
|
import { useRef, useState } from "react";
|
4
|
-
import type {
|
4
|
+
import type { TokenWithPrices } from "../../../../bridge/types/Token.js";
|
5
5
|
import type { ThirdwebClient } from "../../../../client/client.js";
|
6
6
|
import { type Address, getAddress } from "../../../../utils/address.js";
|
7
7
|
import { numberToPlainString } from "../../../../utils/formatNumber.js";
|
@@ -46,7 +46,11 @@ export interface FundWalletProps {
|
|
46
46
|
/**
|
47
47
|
* Called when continue is clicked with the resolved requirements
|
48
48
|
*/
|
49
|
-
onContinue: (
|
49
|
+
onContinue: (
|
50
|
+
amount: string,
|
51
|
+
token: TokenWithPrices,
|
52
|
+
receiverAddress: Address,
|
53
|
+
) => void;
|
50
54
|
|
51
55
|
/**
|
52
56
|
* Quick buy amounts
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use client";
|
2
2
|
import { useQuery } from "@tanstack/react-query";
|
3
|
-
import type {
|
3
|
+
import type { TokenWithPrices } from "../../../../bridge/types/Token.js";
|
4
4
|
import type { ThirdwebClient } from "../../../../client/client.js";
|
5
5
|
import { NATIVE_TOKEN_ADDRESS } from "../../../../constants/addresses.js";
|
6
6
|
import {
|
@@ -46,7 +46,11 @@ export interface TransactionPaymentProps {
|
|
46
46
|
/**
|
47
47
|
* Called when user confirms transaction execution
|
48
48
|
*/
|
49
|
-
onContinue: (
|
49
|
+
onContinue: (
|
50
|
+
amount: string,
|
51
|
+
token: TokenWithPrices,
|
52
|
+
receiverAddress: Address,
|
53
|
+
) => void;
|
50
54
|
|
51
55
|
/**
|
52
56
|
* Request to execute the transaction immediately (skips funding flow)
|
@@ -121,10 +121,10 @@ export function WalletFiatSelection({
|
|
121
121
|
</Container>
|
122
122
|
<Container flex="column" gap="3xs" style={{ flex: 1 }}>
|
123
123
|
<Text color="primaryText" size="sm" style={{ fontWeight: 600 }}>
|
124
|
-
Connect
|
124
|
+
Connect a Wallet
|
125
125
|
</Text>
|
126
126
|
<Text color="secondaryText" size="xs">
|
127
|
-
|
127
|
+
Pay with any web3 wallet
|
128
128
|
</Text>
|
129
129
|
</Container>
|
130
130
|
</Container>
|
@@ -169,7 +169,7 @@ export function WalletFiatSelection({
|
|
169
169
|
Pay with Card
|
170
170
|
</Text>
|
171
171
|
<Text color="secondaryText" size="xs">
|
172
|
-
|
172
|
+
Onramp and pay in one step
|
173
173
|
</Text>
|
174
174
|
</Container>
|
175
175
|
</Container>
|
@@ -42,6 +42,11 @@ export interface SuccessScreenProps {
|
|
42
42
|
windowAdapter: WindowAdapter;
|
43
43
|
|
44
44
|
client: ThirdwebClient;
|
45
|
+
|
46
|
+
/**
|
47
|
+
* Whether or not this payment is associated with a payment ID. If it does, we show a different message.
|
48
|
+
*/
|
49
|
+
hasPaymentId?: boolean;
|
45
50
|
}
|
46
51
|
|
47
52
|
type ViewState = "success" | "detail";
|
@@ -53,6 +58,7 @@ export function SuccessScreen({
|
|
53
58
|
onDone,
|
54
59
|
windowAdapter,
|
55
60
|
client,
|
61
|
+
hasPaymentId = false,
|
56
62
|
}: SuccessScreenProps) {
|
57
63
|
const theme = useCustomTheme();
|
58
64
|
const [viewState, setViewState] = useState<ViewState>("success");
|
@@ -120,7 +126,11 @@ export function SuccessScreen({
|
|
120
126
|
</Text>
|
121
127
|
|
122
128
|
<Text center color="secondaryText" size="sm">
|
123
|
-
|
129
|
+
{hasPaymentId
|
130
|
+
? "You can now close this page and return to the application."
|
131
|
+
: uiOptions.mode === "transaction"
|
132
|
+
? "Click continue to execute your transaction."
|
133
|
+
: "Your payment has been completed successfully."}
|
124
134
|
</Text>
|
125
135
|
</Container>
|
126
136
|
<Spacer y="lg" />
|
@@ -135,9 +145,11 @@ export function SuccessScreen({
|
|
135
145
|
View Payment Receipt
|
136
146
|
</Button>
|
137
147
|
|
138
|
-
|
139
|
-
|
140
|
-
|
148
|
+
{!hasPaymentId && (
|
149
|
+
<Button fullWidth onClick={onDone} variant="accent">
|
150
|
+
{uiOptions.mode === "transaction" ? "Continue" : "Done"}
|
151
|
+
</Button>
|
152
|
+
)}
|
141
153
|
</Container>
|
142
154
|
|
143
155
|
{/* CSS Animations */}
|
@@ -222,3 +222,17 @@ export const TransactionPayment: Story = {
|
|
222
222
|
backgrounds: { default: "light" },
|
223
223
|
},
|
224
224
|
};
|
225
|
+
|
226
|
+
export const PaymentId: Story = {
|
227
|
+
args: {
|
228
|
+
client: storyClient,
|
229
|
+
completedStatuses: mockBuyCompletedStatuses,
|
230
|
+
hasPaymentId: true,
|
231
|
+
preparedQuote: simpleBuyQuote,
|
232
|
+
theme: "light",
|
233
|
+
uiOptions: TRANSACTION_UI_OPTIONS.contractInteraction,
|
234
|
+
},
|
235
|
+
parameters: {
|
236
|
+
backgrounds: { default: "light" },
|
237
|
+
},
|
238
|
+
};
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { stringify } from "viem";
|
2
|
-
import type {
|
2
|
+
import type { TokenWithPrices } from "../../bridge/types/Token.js";
|
3
3
|
import { base } from "../../chains/chain-definitions/base.js";
|
4
4
|
import { baseSepolia } from "../../chains/chain-definitions/base-sepolia.js";
|
5
5
|
import { polygon } from "../../chains/chain-definitions/polygon.js";
|
@@ -19,7 +19,7 @@ import { toWei } from "../../utils/units.js";
|
|
19
19
|
import type { Account, Wallet } from "../../wallets/interfaces/wallet.js";
|
20
20
|
import { storyClient } from "../utils.js";
|
21
21
|
|
22
|
-
export const ETH:
|
22
|
+
export const ETH: TokenWithPrices = {
|
23
23
|
address: NATIVE_TOKEN_ADDRESS,
|
24
24
|
chainId: 10,
|
25
25
|
decimals: 18,
|
@@ -32,7 +32,7 @@ export const ETH: Token = {
|
|
32
32
|
symbol: "ETH",
|
33
33
|
};
|
34
34
|
|
35
|
-
export const USDC:
|
35
|
+
export const USDC: TokenWithPrices = {
|
36
36
|
address: getDefaultToken(base, "USDC")?.address ?? "",
|
37
37
|
chainId: base.id,
|
38
38
|
decimals: 6,
|
@@ -45,7 +45,7 @@ export const USDC: Token = {
|
|
45
45
|
symbol: "USDC",
|
46
46
|
};
|
47
47
|
|
48
|
-
export const UNI:
|
48
|
+
export const UNI: TokenWithPrices = {
|
49
49
|
address: "0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984",
|
50
50
|
chainId: 10,
|
51
51
|
decimals: 18,
|
package/src/version.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export const version = "5.105.
|
1
|
+
export const version = "5.105.39";
|
@@ -142,6 +142,7 @@ export async function connectWC(
|
|
142
142
|
"eth_sign",
|
143
143
|
"personal_sign",
|
144
144
|
"eth_signTypedData",
|
145
|
+
"eth_signTypedData_v4",
|
145
146
|
"wallet_switchEthereumChain",
|
146
147
|
"wallet_addEthereumChain",
|
147
148
|
],
|
@@ -185,8 +186,8 @@ export async function connectWC(
|
|
185
186
|
}
|
186
187
|
}
|
187
188
|
|
188
|
-
if (
|
189
|
-
provider.events.removeListener("display_uri",
|
189
|
+
if (onDisplayUri) {
|
190
|
+
provider.events.removeListener("display_uri", onDisplayUri);
|
190
191
|
}
|
191
192
|
|
192
193
|
return onConnect(
|