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.
Files changed (130) hide show
  1. package/dist/cjs/engine/server-wallet.js +64 -19
  2. package/dist/cjs/engine/server-wallet.js.map +1 -1
  3. package/dist/cjs/engine/wait-for-tx-hash.js +1 -1
  4. package/dist/cjs/engine/wait-for-tx-hash.js.map +1 -1
  5. package/dist/cjs/exports/wallets/in-app.js +5 -1
  6. package/dist/cjs/exports/wallets/in-app.js.map +1 -1
  7. package/dist/cjs/exports/wallets/in-app.native.js +5 -1
  8. package/dist/cjs/exports/wallets/in-app.native.js.map +1 -1
  9. package/dist/cjs/extensions/erc7702/account/createSessionKey.js +127 -0
  10. package/dist/cjs/extensions/erc7702/account/createSessionKey.js.map +1 -0
  11. package/dist/cjs/extensions/erc7702/account/types.js +57 -0
  12. package/dist/cjs/extensions/erc7702/account/types.js.map +1 -0
  13. package/dist/cjs/react/web/ui/Bridge/BridgeOrchestrator.js +2 -2
  14. package/dist/cjs/react/web/ui/Bridge/BridgeOrchestrator.js.map +1 -1
  15. package/dist/cjs/react/web/ui/Bridge/BuyWidget.js +1 -1
  16. package/dist/cjs/react/web/ui/Bridge/BuyWidget.js.map +1 -1
  17. package/dist/cjs/react/web/ui/Bridge/CheckoutWidget.js +1 -1
  18. package/dist/cjs/react/web/ui/Bridge/CheckoutWidget.js.map +1 -1
  19. package/dist/cjs/react/web/ui/Bridge/TransactionWidget.js +1 -1
  20. package/dist/cjs/react/web/ui/Bridge/TransactionWidget.js.map +1 -1
  21. package/dist/cjs/react/web/ui/Bridge/payment-details/PaymentDetails.js +1 -1
  22. package/dist/cjs/react/web/ui/Bridge/payment-details/PaymentDetails.js.map +1 -1
  23. package/dist/cjs/react/web/ui/Bridge/payment-selection/PaymentSelection.js +3 -3
  24. package/dist/cjs/react/web/ui/Bridge/payment-selection/PaymentSelection.js.map +1 -1
  25. package/dist/cjs/react/web/ui/Bridge/payment-selection/WalletFiatSelection.js +37 -37
  26. package/dist/cjs/react/web/ui/Bridge/payment-selection/WalletFiatSelection.js.map +1 -1
  27. package/dist/cjs/react/web/ui/PayEmbed.js +11 -4
  28. package/dist/cjs/react/web/ui/PayEmbed.js.map +1 -1
  29. package/dist/cjs/version.js +1 -1
  30. package/dist/cjs/wallets/in-app/core/authentication/backend.js +2 -1
  31. package/dist/cjs/wallets/in-app/core/authentication/backend.js.map +1 -1
  32. package/dist/cjs/wallets/in-app/core/authentication/guest.js +2 -8
  33. package/dist/cjs/wallets/in-app/core/authentication/guest.js.map +1 -1
  34. package/dist/cjs/wallets/in-app/core/eip7702/minimal-account.js +1 -1
  35. package/dist/cjs/wallets/in-app/native/native-connector.js +1 -1
  36. package/dist/cjs/wallets/in-app/native/native-connector.js.map +1 -1
  37. package/dist/cjs/wallets/in-app/web/lib/web-connector.js +1 -1
  38. package/dist/cjs/wallets/in-app/web/lib/web-connector.js.map +1 -1
  39. package/dist/esm/engine/server-wallet.js +65 -20
  40. package/dist/esm/engine/server-wallet.js.map +1 -1
  41. package/dist/esm/engine/wait-for-tx-hash.js +1 -1
  42. package/dist/esm/engine/wait-for-tx-hash.js.map +1 -1
  43. package/dist/esm/exports/wallets/in-app.js +2 -0
  44. package/dist/esm/exports/wallets/in-app.js.map +1 -1
  45. package/dist/esm/exports/wallets/in-app.native.js +2 -0
  46. package/dist/esm/exports/wallets/in-app.native.js.map +1 -1
  47. package/dist/esm/extensions/erc7702/account/createSessionKey.js +123 -0
  48. package/dist/esm/extensions/erc7702/account/createSessionKey.js.map +1 -0
  49. package/dist/esm/extensions/erc7702/account/types.js +54 -0
  50. package/dist/esm/extensions/erc7702/account/types.js.map +1 -0
  51. package/dist/esm/react/web/ui/Bridge/BridgeOrchestrator.js +2 -2
  52. package/dist/esm/react/web/ui/Bridge/BridgeOrchestrator.js.map +1 -1
  53. package/dist/esm/react/web/ui/Bridge/BuyWidget.js +1 -1
  54. package/dist/esm/react/web/ui/Bridge/BuyWidget.js.map +1 -1
  55. package/dist/esm/react/web/ui/Bridge/CheckoutWidget.js +1 -1
  56. package/dist/esm/react/web/ui/Bridge/CheckoutWidget.js.map +1 -1
  57. package/dist/esm/react/web/ui/Bridge/TransactionWidget.js +1 -1
  58. package/dist/esm/react/web/ui/Bridge/TransactionWidget.js.map +1 -1
  59. package/dist/esm/react/web/ui/Bridge/payment-details/PaymentDetails.js +1 -1
  60. package/dist/esm/react/web/ui/Bridge/payment-details/PaymentDetails.js.map +1 -1
  61. package/dist/esm/react/web/ui/Bridge/payment-selection/PaymentSelection.js +3 -3
  62. package/dist/esm/react/web/ui/Bridge/payment-selection/PaymentSelection.js.map +1 -1
  63. package/dist/esm/react/web/ui/Bridge/payment-selection/WalletFiatSelection.js +37 -37
  64. package/dist/esm/react/web/ui/Bridge/payment-selection/WalletFiatSelection.js.map +1 -1
  65. package/dist/esm/react/web/ui/PayEmbed.js +11 -4
  66. package/dist/esm/react/web/ui/PayEmbed.js.map +1 -1
  67. package/dist/esm/version.js +1 -1
  68. package/dist/esm/wallets/in-app/core/authentication/backend.js +2 -1
  69. package/dist/esm/wallets/in-app/core/authentication/backend.js.map +1 -1
  70. package/dist/esm/wallets/in-app/core/authentication/guest.js +2 -8
  71. package/dist/esm/wallets/in-app/core/authentication/guest.js.map +1 -1
  72. package/dist/esm/wallets/in-app/core/eip7702/minimal-account.js +1 -1
  73. package/dist/esm/wallets/in-app/native/native-connector.js +1 -1
  74. package/dist/esm/wallets/in-app/native/native-connector.js.map +1 -1
  75. package/dist/esm/wallets/in-app/web/lib/web-connector.js +1 -1
  76. package/dist/esm/wallets/in-app/web/lib/web-connector.js.map +1 -1
  77. package/dist/types/engine/server-wallet.d.ts +5 -2
  78. package/dist/types/engine/server-wallet.d.ts.map +1 -1
  79. package/dist/types/exports/wallets/in-app.d.ts +2 -0
  80. package/dist/types/exports/wallets/in-app.d.ts.map +1 -1
  81. package/dist/types/exports/wallets/in-app.native.d.ts +2 -0
  82. package/dist/types/exports/wallets/in-app.native.d.ts.map +1 -1
  83. package/dist/types/extensions/erc7702/account/createSessionKey.d.ts +69 -0
  84. package/dist/types/extensions/erc7702/account/createSessionKey.d.ts.map +1 -0
  85. package/dist/types/extensions/erc7702/account/types.d.ts +107 -0
  86. package/dist/types/extensions/erc7702/account/types.d.ts.map +1 -0
  87. package/dist/types/react/web/ui/Bridge/BridgeOrchestrator.d.ts +6 -1
  88. package/dist/types/react/web/ui/Bridge/BridgeOrchestrator.d.ts.map +1 -1
  89. package/dist/types/react/web/ui/Bridge/BuyWidget.d.ts +5 -0
  90. package/dist/types/react/web/ui/Bridge/BuyWidget.d.ts.map +1 -1
  91. package/dist/types/react/web/ui/Bridge/CheckoutWidget.d.ts +5 -0
  92. package/dist/types/react/web/ui/Bridge/CheckoutWidget.d.ts.map +1 -1
  93. package/dist/types/react/web/ui/Bridge/TransactionWidget.d.ts +5 -0
  94. package/dist/types/react/web/ui/Bridge/TransactionWidget.d.ts.map +1 -1
  95. package/dist/types/react/web/ui/Bridge/payment-details/PaymentDetails.d.ts.map +1 -1
  96. package/dist/types/react/web/ui/Bridge/payment-selection/PaymentSelection.d.ts +6 -1
  97. package/dist/types/react/web/ui/Bridge/payment-selection/PaymentSelection.d.ts.map +1 -1
  98. package/dist/types/react/web/ui/Bridge/payment-selection/WalletFiatSelection.d.ts +2 -1
  99. package/dist/types/react/web/ui/Bridge/payment-selection/WalletFiatSelection.d.ts.map +1 -1
  100. package/dist/types/react/web/ui/PayEmbed.d.ts +0 -1
  101. package/dist/types/react/web/ui/PayEmbed.d.ts.map +1 -1
  102. package/dist/types/version.d.ts +1 -1
  103. package/dist/types/wallets/in-app/core/authentication/backend.d.ts.map +1 -1
  104. package/dist/types/wallets/in-app/core/authentication/guest.d.ts +2 -2
  105. package/dist/types/wallets/in-app/core/authentication/guest.d.ts.map +1 -1
  106. package/package.json +2 -2
  107. package/src/engine/server-wallet.test.ts +23 -28
  108. package/src/engine/server-wallet.ts +80 -26
  109. package/src/engine/wait-for-tx-hash.ts +1 -1
  110. package/src/exports/wallets/in-app.native.ts +10 -0
  111. package/src/exports/wallets/in-app.ts +10 -0
  112. package/src/extensions/erc7702/account/createSessionKey.ts +181 -0
  113. package/src/extensions/erc7702/account/sessionkey.test.ts +132 -0
  114. package/src/extensions/erc7702/account/types.ts +94 -0
  115. package/src/react/web/ui/Bridge/BridgeOrchestrator.tsx +8 -0
  116. package/src/react/web/ui/Bridge/BuyWidget.tsx +7 -0
  117. package/src/react/web/ui/Bridge/CheckoutWidget.tsx +7 -0
  118. package/src/react/web/ui/Bridge/TransactionWidget.tsx +7 -0
  119. package/src/react/web/ui/Bridge/payment-details/PaymentDetails.tsx +3 -7
  120. package/src/react/web/ui/Bridge/payment-selection/PaymentSelection.tsx +10 -2
  121. package/src/react/web/ui/Bridge/payment-selection/WalletFiatSelection.tsx +133 -124
  122. package/src/react/web/ui/PayEmbed.tsx +17 -1
  123. package/src/version.ts +1 -1
  124. package/src/wallets/in-app/core/authentication/backend.test.ts +1 -0
  125. package/src/wallets/in-app/core/authentication/backend.ts +2 -1
  126. package/src/wallets/in-app/core/authentication/guest.ts +4 -11
  127. package/src/wallets/in-app/core/eip7702/minimal-account.ts +1 -1
  128. package/src/wallets/in-app/native/native-connector.ts +1 -1
  129. package/src/wallets/in-app/web/lib/in-app-gateway.test.ts +126 -0
  130. 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
- chainsMetadata.find(
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: paymentMethods,
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={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
- <Text color="primaryText" size="md">
38
- Pay with Crypto
39
- </Text>
40
- <Spacer y="md" />
41
- {/* Connected Wallets */}
42
- {connectedWallets.length > 0 && (
39
+ {paymentMethods.includes("crypto") && (
43
40
  <>
44
- <Container flex="column" gap="sm">
45
- {connectedWallets.map((wallet) => {
46
- const account = wallet.getAccount();
47
- if (!account?.address) {
48
- return null;
49
- }
50
- return (
51
- <Button
52
- fullWidth
53
- key={wallet.id}
54
- onClick={() => onWalletSelected(wallet)}
55
- style={{
56
- backgroundColor: theme.colors.tertiaryBg,
57
- border: `1px solid ${theme.colors.borderColor}`,
58
- borderRadius: radius.md,
59
- justifyContent: "space-between",
60
- padding: `${spacing.sm} ${spacing.md}`,
61
- }}
62
- variant="secondary"
63
- >
64
- <WalletRow
65
- address={account?.address}
66
- client={client}
67
- iconSize="lg"
68
- textSize="sm"
69
- />
70
- <ChevronRightIcon
71
- style={{ height: iconSize.md, width: iconSize.md }}
72
- />
73
- </Button>
74
- );
75
- })}
76
- </Container>
77
- <Spacer y="sm" />
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
- {/* Connect Another Wallet */}
82
- <Button
83
- fullWidth
84
- onClick={onConnectWallet}
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
- alignItems: "center",
103
- border: `1px dashed ${theme.colors.secondaryIconColor}`,
104
- borderRadius: radius.sm,
105
- display: "flex",
106
- height: iconSize.lg,
107
- justifyContent: "center",
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
- <PlusIcon
113
- color={theme.colors.secondaryText}
114
- height={iconSize.md}
115
- width={iconSize.md}
116
- />
117
- </Container>
118
- <Container flex="column" gap="3xs" style={{ flex: 1 }}>
119
- <Text color="primaryText" size="sm" style={{ fontWeight: 600 }}>
120
- Connect Another Wallet
121
- </Text>
122
- <Text color="secondaryText" size="xs">
123
- Use a different wallet to pay
124
- </Text>
125
- </Container>
126
- </Container>
127
- </Button>
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
- <Spacer y="md" />
135
+ {paymentMethods.includes("card") && (
136
+ <>
137
+ <Spacer y="md" />
130
138
 
131
- {/* Pay with Debit Card */}
132
- <Text color="primaryText" size="md">
133
- Pay with Fiat
134
- </Text>
139
+ <Text color="primaryText" size="md">
140
+ Pay with Card
141
+ </Text>
135
142
 
136
- <Spacer y="md" />
143
+ <Spacer y="md" />
137
144
 
138
- <Button
139
- fullWidth
140
- onClick={onFiatSelected}
141
- style={{
142
- backgroundColor: theme.colors.tertiaryBg,
143
- border: `1px solid ${theme.colors.borderColor}`,
144
- borderRadius: radius.md,
145
- height: "auto",
146
- padding: `${spacing.sm} ${spacing.md}`,
147
- textAlign: "left",
148
- }}
149
- variant="secondary"
150
- >
151
- <Container
152
- flex="row"
153
- gap="md"
154
- style={{ alignItems: "center", width: "100%" }}
155
- >
156
- <CreditCardIcon
157
- color={theme.colors.secondaryIconColor}
158
- size={iconSize.lg}
159
- />
160
- <Container flex="column" gap="3xs" style={{ flex: 1 }}>
161
- <Text color="primaryText" size="sm" style={{ fontWeight: 600 }}>
162
- Pay with Card
163
- </Text>
164
- <Text color="secondaryText" size="xs">
165
- Buy crypto and bridge in one step
166
- </Text>
167
- </Container>
168
- </Container>
169
- </Button>
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.3-nightly-6d1d344c48302d45aeb63532c84cc8e79c93e26f-20250628000422";
1
+ export const version = "5.105.4-nightly-1f72396d7fa4748efef179821a7a796b53679bcb-20250629000440";
@@ -49,6 +49,7 @@ describe("backendAuthenticate", () => {
49
49
  // Mock failed fetch response
50
50
  const mockFetch = vi.fn().mockResolvedValue({
51
51
  ok: false,
52
+ text: () => Promise.resolve("Failed to generate backend account"),
52
53
  });
53
54
 
54
55
  // Mock dependencies
@@ -31,7 +31,8 @@ export async function backendAuthenticate(args: {
31
31
  });
32
32
 
33
33
  if (!res.ok) {
34
- throw new Error("Failed to generate backend account");
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: AsyncStorage;
16
+ storage: ClientScopedStorage;
18
17
  ecosystem?: Ecosystem;
19
18
  }): Promise<AuthStoredTokenWithCookieReturnType> {
20
- const storage = new ClientScopedStorage({
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
- "0xbaC7e770af15d130Cd72838ff386f14FBF3e9a3D";
27
+ "0xD6999651Fc0964B9c6B444307a0ab20534a66560";
28
28
 
29
29
  export const create7702MinimalAccount = (args: {
30
30
  client: ThirdwebClient;
@@ -165,7 +165,7 @@ export class InAppNativeConnector implements InAppConnector {
165
165
  return guestAuthenticate({
166
166
  client: this.client,
167
167
  ecosystem: params.ecosystem,
168
- storage: nativeLocalStorage,
168
+ storage: this.storage,
169
169
  });
170
170
  }
171
171
  case "backend": {
@@ -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
+ });
@@ -352,7 +352,7 @@ export class InAppWebConnector implements InAppConnector {
352
352
  return guestAuthenticate({
353
353
  client: this.client,
354
354
  ecosystem: this.ecosystem,
355
- storage: webLocalStorage,
355
+ storage: this.storage,
356
356
  });
357
357
  }
358
358
  case "backend": {