thirdweb 5.105.3-nightly-6d1d344c48302d45aeb63532c84cc8e79c93e26f-20250628000422 → 5.105.4-nightly-1f72396d7fa4748efef179821a7a796b53679bcb-20250629000440
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/engine/server-wallet.js +64 -19
- package/dist/cjs/engine/server-wallet.js.map +1 -1
- package/dist/cjs/engine/wait-for-tx-hash.js +1 -1
- package/dist/cjs/engine/wait-for-tx-hash.js.map +1 -1
- package/dist/cjs/exports/wallets/in-app.js +5 -1
- package/dist/cjs/exports/wallets/in-app.js.map +1 -1
- package/dist/cjs/exports/wallets/in-app.native.js +5 -1
- package/dist/cjs/exports/wallets/in-app.native.js.map +1 -1
- package/dist/cjs/extensions/erc7702/account/createSessionKey.js +127 -0
- package/dist/cjs/extensions/erc7702/account/createSessionKey.js.map +1 -0
- package/dist/cjs/extensions/erc7702/account/types.js +57 -0
- package/dist/cjs/extensions/erc7702/account/types.js.map +1 -0
- 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/BuyWidget.js +1 -1
- package/dist/cjs/react/web/ui/Bridge/BuyWidget.js.map +1 -1
- package/dist/cjs/react/web/ui/Bridge/CheckoutWidget.js +1 -1
- package/dist/cjs/react/web/ui/Bridge/CheckoutWidget.js.map +1 -1
- package/dist/cjs/react/web/ui/Bridge/TransactionWidget.js +1 -1
- package/dist/cjs/react/web/ui/Bridge/TransactionWidget.js.map +1 -1
- package/dist/cjs/react/web/ui/Bridge/payment-details/PaymentDetails.js +1 -1
- package/dist/cjs/react/web/ui/Bridge/payment-details/PaymentDetails.js.map +1 -1
- package/dist/cjs/react/web/ui/Bridge/payment-selection/PaymentSelection.js +3 -3
- package/dist/cjs/react/web/ui/Bridge/payment-selection/PaymentSelection.js.map +1 -1
- package/dist/cjs/react/web/ui/Bridge/payment-selection/WalletFiatSelection.js +37 -37
- package/dist/cjs/react/web/ui/Bridge/payment-selection/WalletFiatSelection.js.map +1 -1
- package/dist/cjs/react/web/ui/PayEmbed.js +11 -4
- package/dist/cjs/react/web/ui/PayEmbed.js.map +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/wallets/in-app/core/authentication/backend.js +2 -1
- package/dist/cjs/wallets/in-app/core/authentication/backend.js.map +1 -1
- package/dist/cjs/wallets/in-app/core/authentication/guest.js +2 -8
- package/dist/cjs/wallets/in-app/core/authentication/guest.js.map +1 -1
- package/dist/cjs/wallets/in-app/core/eip7702/minimal-account.js +1 -1
- package/dist/cjs/wallets/in-app/native/native-connector.js +1 -1
- package/dist/cjs/wallets/in-app/native/native-connector.js.map +1 -1
- package/dist/cjs/wallets/in-app/web/lib/web-connector.js +1 -1
- package/dist/cjs/wallets/in-app/web/lib/web-connector.js.map +1 -1
- package/dist/esm/engine/server-wallet.js +65 -20
- package/dist/esm/engine/server-wallet.js.map +1 -1
- package/dist/esm/engine/wait-for-tx-hash.js +1 -1
- package/dist/esm/engine/wait-for-tx-hash.js.map +1 -1
- package/dist/esm/exports/wallets/in-app.js +2 -0
- package/dist/esm/exports/wallets/in-app.js.map +1 -1
- package/dist/esm/exports/wallets/in-app.native.js +2 -0
- package/dist/esm/exports/wallets/in-app.native.js.map +1 -1
- package/dist/esm/extensions/erc7702/account/createSessionKey.js +123 -0
- package/dist/esm/extensions/erc7702/account/createSessionKey.js.map +1 -0
- package/dist/esm/extensions/erc7702/account/types.js +54 -0
- package/dist/esm/extensions/erc7702/account/types.js.map +1 -0
- 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/BuyWidget.js +1 -1
- package/dist/esm/react/web/ui/Bridge/BuyWidget.js.map +1 -1
- package/dist/esm/react/web/ui/Bridge/CheckoutWidget.js +1 -1
- package/dist/esm/react/web/ui/Bridge/CheckoutWidget.js.map +1 -1
- package/dist/esm/react/web/ui/Bridge/TransactionWidget.js +1 -1
- package/dist/esm/react/web/ui/Bridge/TransactionWidget.js.map +1 -1
- package/dist/esm/react/web/ui/Bridge/payment-details/PaymentDetails.js +1 -1
- package/dist/esm/react/web/ui/Bridge/payment-details/PaymentDetails.js.map +1 -1
- package/dist/esm/react/web/ui/Bridge/payment-selection/PaymentSelection.js +3 -3
- package/dist/esm/react/web/ui/Bridge/payment-selection/PaymentSelection.js.map +1 -1
- package/dist/esm/react/web/ui/Bridge/payment-selection/WalletFiatSelection.js +37 -37
- package/dist/esm/react/web/ui/Bridge/payment-selection/WalletFiatSelection.js.map +1 -1
- package/dist/esm/react/web/ui/PayEmbed.js +11 -4
- package/dist/esm/react/web/ui/PayEmbed.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/wallets/in-app/core/authentication/backend.js +2 -1
- package/dist/esm/wallets/in-app/core/authentication/backend.js.map +1 -1
- package/dist/esm/wallets/in-app/core/authentication/guest.js +2 -8
- package/dist/esm/wallets/in-app/core/authentication/guest.js.map +1 -1
- package/dist/esm/wallets/in-app/core/eip7702/minimal-account.js +1 -1
- package/dist/esm/wallets/in-app/native/native-connector.js +1 -1
- package/dist/esm/wallets/in-app/native/native-connector.js.map +1 -1
- package/dist/esm/wallets/in-app/web/lib/web-connector.js +1 -1
- package/dist/esm/wallets/in-app/web/lib/web-connector.js.map +1 -1
- package/dist/types/engine/server-wallet.d.ts +5 -2
- package/dist/types/engine/server-wallet.d.ts.map +1 -1
- package/dist/types/exports/wallets/in-app.d.ts +2 -0
- package/dist/types/exports/wallets/in-app.d.ts.map +1 -1
- package/dist/types/exports/wallets/in-app.native.d.ts +2 -0
- package/dist/types/exports/wallets/in-app.native.d.ts.map +1 -1
- package/dist/types/extensions/erc7702/account/createSessionKey.d.ts +69 -0
- package/dist/types/extensions/erc7702/account/createSessionKey.d.ts.map +1 -0
- package/dist/types/extensions/erc7702/account/types.d.ts +107 -0
- package/dist/types/extensions/erc7702/account/types.d.ts.map +1 -0
- package/dist/types/react/web/ui/Bridge/BridgeOrchestrator.d.ts +6 -1
- package/dist/types/react/web/ui/Bridge/BridgeOrchestrator.d.ts.map +1 -1
- package/dist/types/react/web/ui/Bridge/BuyWidget.d.ts +5 -0
- package/dist/types/react/web/ui/Bridge/BuyWidget.d.ts.map +1 -1
- package/dist/types/react/web/ui/Bridge/CheckoutWidget.d.ts +5 -0
- package/dist/types/react/web/ui/Bridge/CheckoutWidget.d.ts.map +1 -1
- package/dist/types/react/web/ui/Bridge/TransactionWidget.d.ts +5 -0
- package/dist/types/react/web/ui/Bridge/TransactionWidget.d.ts.map +1 -1
- package/dist/types/react/web/ui/Bridge/payment-details/PaymentDetails.d.ts.map +1 -1
- package/dist/types/react/web/ui/Bridge/payment-selection/PaymentSelection.d.ts +6 -1
- package/dist/types/react/web/ui/Bridge/payment-selection/PaymentSelection.d.ts.map +1 -1
- package/dist/types/react/web/ui/Bridge/payment-selection/WalletFiatSelection.d.ts +2 -1
- package/dist/types/react/web/ui/Bridge/payment-selection/WalletFiatSelection.d.ts.map +1 -1
- package/dist/types/react/web/ui/PayEmbed.d.ts +0 -1
- package/dist/types/react/web/ui/PayEmbed.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/dist/types/wallets/in-app/core/authentication/backend.d.ts.map +1 -1
- package/dist/types/wallets/in-app/core/authentication/guest.d.ts +2 -2
- package/dist/types/wallets/in-app/core/authentication/guest.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/engine/server-wallet.test.ts +23 -28
- package/src/engine/server-wallet.ts +80 -26
- package/src/engine/wait-for-tx-hash.ts +1 -1
- package/src/exports/wallets/in-app.native.ts +10 -0
- package/src/exports/wallets/in-app.ts +10 -0
- package/src/extensions/erc7702/account/createSessionKey.ts +181 -0
- package/src/extensions/erc7702/account/sessionkey.test.ts +132 -0
- package/src/extensions/erc7702/account/types.ts +94 -0
- package/src/react/web/ui/Bridge/BridgeOrchestrator.tsx +8 -0
- package/src/react/web/ui/Bridge/BuyWidget.tsx +7 -0
- package/src/react/web/ui/Bridge/CheckoutWidget.tsx +7 -0
- package/src/react/web/ui/Bridge/TransactionWidget.tsx +7 -0
- package/src/react/web/ui/Bridge/payment-details/PaymentDetails.tsx +3 -7
- package/src/react/web/ui/Bridge/payment-selection/PaymentSelection.tsx +10 -2
- package/src/react/web/ui/Bridge/payment-selection/WalletFiatSelection.tsx +133 -124
- package/src/react/web/ui/PayEmbed.tsx +17 -1
- package/src/version.ts +1 -1
- package/src/wallets/in-app/core/authentication/backend.test.ts +1 -0
- package/src/wallets/in-app/core/authentication/backend.ts +2 -1
- package/src/wallets/in-app/core/authentication/guest.ts +4 -11
- package/src/wallets/in-app/core/eip7702/minimal-account.ts +1 -1
- package/src/wallets/in-app/native/native-connector.ts +1 -1
- package/src/wallets/in-app/web/lib/in-app-gateway.test.ts +126 -0
- package/src/wallets/in-app/web/lib/web-connector.ts +1 -1
@@ -166,6 +166,12 @@ export type CheckoutWidgetProps = {
|
|
166
166
|
* @hidden
|
167
167
|
*/
|
168
168
|
paymentLinkId?: string;
|
169
|
+
|
170
|
+
/**
|
171
|
+
* Allowed payment methods
|
172
|
+
* @default ["crypto", "card"]
|
173
|
+
*/
|
174
|
+
paymentMethods?: ("crypto" | "card")[];
|
169
175
|
};
|
170
176
|
|
171
177
|
// Enhanced UIOptions to handle unsupported token state
|
@@ -341,6 +347,7 @@ export function CheckoutWidget(props: CheckoutWidgetProps) {
|
|
341
347
|
props.onError?.(err);
|
342
348
|
}}
|
343
349
|
paymentLinkId={props.paymentLinkId}
|
350
|
+
paymentMethods={props.paymentMethods}
|
344
351
|
presetOptions={props.presetOptions}
|
345
352
|
purchaseData={props.purchaseData}
|
346
353
|
receiverAddress={props.seller}
|
@@ -169,6 +169,12 @@ export type TransactionWidgetProps = {
|
|
169
169
|
* @hidden
|
170
170
|
*/
|
171
171
|
paymentLinkId?: string;
|
172
|
+
|
173
|
+
/**
|
174
|
+
* Allowed payment methods
|
175
|
+
* @default ["crypto", "card"]
|
176
|
+
*/
|
177
|
+
paymentMethods?: ("crypto" | "card")[];
|
172
178
|
};
|
173
179
|
|
174
180
|
// Enhanced UIOptions to handle unsupported token state
|
@@ -400,6 +406,7 @@ export function TransactionWidget(props: TransactionWidgetProps) {
|
|
400
406
|
props.onError?.(err);
|
401
407
|
}}
|
402
408
|
paymentLinkId={props.paymentLinkId}
|
409
|
+
paymentMethods={props.paymentMethods}
|
403
410
|
presetOptions={props.presetOptions}
|
404
411
|
purchaseData={props.purchaseData}
|
405
412
|
receiverAddress={undefined}
|
@@ -370,13 +370,9 @@ export function PaymentDetails({
|
|
370
370
|
}
|
371
371
|
</>
|
372
372
|
) : (
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
(c) => c.chainId === step.originToken.chainId,
|
377
|
-
)?.name
|
378
|
-
}
|
379
|
-
</>
|
373
|
+
chainsMetadata.find(
|
374
|
+
(c) => c.chainId === step.originToken.chainId,
|
375
|
+
)?.name
|
380
376
|
)}
|
381
377
|
</Text>
|
382
378
|
</Container>
|
@@ -71,6 +71,12 @@ export interface PaymentSelectionProps {
|
|
71
71
|
* Whether to include the destination token in the payment methods
|
72
72
|
*/
|
73
73
|
includeDestinationToken?: boolean;
|
74
|
+
|
75
|
+
/**
|
76
|
+
* Allowed payment methods
|
77
|
+
* @default ["crypto", "card"]
|
78
|
+
*/
|
79
|
+
paymentMethods?: ("crypto" | "card")[];
|
74
80
|
}
|
75
81
|
|
76
82
|
type Step =
|
@@ -90,6 +96,7 @@ export function PaymentSelection({
|
|
90
96
|
connectOptions,
|
91
97
|
connectLocale,
|
92
98
|
includeDestinationToken,
|
99
|
+
paymentMethods = ["crypto", "card"],
|
93
100
|
}: PaymentSelectionProps) {
|
94
101
|
const connectedWallets = useConnectedWallets();
|
95
102
|
const activeWallet = useActiveWallet();
|
@@ -115,7 +122,7 @@ export function PaymentSelection({
|
|
115
122
|
? currentStep.selectedWallet
|
116
123
|
: activeWallet;
|
117
124
|
const {
|
118
|
-
data:
|
125
|
+
data: suitableTokenPaymentMethods,
|
119
126
|
isLoading: paymentMethodsLoading,
|
120
127
|
error: paymentMethodsError,
|
121
128
|
} = usePaymentMethods({
|
@@ -248,6 +255,7 @@ export function PaymentSelection({
|
|
248
255
|
onConnectWallet={handleConnectWallet}
|
249
256
|
onFiatSelected={handleFiatSelected}
|
250
257
|
onWalletSelected={handleWalletSelected}
|
258
|
+
paymentMethods={paymentMethods}
|
251
259
|
/>
|
252
260
|
)}
|
253
261
|
|
@@ -261,7 +269,7 @@ export function PaymentSelection({
|
|
261
269
|
destinationToken={destinationToken}
|
262
270
|
onBack={handleBackToWalletSelection}
|
263
271
|
onPaymentMethodSelected={handlePaymentMethodSelected}
|
264
|
-
paymentMethods={
|
272
|
+
paymentMethods={suitableTokenPaymentMethods}
|
265
273
|
paymentMethodsLoading={paymentMethodsLoading}
|
266
274
|
/>
|
267
275
|
)}
|
@@ -21,6 +21,7 @@ interface WalletFiatSelectionProps {
|
|
21
21
|
onWalletSelected: (wallet: Wallet) => void;
|
22
22
|
onFiatSelected: () => void;
|
23
23
|
onConnectWallet: () => void;
|
24
|
+
paymentMethods?: ("crypto" | "card")[];
|
24
25
|
}
|
25
26
|
|
26
27
|
export function WalletFiatSelection({
|
@@ -29,144 +30,152 @@ export function WalletFiatSelection({
|
|
29
30
|
onWalletSelected,
|
30
31
|
onFiatSelected,
|
31
32
|
onConnectWallet,
|
33
|
+
paymentMethods = ["crypto", "card"],
|
32
34
|
}: WalletFiatSelectionProps) {
|
33
35
|
const theme = useCustomTheme();
|
34
36
|
|
35
37
|
return (
|
36
38
|
<>
|
37
|
-
|
38
|
-
Pay with Crypto
|
39
|
-
</Text>
|
40
|
-
<Spacer y="md" />
|
41
|
-
{/* Connected Wallets */}
|
42
|
-
{connectedWallets.length > 0 && (
|
39
|
+
{paymentMethods.includes("crypto") && (
|
43
40
|
<>
|
44
|
-
<
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
41
|
+
<Text color="primaryText" size="md">
|
42
|
+
Pay with Crypto
|
43
|
+
</Text>
|
44
|
+
<Spacer y="md" />
|
45
|
+
{/* Connected Wallets */}
|
46
|
+
{connectedWallets.length > 0 && (
|
47
|
+
<>
|
48
|
+
<Container flex="column" gap="sm">
|
49
|
+
{connectedWallets.map((wallet) => {
|
50
|
+
const account = wallet.getAccount();
|
51
|
+
if (!account?.address) {
|
52
|
+
return null;
|
53
|
+
}
|
54
|
+
return (
|
55
|
+
<Button
|
56
|
+
fullWidth
|
57
|
+
key={wallet.id}
|
58
|
+
onClick={() => onWalletSelected(wallet)}
|
59
|
+
style={{
|
60
|
+
backgroundColor: theme.colors.tertiaryBg,
|
61
|
+
border: `1px solid ${theme.colors.borderColor}`,
|
62
|
+
borderRadius: radius.md,
|
63
|
+
justifyContent: "space-between",
|
64
|
+
padding: `${spacing.sm} ${spacing.md}`,
|
65
|
+
}}
|
66
|
+
variant="secondary"
|
67
|
+
>
|
68
|
+
<WalletRow
|
69
|
+
address={account?.address}
|
70
|
+
client={client}
|
71
|
+
iconSize="lg"
|
72
|
+
textSize="sm"
|
73
|
+
/>
|
74
|
+
<ChevronRightIcon
|
75
|
+
style={{ height: iconSize.md, width: iconSize.md }}
|
76
|
+
/>
|
77
|
+
</Button>
|
78
|
+
);
|
79
|
+
})}
|
80
|
+
</Container>
|
81
|
+
<Spacer y="sm" />
|
82
|
+
</>
|
83
|
+
)}
|
80
84
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
style={{
|
86
|
-
backgroundColor: theme.colors.tertiaryBg,
|
87
|
-
border: `1px solid ${theme.colors.borderColor}`,
|
88
|
-
borderRadius: radius.md,
|
89
|
-
height: "auto",
|
90
|
-
padding: `${spacing.sm} ${spacing.md}`,
|
91
|
-
textAlign: "left",
|
92
|
-
}}
|
93
|
-
variant="secondary"
|
94
|
-
>
|
95
|
-
<Container
|
96
|
-
flex="row"
|
97
|
-
gap="md"
|
98
|
-
style={{ alignItems: "center", width: "100%" }}
|
99
|
-
>
|
100
|
-
<Container
|
85
|
+
{/* Connect Another Wallet */}
|
86
|
+
<Button
|
87
|
+
fullWidth
|
88
|
+
onClick={onConnectWallet}
|
101
89
|
style={{
|
102
|
-
|
103
|
-
border: `1px
|
104
|
-
borderRadius: radius.
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
padding: spacing["4xs"],
|
109
|
-
width: iconSize.lg,
|
90
|
+
backgroundColor: theme.colors.tertiaryBg,
|
91
|
+
border: `1px solid ${theme.colors.borderColor}`,
|
92
|
+
borderRadius: radius.md,
|
93
|
+
height: "auto",
|
94
|
+
padding: `${spacing.sm} ${spacing.md}`,
|
95
|
+
textAlign: "left",
|
110
96
|
}}
|
97
|
+
variant="secondary"
|
111
98
|
>
|
112
|
-
<
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
99
|
+
<Container
|
100
|
+
flex="row"
|
101
|
+
gap="md"
|
102
|
+
style={{ alignItems: "center", width: "100%" }}
|
103
|
+
>
|
104
|
+
<Container
|
105
|
+
style={{
|
106
|
+
alignItems: "center",
|
107
|
+
border: `1px dashed ${theme.colors.secondaryIconColor}`,
|
108
|
+
borderRadius: radius.sm,
|
109
|
+
display: "flex",
|
110
|
+
height: iconSize.lg,
|
111
|
+
justifyContent: "center",
|
112
|
+
padding: spacing["4xs"],
|
113
|
+
width: iconSize.lg,
|
114
|
+
}}
|
115
|
+
>
|
116
|
+
<PlusIcon
|
117
|
+
color={theme.colors.secondaryText}
|
118
|
+
height={iconSize.md}
|
119
|
+
width={iconSize.md}
|
120
|
+
/>
|
121
|
+
</Container>
|
122
|
+
<Container flex="column" gap="3xs" style={{ flex: 1 }}>
|
123
|
+
<Text color="primaryText" size="sm" style={{ fontWeight: 600 }}>
|
124
|
+
Connect Another Wallet
|
125
|
+
</Text>
|
126
|
+
<Text color="secondaryText" size="xs">
|
127
|
+
Use a different wallet to pay
|
128
|
+
</Text>
|
129
|
+
</Container>
|
130
|
+
</Container>
|
131
|
+
</Button>
|
132
|
+
</>
|
133
|
+
)}
|
128
134
|
|
129
|
-
|
135
|
+
{paymentMethods.includes("card") && (
|
136
|
+
<>
|
137
|
+
<Spacer y="md" />
|
130
138
|
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
</Text>
|
139
|
+
<Text color="primaryText" size="md">
|
140
|
+
Pay with Card
|
141
|
+
</Text>
|
135
142
|
|
136
|
-
|
143
|
+
<Spacer y="md" />
|
137
144
|
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
145
|
+
<Button
|
146
|
+
fullWidth
|
147
|
+
onClick={onFiatSelected}
|
148
|
+
style={{
|
149
|
+
backgroundColor: theme.colors.tertiaryBg,
|
150
|
+
border: `1px solid ${theme.colors.borderColor}`,
|
151
|
+
borderRadius: radius.md,
|
152
|
+
height: "auto",
|
153
|
+
padding: `${spacing.sm} ${spacing.md}`,
|
154
|
+
textAlign: "left",
|
155
|
+
}}
|
156
|
+
variant="secondary"
|
157
|
+
>
|
158
|
+
<Container
|
159
|
+
flex="row"
|
160
|
+
gap="md"
|
161
|
+
style={{ alignItems: "center", width: "100%" }}
|
162
|
+
>
|
163
|
+
<CreditCardIcon
|
164
|
+
color={theme.colors.secondaryIconColor}
|
165
|
+
size={iconSize.lg}
|
166
|
+
/>
|
167
|
+
<Container flex="column" gap="3xs" style={{ flex: 1 }}>
|
168
|
+
<Text color="primaryText" size="sm" style={{ fontWeight: 600 }}>
|
169
|
+
Pay with Card
|
170
|
+
</Text>
|
171
|
+
<Text color="secondaryText" size="xs">
|
172
|
+
Buy crypto and bridge in one step
|
173
|
+
</Text>
|
174
|
+
</Container>
|
175
|
+
</Container>
|
176
|
+
</Button>
|
177
|
+
</>
|
178
|
+
)}
|
170
179
|
</>
|
171
180
|
);
|
172
181
|
}
|
@@ -238,7 +238,6 @@ export type PayEmbedProps = {
|
|
238
238
|
* }}
|
239
239
|
* />
|
240
240
|
* ```
|
241
|
-
*
|
242
241
|
* You can also handle ERC20 payments by passing `erc20value` to your transaction:
|
243
242
|
*
|
244
243
|
* ```tsx
|
@@ -357,6 +356,13 @@ export function PayEmbed(props: PayEmbedProps) {
|
|
357
356
|
chain={props.payOptions.prefillBuy.chain}
|
358
357
|
client={props.client}
|
359
358
|
onSuccess={() => props.payOptions?.onPurchaseSuccess?.()}
|
359
|
+
paymentMethods={
|
360
|
+
props.payOptions?.buyWithFiat === false
|
361
|
+
? ["crypto"]
|
362
|
+
: props.payOptions?.buyWithCrypto === false
|
363
|
+
? ["card"]
|
364
|
+
: ["crypto", "card"]
|
365
|
+
}
|
360
366
|
theme={theme}
|
361
367
|
title={metadata?.name || "Buy"}
|
362
368
|
tokenAddress={
|
@@ -376,6 +382,11 @@ export function PayEmbed(props: PayEmbedProps) {
|
|
376
382
|
image={metadata?.image}
|
377
383
|
name={metadata?.name || "Checkout"}
|
378
384
|
onSuccess={() => props.payOptions?.onPurchaseSuccess?.()}
|
385
|
+
paymentMethods={
|
386
|
+
props.payOptions?.buyWithFiat === false
|
387
|
+
? ["crypto"]
|
388
|
+
: ["crypto", "card"]
|
389
|
+
}
|
379
390
|
seller={props.payOptions.paymentInfo.sellerAddress as Address}
|
380
391
|
theme={theme}
|
381
392
|
tokenAddress={
|
@@ -392,6 +403,11 @@ export function PayEmbed(props: PayEmbedProps) {
|
|
392
403
|
description={metadata?.description}
|
393
404
|
image={metadata?.image}
|
394
405
|
onSuccess={() => props.payOptions?.onPurchaseSuccess?.()}
|
406
|
+
paymentMethods={
|
407
|
+
props.payOptions?.buyWithFiat === false
|
408
|
+
? ["crypto"]
|
409
|
+
: ["crypto", "card"]
|
410
|
+
}
|
395
411
|
theme={theme}
|
396
412
|
title={metadata?.name}
|
397
413
|
transaction={props.payOptions.transaction}
|
package/src/version.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export const version = "5.105.
|
1
|
+
export const version = "5.105.4-nightly-1f72396d7fa4748efef179821a7a796b53679bcb-20250629000440";
|
@@ -31,7 +31,8 @@ export async function backendAuthenticate(args: {
|
|
31
31
|
});
|
32
32
|
|
33
33
|
if (!res.ok) {
|
34
|
-
|
34
|
+
const error = await res.text();
|
35
|
+
throw new Error(`Failed to generate backend account: ${error}`);
|
35
36
|
}
|
36
37
|
|
37
38
|
return (await res.json()) satisfies AuthStoredTokenWithCookieReturnType;
|
@@ -2,9 +2,8 @@ import type { ThirdwebClient } from "../../../../client/client.js";
|
|
2
2
|
import { getClientFetch } from "../../../../utils/fetch.js";
|
3
3
|
import { stringify } from "../../../../utils/json.js";
|
4
4
|
import { randomBytesHex } from "../../../../utils/random.js";
|
5
|
-
import type { AsyncStorage } from "../../../../utils/storage/AsyncStorage.js";
|
6
5
|
import type { Ecosystem } from "../wallet/types.js";
|
7
|
-
import { ClientScopedStorage } from "./client-scoped-storage.js";
|
6
|
+
import type { ClientScopedStorage } from "./client-scoped-storage.js";
|
8
7
|
import { getLoginCallbackUrl } from "./getLoginPath.js";
|
9
8
|
import type { AuthStoredTokenWithCookieReturnType } from "./types.js";
|
10
9
|
|
@@ -14,19 +13,13 @@ import type { AuthStoredTokenWithCookieReturnType } from "./types.js";
|
|
14
13
|
*/
|
15
14
|
export async function guestAuthenticate(args: {
|
16
15
|
client: ThirdwebClient;
|
17
|
-
storage:
|
16
|
+
storage: ClientScopedStorage;
|
18
17
|
ecosystem?: Ecosystem;
|
19
18
|
}): Promise<AuthStoredTokenWithCookieReturnType> {
|
20
|
-
|
21
|
-
clientId: args.client.clientId,
|
22
|
-
ecosystem: args.ecosystem,
|
23
|
-
storage: args.storage,
|
24
|
-
});
|
25
|
-
|
26
|
-
let sessionId = await storage.getGuestSessionId();
|
19
|
+
let sessionId = await args.storage.getGuestSessionId();
|
27
20
|
if (!sessionId) {
|
28
21
|
sessionId = randomBytesHex(32);
|
29
|
-
storage.saveGuestSessionId(sessionId);
|
22
|
+
args.storage.saveGuestSessionId(sessionId);
|
30
23
|
}
|
31
24
|
|
32
25
|
const clientFetch = getClientFetch(args.client, args.ecosystem);
|
@@ -24,7 +24,7 @@ import {
|
|
24
24
|
import type { BundlerOptions } from "../../../smart/types.js";
|
25
25
|
|
26
26
|
const MINIMAL_ACCOUNT_IMPLEMENTATION_ADDRESS =
|
27
|
-
"
|
27
|
+
"0xD6999651Fc0964B9c6B444307a0ab20534a66560";
|
28
28
|
|
29
29
|
export const create7702MinimalAccount = (args: {
|
30
30
|
client: ThirdwebClient;
|
@@ -0,0 +1,126 @@
|
|
1
|
+
import { sendTransaction, signMessage } from "@thirdweb-dev/engine";
|
2
|
+
import { beforeAll, describe, expect, it } from "vitest";
|
3
|
+
import { TEST_CLIENT } from "~test/test-clients.js";
|
4
|
+
import { sepolia } from "../../../../chains/chain-definitions/sepolia.js";
|
5
|
+
import { createThirdwebClient } from "../../../../client/client.js";
|
6
|
+
import { waitForTransactionHash } from "../../../../engine/wait-for-tx-hash.js";
|
7
|
+
import {
|
8
|
+
getThirdwebBaseUrl,
|
9
|
+
setThirdwebDomains,
|
10
|
+
} from "../../../../utils/domains.js";
|
11
|
+
import { getClientFetch } from "../../../../utils/fetch.js";
|
12
|
+
import { stringify } from "../../../../utils/json.js";
|
13
|
+
import type { Account } from "../../../interfaces/wallet.js";
|
14
|
+
import { inAppWallet } from "../in-app.js";
|
15
|
+
|
16
|
+
// TODO: productionize this test
|
17
|
+
describe
|
18
|
+
.runIf(process.env.TW_SECRET_KEY)
|
19
|
+
.skip("InAppWallet Gateway Tests", () => {
|
20
|
+
let account: Account;
|
21
|
+
let authToken: string | null | undefined;
|
22
|
+
const clientIdFetch = getClientFetch(
|
23
|
+
createThirdwebClient({
|
24
|
+
clientId: TEST_CLIENT.clientId,
|
25
|
+
}),
|
26
|
+
);
|
27
|
+
|
28
|
+
beforeAll(async () => {
|
29
|
+
setThirdwebDomains({
|
30
|
+
bundler: "bundler.thirdweb-dev.com",
|
31
|
+
engineCloud: "engine.thirdweb-dev.com",
|
32
|
+
inAppWallet: "embedded-wallet.thirdweb-dev.com",
|
33
|
+
rpc: "rpc.thirdweb-dev.com",
|
34
|
+
});
|
35
|
+
const wallet = inAppWallet();
|
36
|
+
account = await wallet.connect({
|
37
|
+
client: TEST_CLIENT,
|
38
|
+
strategy: "backend",
|
39
|
+
walletSecret: "test-secret",
|
40
|
+
});
|
41
|
+
authToken = wallet.getAuthToken?.();
|
42
|
+
expect(authToken).toBeDefined();
|
43
|
+
});
|
44
|
+
|
45
|
+
it("should sign a message with backend strategy", async () => {
|
46
|
+
const rawSignature = await account.signMessage({
|
47
|
+
message: "Hello, world!",
|
48
|
+
});
|
49
|
+
|
50
|
+
// sign via api
|
51
|
+
const signResult = await signMessage({
|
52
|
+
baseUrl: getThirdwebBaseUrl("engineCloud"),
|
53
|
+
body: {
|
54
|
+
params: [
|
55
|
+
{
|
56
|
+
format: "text",
|
57
|
+
message: "Hello, world!",
|
58
|
+
},
|
59
|
+
],
|
60
|
+
signingOptions: {
|
61
|
+
from: account.address,
|
62
|
+
type: "eoa",
|
63
|
+
},
|
64
|
+
},
|
65
|
+
bodySerializer: stringify,
|
66
|
+
fetch: clientIdFetch,
|
67
|
+
headers: {
|
68
|
+
"x-wallet-access-token": authToken,
|
69
|
+
},
|
70
|
+
});
|
71
|
+
|
72
|
+
const signatureResult = signResult.data?.result?.results[0];
|
73
|
+
if (signatureResult && "result" in signatureResult) {
|
74
|
+
expect(signatureResult.result.signature).toEqual(rawSignature);
|
75
|
+
} else {
|
76
|
+
throw new Error(
|
77
|
+
`Failed to sign message: ${stringify(signatureResult?.error) || "Unknown error"}`,
|
78
|
+
);
|
79
|
+
}
|
80
|
+
});
|
81
|
+
|
82
|
+
it("should queue a 4337 transaction", async () => {
|
83
|
+
const body = {
|
84
|
+
executionOptions: {
|
85
|
+
chainId: sepolia.id,
|
86
|
+
from: account.address,
|
87
|
+
type: "auto" as const,
|
88
|
+
},
|
89
|
+
params: [
|
90
|
+
{
|
91
|
+
data: "0x",
|
92
|
+
to: account.address,
|
93
|
+
value: "0",
|
94
|
+
},
|
95
|
+
],
|
96
|
+
};
|
97
|
+
const result = await sendTransaction({
|
98
|
+
baseUrl: getThirdwebBaseUrl("engineCloud"),
|
99
|
+
body,
|
100
|
+
bodySerializer: stringify,
|
101
|
+
fetch: clientIdFetch,
|
102
|
+
headers: {
|
103
|
+
"x-wallet-access-token": authToken,
|
104
|
+
},
|
105
|
+
});
|
106
|
+
if (result.error) {
|
107
|
+
throw new Error(
|
108
|
+
`Error sending transaction: ${stringify(result.error)}`,
|
109
|
+
);
|
110
|
+
}
|
111
|
+
|
112
|
+
const txId = result.data?.result.transactions[0]?.id;
|
113
|
+
console.log(txId);
|
114
|
+
if (!txId) {
|
115
|
+
throw new Error("No transaction ID found");
|
116
|
+
}
|
117
|
+
|
118
|
+
const tx = await waitForTransactionHash({
|
119
|
+
client: TEST_CLIENT,
|
120
|
+
transactionId: txId,
|
121
|
+
});
|
122
|
+
|
123
|
+
console.log(tx);
|
124
|
+
expect(tx.transactionHash).toBeDefined();
|
125
|
+
});
|
126
|
+
});
|