thirdweb 5.105.17-nightly-31d7173432d7437000787434da91f2b1608128fb-20250720000427 → 5.105.17
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/list-server-wallets.js +4 -0
- package/dist/cjs/engine/list-server-wallets.js.map +1 -1
- package/dist/cjs/engine/server-wallet.js +22 -1
- package/dist/cjs/engine/server-wallet.js.map +1 -1
- package/dist/cjs/react/core/hooks/transaction/useSendAndConfirmTransaction.js.map +1 -1
- package/dist/cjs/react/core/hooks/transaction/useSendTransaction.js.map +1 -1
- package/dist/cjs/react/native/ui/connect/ConnectButton.js +7 -6
- package/dist/cjs/react/native/ui/connect/ConnectButton.js.map +1 -1
- package/dist/cjs/react/native/ui/connect/ConnectModal.js +12 -1
- package/dist/cjs/react/native/ui/connect/ConnectModal.js.map +1 -1
- package/dist/cjs/react/web/ui/Bridge/TransactionPayment.js +10 -2
- package/dist/cjs/react/web/ui/Bridge/TransactionPayment.js.map +1 -1
- package/dist/cjs/transaction/actions/send-batch-transaction.js.map +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/version.js.map +1 -1
- package/dist/esm/engine/list-server-wallets.js +4 -0
- package/dist/esm/engine/list-server-wallets.js.map +1 -1
- package/dist/esm/engine/server-wallet.js +22 -1
- package/dist/esm/engine/server-wallet.js.map +1 -1
- package/dist/esm/react/core/hooks/transaction/useSendAndConfirmTransaction.js.map +1 -1
- package/dist/esm/react/core/hooks/transaction/useSendTransaction.js +1 -1
- package/dist/esm/react/core/hooks/transaction/useSendTransaction.js.map +1 -1
- package/dist/esm/react/native/ui/connect/ConnectButton.js +7 -6
- package/dist/esm/react/native/ui/connect/ConnectButton.js.map +1 -1
- package/dist/esm/react/native/ui/connect/ConnectModal.js +12 -1
- package/dist/esm/react/native/ui/connect/ConnectModal.js.map +1 -1
- package/dist/esm/react/web/ui/Bridge/TransactionPayment.js +10 -2
- package/dist/esm/react/web/ui/Bridge/TransactionPayment.js.map +1 -1
- package/dist/esm/transaction/actions/send-batch-transaction.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/types/engine/create-server-wallet.d.ts +1 -0
- package/dist/types/engine/create-server-wallet.d.ts.map +1 -1
- package/dist/types/engine/list-server-wallets.d.ts +14 -4
- package/dist/types/engine/list-server-wallets.d.ts.map +1 -1
- package/dist/types/engine/server-wallet.d.ts.map +1 -1
- package/dist/types/react/core/hooks/transaction/useSendAndConfirmTransaction.d.ts +2 -2
- package/dist/types/react/core/hooks/transaction/useSendAndConfirmTransaction.d.ts.map +1 -1
- package/dist/types/react/core/hooks/transaction/useSendBatchTransaction.d.ts +2 -2
- package/dist/types/react/core/hooks/transaction/useSendBatchTransaction.d.ts.map +1 -1
- package/dist/types/react/core/hooks/transaction/useSendTransaction.d.ts +2 -1
- package/dist/types/react/core/hooks/transaction/useSendTransaction.d.ts.map +1 -1
- package/dist/types/react/native/hooks/transaction/useSendTransaction.d.ts +1 -1
- package/dist/types/react/native/hooks/transaction/useSendTransaction.d.ts.map +1 -1
- package/dist/types/react/native/ui/connect/ConnectButton.d.ts.map +1 -1
- package/dist/types/react/native/ui/connect/ConnectModal.d.ts +1 -1
- package/dist/types/react/native/ui/connect/ConnectModal.d.ts.map +1 -1
- package/dist/types/react/web/hooks/transaction/useSendTransaction.d.ts +1 -1
- package/dist/types/react/web/hooks/transaction/useSendTransaction.d.ts.map +1 -1
- package/dist/types/react/web/ui/Bridge/TransactionPayment.d.ts.map +1 -1
- package/dist/types/transaction/actions/send-batch-transaction.d.ts +2 -2
- package/dist/types/transaction/actions/send-batch-transaction.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/dist/types/version.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/engine/list-server-wallets.ts +6 -0
- package/src/engine/server-wallet.test.ts +11 -12
- package/src/engine/server-wallet.ts +22 -2
- package/src/react/core/hooks/transaction/useSendAndConfirmTransaction.ts +6 -2
- package/src/react/core/hooks/transaction/useSendBatchTransaction.ts +2 -2
- package/src/react/core/hooks/transaction/useSendTransaction.ts +9 -2
- package/src/react/native/ui/connect/ConnectButton.tsx +22 -6
- package/src/react/native/ui/connect/ConnectModal.tsx +37 -5
- package/src/react/web/ui/Bridge/TransactionPayment.tsx +19 -5
- package/src/transaction/actions/send-batch-transaction.ts +2 -2
- package/src/version.ts +1 -1
|
@@ -181,6 +181,18 @@ export function serverWallet(options: ServerWalletOptions): ServerWallet {
|
|
|
181
181
|
chainId,
|
|
182
182
|
type: "ERC4337",
|
|
183
183
|
};
|
|
184
|
+
case "EOA":
|
|
185
|
+
return {
|
|
186
|
+
chainId,
|
|
187
|
+
from: address,
|
|
188
|
+
type: "EOA",
|
|
189
|
+
};
|
|
190
|
+
case "EIP7702":
|
|
191
|
+
return {
|
|
192
|
+
chainId,
|
|
193
|
+
from: address,
|
|
194
|
+
type: "EIP7702",
|
|
195
|
+
};
|
|
184
196
|
}
|
|
185
197
|
};
|
|
186
198
|
|
|
@@ -192,7 +204,7 @@ export function serverWallet(options: ServerWalletOptions): ServerWallet {
|
|
|
192
204
|
if (!chainId) {
|
|
193
205
|
return {
|
|
194
206
|
from: address,
|
|
195
|
-
type: "
|
|
207
|
+
type: "EOA",
|
|
196
208
|
};
|
|
197
209
|
}
|
|
198
210
|
|
|
@@ -212,7 +224,6 @@ export function serverWallet(options: ServerWalletOptions): ServerWallet {
|
|
|
212
224
|
type: "ERC4337",
|
|
213
225
|
};
|
|
214
226
|
}
|
|
215
|
-
|
|
216
227
|
case "auto": {
|
|
217
228
|
return {
|
|
218
229
|
chainId,
|
|
@@ -220,6 +231,14 @@ export function serverWallet(options: ServerWalletOptions): ServerWallet {
|
|
|
220
231
|
type: "auto",
|
|
221
232
|
};
|
|
222
233
|
}
|
|
234
|
+
case "EIP7702":
|
|
235
|
+
case "EOA": {
|
|
236
|
+
return {
|
|
237
|
+
chainId,
|
|
238
|
+
from: address,
|
|
239
|
+
type: "EOA",
|
|
240
|
+
};
|
|
241
|
+
}
|
|
223
242
|
}
|
|
224
243
|
};
|
|
225
244
|
|
|
@@ -245,6 +264,7 @@ export function serverWallet(options: ServerWalletOptions): ServerWallet {
|
|
|
245
264
|
params: transaction.map((t) => ({
|
|
246
265
|
data: t.data,
|
|
247
266
|
to: t.to,
|
|
267
|
+
gasLimit: t.gas ? Number(t.gas) : undefined,
|
|
248
268
|
value: t.value?.toString(),
|
|
249
269
|
})),
|
|
250
270
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type UseMutationResult, useMutation } from "@tanstack/react-query";
|
|
2
2
|
import type { GaslessOptions } from "../../../../transaction/actions/gasless/types.js";
|
|
3
3
|
import { sendAndConfirmTransaction } from "../../../../transaction/actions/send-and-confirm-transaction.js";
|
|
4
|
-
import type {
|
|
4
|
+
import type { SendTransactionOptions } from "../../../../transaction/actions/send-transaction.js";
|
|
5
5
|
import type { TransactionReceipt } from "../../../../transaction/types.js";
|
|
6
6
|
import { useActiveAccount } from "../wallets/useActiveAccount.js";
|
|
7
7
|
|
|
@@ -56,7 +56,11 @@ type SendAndConfirmTransactionConfig = {
|
|
|
56
56
|
*/
|
|
57
57
|
export function useSendAndConfirmTransaction(
|
|
58
58
|
config: SendAndConfirmTransactionConfig = {},
|
|
59
|
-
): UseMutationResult<
|
|
59
|
+
): UseMutationResult<
|
|
60
|
+
TransactionReceipt,
|
|
61
|
+
Error,
|
|
62
|
+
SendTransactionOptions["transaction"]
|
|
63
|
+
> {
|
|
60
64
|
const account = useActiveAccount();
|
|
61
65
|
const { gasless } = config;
|
|
62
66
|
return useMutation({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type UseMutationResult, useMutation } from "@tanstack/react-query";
|
|
2
2
|
import { sendBatchTransaction } from "../../../../transaction/actions/send-batch-transaction.js";
|
|
3
|
+
import type { SendTransactionOptions } from "../../../../transaction/actions/send-transaction.js";
|
|
3
4
|
import type { WaitForReceiptOptions } from "../../../../transaction/actions/wait-for-tx-receipt.js";
|
|
4
|
-
import type { PreparedTransaction } from "../../../../transaction/prepare-transaction.js";
|
|
5
5
|
import { useActiveAccount } from "../wallets/useActiveAccount.js";
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -20,7 +20,7 @@ import { useActiveAccount } from "../wallets/useActiveAccount.js";
|
|
|
20
20
|
export function useSendBatchTransaction(): UseMutationResult<
|
|
21
21
|
WaitForReceiptOptions,
|
|
22
22
|
Error,
|
|
23
|
-
|
|
23
|
+
SendTransactionOptions["transaction"][]
|
|
24
24
|
> {
|
|
25
25
|
const account = useActiveAccount();
|
|
26
26
|
return useMutation({
|
|
@@ -9,7 +9,10 @@ import type { BuyWithFiatStatus } from "../../../../pay/buyWithFiat/getStatus.js
|
|
|
9
9
|
import type { PurchaseData } from "../../../../pay/types.js";
|
|
10
10
|
import type { FiatProvider } from "../../../../pay/utils/commonTypes.js";
|
|
11
11
|
import type { GaslessOptions } from "../../../../transaction/actions/gasless/types.js";
|
|
12
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
type SendTransactionOptions,
|
|
14
|
+
sendTransaction,
|
|
15
|
+
} from "../../../../transaction/actions/send-transaction.js";
|
|
13
16
|
import type { WaitForReceiptOptions } from "../../../../transaction/actions/wait-for-tx-receipt.js";
|
|
14
17
|
import type { PreparedTransaction } from "../../../../transaction/prepare-transaction.js";
|
|
15
18
|
import { getTransactionGasCost } from "../../../../transaction/utils.js";
|
|
@@ -132,7 +135,11 @@ export function useSendTransactionCore(args: {
|
|
|
132
135
|
gasless?: GaslessOptions;
|
|
133
136
|
wallet: Wallet | undefined;
|
|
134
137
|
switchChain: (chain: Chain) => Promise<void>;
|
|
135
|
-
}): UseMutationResult<
|
|
138
|
+
}): UseMutationResult<
|
|
139
|
+
WaitForReceiptOptions,
|
|
140
|
+
Error,
|
|
141
|
+
SendTransactionOptions["transaction"]
|
|
142
|
+
> {
|
|
136
143
|
const { showPayModal, gasless, wallet, switchChain } = args;
|
|
137
144
|
let _account = wallet?.getAccount();
|
|
138
145
|
|
|
@@ -16,7 +16,8 @@ import { useActiveAccount } from "../../../core/hooks/wallets/useActiveAccount.j
|
|
|
16
16
|
import { useActiveWallet } from "../../../core/hooks/wallets/useActiveWallet.js";
|
|
17
17
|
import { useActiveWalletConnectionStatus } from "../../../core/hooks/wallets/useActiveWalletConnectionStatus.js";
|
|
18
18
|
import { useConnectionManager } from "../../../core/providers/connection-manager.js";
|
|
19
|
-
import {
|
|
19
|
+
import { getDefaultWallets } from "../../wallets/defaultWallets.js";
|
|
20
|
+
import { AutoConnect } from "../AutoConnect/AutoConnect.js";
|
|
20
21
|
import { ThemedButton } from "../components/button.js";
|
|
21
22
|
import { ThemedSpinner } from "../components/spinner.js";
|
|
22
23
|
import { ThemedText } from "../components/text.js";
|
|
@@ -47,11 +48,6 @@ export function ConnectButton(props: ConnectButtonProps) {
|
|
|
47
48
|
const status = useActiveWalletConnectionStatus();
|
|
48
49
|
const connectionManager = useConnectionManager();
|
|
49
50
|
const siweAuth = useSiweAuth(wallet, account, props.auth);
|
|
50
|
-
useAutoConnect({
|
|
51
|
-
...props,
|
|
52
|
-
siweAuth: siweAuth,
|
|
53
|
-
});
|
|
54
|
-
|
|
55
51
|
const fadeAnim = useRef(new Animated.Value(0)); // For background opacity
|
|
56
52
|
const slideAnim = useRef(new Animated.Value(screenHeight)); // For bottom sheet position
|
|
57
53
|
|
|
@@ -109,6 +105,25 @@ export function ConnectButton(props: ConnectButtonProps) {
|
|
|
109
105
|
const isConnectedAndNotAuth = isConnected && needsAuth;
|
|
110
106
|
const isConnectedAndAuth = isConnected && !needsAuth;
|
|
111
107
|
|
|
108
|
+
const wallets = props.wallets || getDefaultWallets(props);
|
|
109
|
+
|
|
110
|
+
const autoConnectComp = props.autoConnect !== false && (
|
|
111
|
+
<AutoConnect
|
|
112
|
+
accountAbstraction={props.accountAbstraction}
|
|
113
|
+
appMetadata={props.appMetadata}
|
|
114
|
+
chain={props.chain}
|
|
115
|
+
client={props.client}
|
|
116
|
+
onConnect={props.onConnect}
|
|
117
|
+
siweAuth={siweAuth}
|
|
118
|
+
timeout={
|
|
119
|
+
typeof props.autoConnect === "boolean"
|
|
120
|
+
? undefined
|
|
121
|
+
: props.autoConnect?.timeout
|
|
122
|
+
}
|
|
123
|
+
wallets={wallets}
|
|
124
|
+
/>
|
|
125
|
+
);
|
|
126
|
+
|
|
112
127
|
return (
|
|
113
128
|
<View>
|
|
114
129
|
{isConnectedAndAuth ? (
|
|
@@ -178,6 +193,7 @@ export function ConnectButton(props: ConnectButtonProps) {
|
|
|
178
193
|
</Animated.View>
|
|
179
194
|
</KeyboardAvoidingView>
|
|
180
195
|
</Modal>
|
|
196
|
+
{autoConnectComp}
|
|
181
197
|
</View>
|
|
182
198
|
);
|
|
183
199
|
}
|
|
@@ -14,10 +14,12 @@ import type { ConnectEmbedProps } from "../../../core/hooks/connection/ConnectEm
|
|
|
14
14
|
import { useActiveAccount } from "../../../core/hooks/wallets/useActiveAccount.js";
|
|
15
15
|
import { useActiveWallet } from "../../../core/hooks/wallets/useActiveWallet.js";
|
|
16
16
|
import { useDisconnect } from "../../../core/hooks/wallets/useDisconnect.js";
|
|
17
|
+
import { useIsAutoConnecting } from "../../../core/hooks/wallets/useIsAutoConnecting.js";
|
|
17
18
|
import { useConnectionManager } from "../../../core/providers/connection-manager.js";
|
|
18
19
|
import { useWalletInfo } from "../../../core/utils/wallet.js";
|
|
19
20
|
import { radius, spacing } from "../../design-system/index.js";
|
|
20
21
|
import { getDefaultWallets } from "../../wallets/defaultWallets.js";
|
|
22
|
+
import { AutoConnect } from "../AutoConnect/AutoConnect.js";
|
|
21
23
|
import { ThemedButton, ThemedButtonWithIcon } from "../components/button.js";
|
|
22
24
|
import { type ContainerType, Header } from "../components/Header.js";
|
|
23
25
|
import { RNImage } from "../components/RNImage.js";
|
|
@@ -32,6 +34,7 @@ import { TW_ICON, WALLET_ICON } from "../icons/svgs.js";
|
|
|
32
34
|
import { ErrorView } from "./ErrorView.js";
|
|
33
35
|
import { AllWalletsList, ExternalWalletsList } from "./ExternalWalletsList.js";
|
|
34
36
|
import { InAppWalletUI, OtpLogin, PasskeyView } from "./InAppWalletUI.js";
|
|
37
|
+
import { LoadingView } from "./LoadingView.js";
|
|
35
38
|
import WalletLoadingThumbnail from "./WalletLoadingThumbnail.js";
|
|
36
39
|
|
|
37
40
|
export type ModalState =
|
|
@@ -74,14 +77,43 @@ export function ConnectEmbed(props: ConnectEmbedProps) {
|
|
|
74
77
|
...props,
|
|
75
78
|
connectModal: { ...props },
|
|
76
79
|
} as ConnectButtonProps;
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
80
|
+
const isAutoConnecting = useIsAutoConnecting();
|
|
81
|
+
const wallets = props.wallets || getDefaultWallets(props);
|
|
82
|
+
|
|
83
|
+
const autoConnectComp = props.autoConnect !== false && (
|
|
84
|
+
<AutoConnect
|
|
85
|
+
accountAbstraction={props.accountAbstraction}
|
|
86
|
+
appMetadata={props.appMetadata}
|
|
87
|
+
chain={props.chain}
|
|
88
|
+
client={props.client}
|
|
89
|
+
onConnect={props.onConnect}
|
|
81
90
|
siweAuth={siweAuth}
|
|
82
|
-
|
|
91
|
+
timeout={
|
|
92
|
+
typeof props.autoConnect === "boolean"
|
|
93
|
+
? undefined
|
|
94
|
+
: props.autoConnect?.timeout
|
|
95
|
+
}
|
|
96
|
+
wallets={wallets}
|
|
83
97
|
/>
|
|
84
98
|
);
|
|
99
|
+
|
|
100
|
+
if (isAutoConnecting) {
|
|
101
|
+
return <LoadingView theme={theme} />;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return isConnected ? (
|
|
105
|
+
autoConnectComp
|
|
106
|
+
) : (
|
|
107
|
+
<>
|
|
108
|
+
<ConnectModal
|
|
109
|
+
{...adaptedProps}
|
|
110
|
+
containerType="embed"
|
|
111
|
+
siweAuth={siweAuth}
|
|
112
|
+
theme={theme}
|
|
113
|
+
/>
|
|
114
|
+
{autoConnectComp}
|
|
115
|
+
</>
|
|
116
|
+
);
|
|
85
117
|
}
|
|
86
118
|
|
|
87
119
|
export function ConnectModal(
|
|
@@ -361,12 +361,26 @@ export function TransactionPayment({
|
|
|
361
361
|
fullWidth
|
|
362
362
|
onClick={() => {
|
|
363
363
|
if (transactionDataQuery.data?.tokenInfo) {
|
|
364
|
+
if (
|
|
365
|
+
userBalance &&
|
|
366
|
+
Number(userBalance) <
|
|
367
|
+
Number(transactionDataQuery.data.totalCost)
|
|
368
|
+
) {
|
|
369
|
+
// if user has funds, but not enough, we need to fund the wallet with the difference
|
|
370
|
+
onContinue(
|
|
371
|
+
(
|
|
372
|
+
Number(transactionDataQuery.data.totalCost) -
|
|
373
|
+
Number(userBalance)
|
|
374
|
+
).toString(),
|
|
375
|
+
transactionDataQuery.data.tokenInfo,
|
|
376
|
+
getAddress(activeAccount.address),
|
|
377
|
+
);
|
|
378
|
+
return;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
// otherwise, use the full transaction cost
|
|
364
382
|
onContinue(
|
|
365
|
-
|
|
366
|
-
0,
|
|
367
|
-
Number(transactionDataQuery.data.totalCost) -
|
|
368
|
-
Number(userBalance ?? "0"),
|
|
369
|
-
).toString(),
|
|
383
|
+
transactionDataQuery.data.totalCost,
|
|
370
384
|
transactionDataQuery.data.tokenInfo,
|
|
371
385
|
getAddress(activeAccount.address),
|
|
372
386
|
);
|
|
@@ -3,12 +3,12 @@ import type {
|
|
|
3
3
|
Account,
|
|
4
4
|
SendTransactionOption,
|
|
5
5
|
} from "../../wallets/interfaces/wallet.js";
|
|
6
|
-
import type { PreparedTransaction } from "../prepare-transaction.js";
|
|
7
6
|
import { encode } from "./encode.js";
|
|
7
|
+
import type { SendTransactionOptions } from "./send-transaction.js";
|
|
8
8
|
import type { WaitForReceiptOptions } from "./wait-for-tx-receipt.js";
|
|
9
9
|
|
|
10
10
|
export type SendBatchTransactionOptions = {
|
|
11
|
-
transactions:
|
|
11
|
+
transactions: SendTransactionOptions["transaction"][];
|
|
12
12
|
account: Account;
|
|
13
13
|
};
|
|
14
14
|
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = "5.105.17
|
|
1
|
+
export const version = "5.105.17";
|