thirdweb 5.101.2-nightly-ec7bc2bb1e58f1a45d01eec0f308bc0f86479050-20250527000403 → 5.101.2-nightly-91750eddc6cc3eb20c36b74490d820b92ea5500f-20250529000432
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/bridge/Onramp.js +21 -1
- package/dist/cjs/bridge/Onramp.js.map +1 -1
- package/dist/cjs/extensions/prebuilts/deploy-published.js +1 -1
- package/dist/cjs/extensions/prebuilts/deploy-published.js.map +1 -1
- package/dist/cjs/extensions/prebuilts/get-required-transactions.js +2 -2
- package/dist/cjs/extensions/prebuilts/get-required-transactions.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/ConnectButton.js +8 -3
- package/dist/cjs/react/web/ui/ConnectWallet/ConnectButton.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/Modal/ConnectEmbed.js +2 -2
- package/dist/cjs/react/web/ui/ConnectWallet/Modal/ConnectEmbed.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/Modal/ConnectModal.js +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/Modal/ConnectModal.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatScreenContent.js +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatScreenContent.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.js +13 -0
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/SwapScreenContent.js +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/SwapScreenContent.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/TransferConfirmationScreen.js +15 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/TransferConfirmationScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/useConnectModal.js +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/useConnectModal.js.map +1 -1
- package/dist/cjs/react/web/ui/components/Spinner.js +1 -1
- package/dist/cjs/react/web/ui/components/Spinner.js.map +1 -1
- package/dist/cjs/utils/extensions/drops/process-override-list.js +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/bridge/Onramp.js +21 -1
- package/dist/esm/bridge/Onramp.js.map +1 -1
- package/dist/esm/extensions/prebuilts/deploy-published.js +1 -1
- package/dist/esm/extensions/prebuilts/deploy-published.js.map +1 -1
- package/dist/esm/extensions/prebuilts/get-required-transactions.js +2 -2
- package/dist/esm/extensions/prebuilts/get-required-transactions.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/ConnectButton.js +8 -3
- package/dist/esm/react/web/ui/ConnectWallet/ConnectButton.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/Modal/ConnectEmbed.js +2 -2
- package/dist/esm/react/web/ui/ConnectWallet/Modal/ConnectEmbed.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/Modal/ConnectModal.js +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/Modal/ConnectModal.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatScreenContent.js +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatScreenContent.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.js +13 -0
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/SwapScreenContent.js +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/SwapScreenContent.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/TransferConfirmationScreen.js +15 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/TransferConfirmationScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/useConnectModal.js +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/useConnectModal.js.map +1 -1
- package/dist/esm/react/web/ui/components/Spinner.js +1 -1
- package/dist/esm/react/web/ui/components/Spinner.js.map +1 -1
- package/dist/esm/utils/extensions/drops/process-override-list.js +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/types/bridge/Onramp.d.ts +18 -0
- package/dist/types/bridge/Onramp.d.ts.map +1 -1
- package/dist/types/react/core/hooks/connection/ConnectButtonProps.d.ts +4 -0
- package/dist/types/react/core/hooks/connection/ConnectButtonProps.d.ts.map +1 -1
- package/dist/types/react/core/hooks/connection/ConnectEmbedProps.d.ts +5 -0
- package/dist/types/react/core/hooks/connection/ConnectEmbedProps.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/ConnectButton.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/Modal/ConnectEmbed.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/Modal/ConnectModal.d.ts +2 -0
- package/dist/types/react/web/ui/ConnectWallet/Modal/ConnectModal.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/TransferConfirmationScreen.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/useConnectModal.d.ts +5 -0
- package/dist/types/react/web/ui/ConnectWallet/useConnectModal.d.ts.map +1 -1
- package/dist/types/react/web/ui/components/Spinner.d.ts +1 -1
- package/dist/types/react/web/ui/components/Spinner.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +3 -3
- package/src/bridge/Onramp.ts +23 -0
- package/src/extensions/prebuilts/deploy-published.ts +1 -1
- package/src/extensions/prebuilts/get-required-transactions.ts +2 -2
- package/src/react/core/hooks/connection/ConnectButtonProps.ts +5 -0
- package/src/react/core/hooks/connection/ConnectEmbedProps.ts +6 -0
- package/src/react/web/ui/ConnectWallet/ConnectButton.tsx +10 -2
- package/src/react/web/ui/ConnectWallet/Modal/ConnectEmbed.tsx +4 -1
- package/src/react/web/ui/ConnectWallet/Modal/ConnectModal.tsx +3 -1
- package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatScreenContent.tsx +1 -1
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.tsx +15 -0
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/SwapScreenContent.tsx +1 -1
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/TransferConfirmationScreen.tsx +19 -1
- package/src/react/web/ui/ConnectWallet/useConnectModal.tsx +7 -0
- package/src/react/web/ui/components/Spinner.tsx +2 -2
- package/src/utils/extensions/drops/process-override-list.ts +1 -1
- package/src/version.ts +1 -1
- package/src/wallets/in-app/web/lib/in-app-integration.test.ts +128 -89
- package/src/wallets/in-app/core/eip7702/minimal-account.test.ts +0 -43
@@ -308,7 +308,7 @@ export async function deployContractfromDeployMetadata(
|
|
308
308
|
method,
|
309
309
|
params: normalizeFunctionParams(method, initializeParams),
|
310
310
|
});
|
311
|
-
//
|
311
|
+
// assumption here is that the factory address returns the deployed proxy address
|
312
312
|
const address = await simulateTransaction({
|
313
313
|
transaction: deployTx,
|
314
314
|
});
|
@@ -140,7 +140,7 @@ async function getTransactionsForImplementation(options: {
|
|
140
140
|
options;
|
141
141
|
|
142
142
|
if (deployMetadata.name === "MarketplaceV3") {
|
143
|
-
return
|
143
|
+
return getTransactionsForMarketplaceV3(options);
|
144
144
|
}
|
145
145
|
|
146
146
|
if (deployMetadata.routerType === "dynamic") {
|
@@ -173,7 +173,7 @@ async function getTransactionsForImplementation(options: {
|
|
173
173
|
return result ? [result] : [];
|
174
174
|
}
|
175
175
|
|
176
|
-
async function
|
176
|
+
async function getTransactionsForMarketplaceV3(options: {
|
177
177
|
chain: Chain;
|
178
178
|
client: ThirdwebClient;
|
179
179
|
}): Promise<DeployTransactionResult[]> {
|
@@ -981,6 +981,11 @@ export type ConnectButtonProps = {
|
|
981
981
|
*/
|
982
982
|
showAllWallets?: boolean;
|
983
983
|
|
984
|
+
/**
|
985
|
+
* All wallet IDs included in this array will be hidden from the wallet selection list.
|
986
|
+
*/
|
987
|
+
hiddenWallets?: WalletId[];
|
988
|
+
|
984
989
|
/**
|
985
990
|
* Enable SIWE (Sign in with Ethererum) by passing an object of type `SiweAuthOptions` to
|
986
991
|
* enforce the users to sign a message after connecting their wallet to authenticate themselves.
|
@@ -3,6 +3,7 @@ import type { ThirdwebClient } from "../../../../client/client.js";
|
|
3
3
|
import type { Wallet } from "../../../../wallets/interfaces/wallet.js";
|
4
4
|
import type { SmartWalletOptions } from "../../../../wallets/smart/types.js";
|
5
5
|
import type { AppMetadata } from "../../../../wallets/types.js";
|
6
|
+
import type { WalletId } from "../../../../wallets/wallet-types.js";
|
6
7
|
import type { WelcomeScreen } from "../../../web/ui/ConnectWallet/screens/types.js";
|
7
8
|
import type { LocaleId } from "../../../web/ui/types.js";
|
8
9
|
import type { Theme } from "../../design-system/index.js";
|
@@ -272,6 +273,11 @@ export type ConnectEmbedProps = {
|
|
272
273
|
*/
|
273
274
|
showAllWallets?: boolean;
|
274
275
|
|
276
|
+
/**
|
277
|
+
* All wallet IDs included in this array will be hidden from the wallet selection list.
|
278
|
+
*/
|
279
|
+
hiddenWallets?: WalletId[];
|
280
|
+
|
275
281
|
/**
|
276
282
|
* ConnectEmbed supports two modal size variants: `compact` and `wide`.
|
277
283
|
*
|
@@ -300,6 +300,8 @@ export function ConnectButton(props: ConnectButtonProps) {
|
|
300
300
|
const activeAccount = useActiveAccount();
|
301
301
|
const activeWallet = useActiveWallet();
|
302
302
|
const siweAuth = useSiweAuth(activeWallet, activeAccount, props.auth);
|
303
|
+
const hiddenWallets =
|
304
|
+
props.hiddenWallets || props.detailsModal?.hiddenWallets;
|
303
305
|
|
304
306
|
usePreloadWalletProviders({
|
305
307
|
wallets,
|
@@ -393,6 +395,7 @@ export function ConnectButton(props: ConnectButtonProps) {
|
|
393
395
|
onConnect={props.onConnect}
|
394
396
|
recommendedWallets={props.recommendedWallets}
|
395
397
|
showAllWallets={props.showAllWallets}
|
398
|
+
hiddenWallets={hiddenWallets}
|
396
399
|
walletConnect={props.walletConnect}
|
397
400
|
wallets={wallets}
|
398
401
|
/>
|
@@ -410,6 +413,8 @@ function ConnectButtonInner(
|
|
410
413
|
const siweAuth = props.siweAuth;
|
411
414
|
const activeAccount = useActiveAccount();
|
412
415
|
const [showSignatureModal, setShowSignatureModal] = useState(false);
|
416
|
+
const hiddenWallets =
|
417
|
+
props.hiddenWallets || props.detailsModal?.hiddenWallets;
|
413
418
|
|
414
419
|
// if wallet gets disconnected suddently, close the signature modal if it's open
|
415
420
|
useEffect(() => {
|
@@ -557,7 +562,10 @@ function ConnectButtonInner(
|
|
557
562
|
<ConnectedWalletDetails
|
558
563
|
theme={theme}
|
559
564
|
detailsButton={props.detailsButton}
|
560
|
-
detailsModal={
|
565
|
+
detailsModal={{
|
566
|
+
...props.detailsModal,
|
567
|
+
hiddenWallets: hiddenWallets,
|
568
|
+
}}
|
561
569
|
supportedTokens={supportedTokens}
|
562
570
|
supportedNFTs={props.supportedNFTs}
|
563
571
|
onDisconnect={(info) => {
|
@@ -582,7 +590,7 @@ function ConnectButtonInner(
|
|
582
590
|
showAllWallets: props.showAllWallets,
|
583
591
|
walletConnect: props.walletConnect,
|
584
592
|
wallets: props.wallets,
|
585
|
-
hiddenWallets:
|
593
|
+
hiddenWallets: hiddenWallets,
|
586
594
|
}}
|
587
595
|
/>
|
588
596
|
</AccountProvider>
|
@@ -5,6 +5,7 @@ import type { ThirdwebClient } from "../../../../../client/client.js";
|
|
5
5
|
import { getDefaultWallets } from "../../../../../wallets/defaultWallets.js";
|
6
6
|
import type { Wallet } from "../../../../../wallets/interfaces/wallet.js";
|
7
7
|
import type { SmartWalletOptions } from "../../../../../wallets/smart/types.js";
|
8
|
+
import type { WalletId } from "../../../../../wallets/wallet-types.js";
|
8
9
|
import {
|
9
10
|
CustomThemeProvider,
|
10
11
|
useCustomTheme,
|
@@ -295,6 +296,7 @@ export function ConnectEmbed(props: ConnectEmbedProps) {
|
|
295
296
|
modalSize={modalSize}
|
296
297
|
style={props.style}
|
297
298
|
welcomeScreen={props.welcomeScreen}
|
299
|
+
hiddenWallets={props.hiddenWallets}
|
298
300
|
/>
|
299
301
|
{autoConnectComp}
|
300
302
|
</WalletUIStatesProvider>
|
@@ -337,6 +339,7 @@ const ConnectEmbedContent = (props: {
|
|
337
339
|
onConnect: ((wallet: Wallet) => void) | undefined;
|
338
340
|
recommendedWallets: Wallet[] | undefined;
|
339
341
|
showAllWallets: boolean | undefined;
|
342
|
+
hiddenWallets: WalletId[] | undefined;
|
340
343
|
walletConnect:
|
341
344
|
| {
|
342
345
|
projectId?: string;
|
@@ -415,7 +418,7 @@ const ConnectEmbedContent = (props: {
|
|
415
418
|
walletConnect={props.walletConnect}
|
416
419
|
wallets={props.wallets}
|
417
420
|
modalHeader={undefined}
|
418
|
-
walletIdsToHide={
|
421
|
+
walletIdsToHide={props.hiddenWallets}
|
419
422
|
/>
|
420
423
|
);
|
421
424
|
}
|
@@ -4,6 +4,7 @@ import type { Chain } from "../../../../../chains/types.js";
|
|
4
4
|
import type { ThirdwebClient } from "../../../../../client/client.js";
|
5
5
|
import type { Wallet } from "../../../../../wallets/interfaces/wallet.js";
|
6
6
|
import type { SmartWalletOptions } from "../../../../../wallets/smart/types.js";
|
7
|
+
import type { WalletId } from "../../../../../wallets/wallet-types.js";
|
7
8
|
import type { SiweAuthOptions } from "../../../../core/hooks/auth/useSiweAuth.js";
|
8
9
|
import { useActiveAccount } from "../../../../core/hooks/wallets/useActiveAccount.js";
|
9
10
|
import {
|
@@ -42,6 +43,7 @@ type ConnectModalOptions = {
|
|
42
43
|
localeId: LocaleId;
|
43
44
|
chain: Chain | undefined;
|
44
45
|
showAllWallets: boolean | undefined;
|
46
|
+
hiddenWallets: WalletId[] | undefined;
|
45
47
|
chains: Chain[] | undefined;
|
46
48
|
walletConnect:
|
47
49
|
| {
|
@@ -151,7 +153,7 @@ const ConnectModal = (props: ConnectModalOptions) => {
|
|
151
153
|
chains={props.chains}
|
152
154
|
walletConnect={props.walletConnect}
|
153
155
|
modalHeader={undefined}
|
154
|
-
walletIdsToHide={
|
156
|
+
walletIdsToHide={props.hiddenWallets}
|
155
157
|
/>
|
156
158
|
</Modal>
|
157
159
|
);
|
@@ -78,6 +78,13 @@ export function SwapConfirmationScreen(props: {
|
|
78
78
|
message: "Your wallet rejected the approval request.",
|
79
79
|
};
|
80
80
|
}
|
81
|
+
if (error.toLowerCase().includes("insufficient funds for gas")) {
|
82
|
+
return {
|
83
|
+
title: "Insufficient Native Funds",
|
84
|
+
message:
|
85
|
+
"You do not have enough native funds to approve the transaction.",
|
86
|
+
};
|
87
|
+
}
|
81
88
|
return {
|
82
89
|
title: "Failed to Approve",
|
83
90
|
message:
|
@@ -96,6 +103,13 @@ export function SwapConfirmationScreen(props: {
|
|
96
103
|
message: "Your wallet rejected the confirmation request.",
|
97
104
|
};
|
98
105
|
}
|
106
|
+
if (error.toLowerCase().includes("insufficient funds for gas")) {
|
107
|
+
return {
|
108
|
+
title: "Insufficient Native Funds",
|
109
|
+
message:
|
110
|
+
"You do not have enough native funds to confirm the transaction.",
|
111
|
+
};
|
112
|
+
}
|
99
113
|
return {
|
100
114
|
title: "Failed to Confirm",
|
101
115
|
message:
|
@@ -333,6 +347,7 @@ export function SwapConfirmationScreen(props: {
|
|
333
347
|
} catch (e) {
|
334
348
|
console.error(e);
|
335
349
|
setStatus("error");
|
350
|
+
setError((e as Error).message);
|
336
351
|
}
|
337
352
|
}
|
338
353
|
}}
|
@@ -126,6 +126,13 @@ export function TransferConfirmationScreen(
|
|
126
126
|
message: "Your wallet rejected the approval request.",
|
127
127
|
};
|
128
128
|
}
|
129
|
+
if (status.error.toLowerCase().includes("insufficient funds for gas")) {
|
130
|
+
return {
|
131
|
+
title: "Insufficient Native Funds",
|
132
|
+
message:
|
133
|
+
"You do not have enough native funds to approve the transaction.",
|
134
|
+
};
|
135
|
+
}
|
129
136
|
return {
|
130
137
|
title: "Failed to Approve",
|
131
138
|
message:
|
@@ -138,12 +145,23 @@ export function TransferConfirmationScreen(
|
|
138
145
|
status.id === "error" &&
|
139
146
|
status.error
|
140
147
|
) {
|
141
|
-
if (
|
148
|
+
if (
|
149
|
+
status.error.toLowerCase().includes("user rejected") ||
|
150
|
+
status.error.toLowerCase().includes("user closed modal") ||
|
151
|
+
status.error.toLowerCase().includes("user denied")
|
152
|
+
) {
|
142
153
|
return {
|
143
154
|
title: "Failed to Confirm",
|
144
155
|
message: "Your wallet rejected the confirmation request.",
|
145
156
|
};
|
146
157
|
}
|
158
|
+
if (status.error.toLowerCase().includes("insufficient funds for gas")) {
|
159
|
+
return {
|
160
|
+
title: "Insufficient Native Funds",
|
161
|
+
message:
|
162
|
+
"You do not have enough native funds to confirm the transaction.",
|
163
|
+
};
|
164
|
+
}
|
147
165
|
return {
|
148
166
|
title: "Failed to Confirm",
|
149
167
|
message:
|
@@ -5,6 +5,7 @@ import { getDefaultWallets } from "../../../../wallets/defaultWallets.js";
|
|
5
5
|
import type { Wallet } from "../../../../wallets/interfaces/wallet.js";
|
6
6
|
import type { SmartWalletOptions } from "../../../../wallets/smart/types.js";
|
7
7
|
import type { AppMetadata } from "../../../../wallets/types.js";
|
8
|
+
import type { WalletId } from "../../../../wallets/wallet-types.js";
|
8
9
|
import type { Theme } from "../../../core/design-system/index.js";
|
9
10
|
import type { SiweAuthOptions } from "../../../core/hooks/auth/useSiweAuth.js";
|
10
11
|
import { SetRootElementContext } from "../../../core/providers/RootElementContext.js";
|
@@ -142,6 +143,7 @@ function Modal(
|
|
142
143
|
onConnect={props.onConnect}
|
143
144
|
recommendedWallets={props.recommendedWallets}
|
144
145
|
showAllWallets={props.showAllWallets}
|
146
|
+
hiddenWallets={props.hiddenWallets}
|
145
147
|
wallets={wallets}
|
146
148
|
chains={props.chains}
|
147
149
|
walletConnect={props.walletConnect}
|
@@ -364,6 +366,11 @@ export type UseConnectModalOptions = {
|
|
364
366
|
*/
|
365
367
|
showAllWallets?: boolean;
|
366
368
|
|
369
|
+
/**
|
370
|
+
* All wallet IDs included in this array will be hidden from the wallet selection list.
|
371
|
+
*/
|
372
|
+
hiddenWallets?: WalletId[];
|
373
|
+
|
367
374
|
/**
|
368
375
|
* Title to show in Connect Modal
|
369
376
|
*
|
@@ -9,8 +9,8 @@ import { StyledCircle, StyledSvg } from "../design-system/elements.js";
|
|
9
9
|
* @internal
|
10
10
|
*/
|
11
11
|
export const Spinner: React.FC<{
|
12
|
-
color: keyof Theme["colors"];
|
13
12
|
size: keyof typeof iconSize;
|
13
|
+
color?: keyof Theme["colors"];
|
14
14
|
}> = (props) => {
|
15
15
|
const theme = useCustomTheme();
|
16
16
|
return (
|
@@ -26,7 +26,7 @@ export const Spinner: React.FC<{
|
|
26
26
|
cy="25"
|
27
27
|
r="20"
|
28
28
|
fill="none"
|
29
|
-
stroke={theme.colors[props.color]}
|
29
|
+
stroke={props.color ? theme.colors[props.color] : "currentColor"}
|
30
30
|
strokeWidth={Number(iconSize[props.size]) > 64 ? "2" : "4"}
|
31
31
|
/>
|
32
32
|
</Svg>
|
@@ -90,7 +90,7 @@ export async function processOverrideList(options: {
|
|
90
90
|
client: options.client,
|
91
91
|
files: [stringify(options.overrides)],
|
92
92
|
});
|
93
|
-
// 7.
|
93
|
+
// 7. assemble the final sharded merkle tree info
|
94
94
|
const shardedMerkleInfo: ShardedMerkleTreeInfo = {
|
95
95
|
merkleRoot: tree.getHexRoot(),
|
96
96
|
baseUri,
|
package/src/version.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export const version = "5.101.2-nightly-
|
1
|
+
export const version = "5.101.2-nightly-91750eddc6cc3eb20c36b74490d820b92ea5500f-20250529000432";
|
@@ -1,112 +1,151 @@
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
2
2
|
import { TEST_CLIENT } from "~test/test-clients.js";
|
3
|
+
import { baseSepolia } from "../../../../chains/chain-definitions/base-sepolia.js";
|
3
4
|
import { sepolia } from "../../../../chains/chain-definitions/sepolia.js";
|
4
5
|
import { parseEventLogs } from "../../../../event/actions/parse-logs.js";
|
5
6
|
import { userOperationEventEvent } from "../../../../extensions/erc4337/__generated__/IEntryPoint/events/UserOperationEvent.js";
|
6
7
|
import { executedEvent } from "../../../../extensions/erc7702/__generated__/MinimalAccount/events/Executed.js";
|
7
8
|
import { sendAndConfirmTransaction } from "../../../../transaction/actions/send-and-confirm-transaction.js";
|
9
|
+
import { sendBatchTransaction } from "../../../../transaction/actions/send-batch-transaction.js";
|
8
10
|
import { prepareTransaction } from "../../../../transaction/prepare-transaction.js";
|
11
|
+
import { generateAccount } from "../../../utils/generateAccount.js";
|
9
12
|
import { inAppWallet } from "../in-app.js";
|
10
|
-
describe("InAppWallet Integration Tests", () => {
|
11
|
-
it("should sign a message with backend strategy", async () => {
|
12
|
-
const wallet = inAppWallet();
|
13
|
-
const account = await wallet.connect({
|
14
|
-
client: TEST_CLIENT,
|
15
|
-
strategy: "backend",
|
16
|
-
walletSecret: "test-secret",
|
17
|
-
});
|
18
|
-
expect(account.address).toBeDefined();
|
19
|
-
const message = await account.signMessage({
|
20
|
-
message: "Hello, world!",
|
21
|
-
});
|
22
|
-
expect(message).toBeDefined();
|
23
|
-
});
|
24
13
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
14
|
+
describe.runIf(process.env.TW_SECRET_KEY)(
|
15
|
+
"InAppWallet Integration Tests",
|
16
|
+
() => {
|
17
|
+
it("should sign a message with backend strategy", async () => {
|
18
|
+
const wallet = inAppWallet();
|
19
|
+
const account = await wallet.connect({
|
20
|
+
client: TEST_CLIENT,
|
21
|
+
strategy: "backend",
|
22
|
+
walletSecret: "test-secret",
|
23
|
+
});
|
24
|
+
expect(account.address).toBeDefined();
|
25
|
+
const message = await account.signMessage({
|
26
|
+
message: "Hello, world!",
|
27
|
+
});
|
28
|
+
expect(message).toBeDefined();
|
34
29
|
});
|
35
|
-
expect(message).toBeDefined();
|
36
|
-
});
|
37
30
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
executionMode: {
|
42
|
-
mode: "EIP7702",
|
43
|
-
sponsorGas: true,
|
44
|
-
},
|
45
|
-
});
|
46
|
-
const account = await wallet.connect({
|
47
|
-
client: TEST_CLIENT,
|
48
|
-
strategy: "guest",
|
49
|
-
chain,
|
50
|
-
});
|
51
|
-
expect(account.address).toBeDefined();
|
52
|
-
const tx = await sendAndConfirmTransaction({
|
53
|
-
transaction: prepareTransaction({
|
54
|
-
chain,
|
31
|
+
it("should sign a message with guest strategy", async () => {
|
32
|
+
const wallet = inAppWallet();
|
33
|
+
const account = await wallet.connect({
|
55
34
|
client: TEST_CLIENT,
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
account
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
logs: tx.logs,
|
64
|
-
events: [executedEvent()],
|
35
|
+
strategy: "guest",
|
36
|
+
});
|
37
|
+
expect(account.address).toBeDefined();
|
38
|
+
const message = await account.signMessage({
|
39
|
+
message: "Hello, world!",
|
40
|
+
});
|
41
|
+
expect(message).toBeDefined();
|
65
42
|
});
|
66
|
-
const executedLog = logs[0];
|
67
|
-
if (!executedLog) {
|
68
|
-
throw new Error("No executed log found");
|
69
|
-
}
|
70
|
-
expect(executedLog.args.to).toBe(account.address);
|
71
|
-
expect(executedLog.args.value).toBe(0n);
|
72
|
-
});
|
73
43
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
smartAccount: {
|
80
|
-
chain,
|
44
|
+
it("should sponsor gas for a 7702 smart account", async () => {
|
45
|
+
const chain = sepolia;
|
46
|
+
const wallet = inAppWallet({
|
47
|
+
executionMode: {
|
48
|
+
mode: "EIP7702",
|
81
49
|
sponsorGas: true,
|
82
50
|
},
|
83
|
-
}
|
51
|
+
});
|
52
|
+
const account = await wallet.connect({
|
53
|
+
client: TEST_CLIENT,
|
54
|
+
strategy: "guest",
|
55
|
+
chain,
|
56
|
+
});
|
57
|
+
expect(account.address).toBeDefined();
|
58
|
+
const tx = await sendAndConfirmTransaction({
|
59
|
+
transaction: prepareTransaction({
|
60
|
+
chain,
|
61
|
+
client: TEST_CLIENT,
|
62
|
+
to: account.address,
|
63
|
+
value: 0n,
|
64
|
+
}),
|
65
|
+
account,
|
66
|
+
});
|
67
|
+
expect(tx.transactionHash).toBeDefined();
|
68
|
+
const logs = parseEventLogs({
|
69
|
+
logs: tx.logs,
|
70
|
+
events: [executedEvent()],
|
71
|
+
});
|
72
|
+
const executedLog = logs[0];
|
73
|
+
if (!executedLog) {
|
74
|
+
throw new Error("No executed log found");
|
75
|
+
}
|
76
|
+
expect(executedLog.args.to).toBe(account.address);
|
77
|
+
expect(executedLog.args.value).toBe(0n);
|
84
78
|
});
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
79
|
+
|
80
|
+
it("should sponsor gas for a 4337 smart account", async () => {
|
81
|
+
const chain = sepolia;
|
82
|
+
const wallet = inAppWallet({
|
83
|
+
executionMode: {
|
84
|
+
mode: "EIP4337",
|
85
|
+
smartAccount: {
|
86
|
+
chain,
|
87
|
+
sponsorGas: true,
|
88
|
+
},
|
89
|
+
},
|
90
|
+
});
|
91
|
+
const account = await wallet.connect({
|
92
|
+
client: TEST_CLIENT,
|
93
|
+
strategy: "guest",
|
94
|
+
chain,
|
95
|
+
});
|
96
|
+
expect(account.address).toBeDefined();
|
97
|
+
const tx = await sendAndConfirmTransaction({
|
98
|
+
transaction: prepareTransaction({
|
99
|
+
chain,
|
100
|
+
client: TEST_CLIENT,
|
101
|
+
to: account.address,
|
102
|
+
value: 0n,
|
103
|
+
}),
|
104
|
+
account,
|
105
|
+
});
|
106
|
+
expect(tx.transactionHash).toBeDefined();
|
107
|
+
const logs = parseEventLogs({
|
108
|
+
logs: tx.logs,
|
109
|
+
events: [userOperationEventEvent()],
|
110
|
+
});
|
111
|
+
const executedLog = logs[0];
|
112
|
+
if (!executedLog) {
|
113
|
+
throw new Error("No executed log found");
|
114
|
+
}
|
115
|
+
expect(executedLog.args.sender).toBe(account.address);
|
116
|
+
expect(executedLog.args.success).toBe(true);
|
89
117
|
});
|
90
|
-
|
91
|
-
|
92
|
-
|
118
|
+
|
119
|
+
it("should batch transaction for a 7702 account", async () => {
|
120
|
+
const chain = baseSepolia;
|
121
|
+
const iaw = inAppWallet({
|
122
|
+
executionMode: {
|
123
|
+
mode: "EIP7702",
|
124
|
+
sponsorGas: true,
|
125
|
+
},
|
126
|
+
});
|
127
|
+
const account = await iaw.connect({
|
128
|
+
client: TEST_CLIENT,
|
129
|
+
strategy: "guest",
|
93
130
|
chain,
|
131
|
+
});
|
132
|
+
const tx1 = prepareTransaction({
|
94
133
|
client: TEST_CLIENT,
|
95
|
-
|
134
|
+
chain,
|
135
|
+
to: (await generateAccount({ client: TEST_CLIENT })).address,
|
96
136
|
value: 0n,
|
97
|
-
})
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
137
|
+
});
|
138
|
+
const tx2 = prepareTransaction({
|
139
|
+
client: TEST_CLIENT,
|
140
|
+
chain,
|
141
|
+
to: (await generateAccount({ client: TEST_CLIENT })).address,
|
142
|
+
value: 0n,
|
143
|
+
});
|
144
|
+
const result = await sendBatchTransaction({
|
145
|
+
account,
|
146
|
+
transactions: [tx1, tx2],
|
147
|
+
});
|
148
|
+
expect(result.transactionHash).toBeDefined();
|
104
149
|
});
|
105
|
-
|
106
|
-
|
107
|
-
throw new Error("No executed log found");
|
108
|
-
}
|
109
|
-
expect(executedLog.args.sender).toBe(account.address);
|
110
|
-
expect(executedLog.args.success).toBe(true);
|
111
|
-
});
|
112
|
-
});
|
150
|
+
},
|
151
|
+
);
|
@@ -1,43 +0,0 @@
|
|
1
|
-
import { describe, expect, it } from "vitest";
|
2
|
-
import { TEST_CLIENT } from "../../../../../test/src/test-clients.js";
|
3
|
-
import { baseSepolia } from "../../../../chains/chain-definitions/base-sepolia.js";
|
4
|
-
import { sendBatchTransaction } from "../../../../transaction/actions/send-batch-transaction.js";
|
5
|
-
import { prepareTransaction } from "../../../../transaction/prepare-transaction.js";
|
6
|
-
import { generateAccount } from "../../../utils/generateAccount.js";
|
7
|
-
import { inAppWallet } from "../../web/in-app.js";
|
8
|
-
|
9
|
-
const client = TEST_CLIENT;
|
10
|
-
const chain = baseSepolia;
|
11
|
-
|
12
|
-
describe.runIf(process.env.TW_SECRET_KEY)("7702 Minimal Account", () => {
|
13
|
-
it("should batch transactions", async () => {
|
14
|
-
const iaw = inAppWallet({
|
15
|
-
executionMode: {
|
16
|
-
mode: "EIP7702",
|
17
|
-
sponsorGas: true,
|
18
|
-
},
|
19
|
-
});
|
20
|
-
const account = await iaw.connect({
|
21
|
-
client,
|
22
|
-
strategy: "guest",
|
23
|
-
chain,
|
24
|
-
});
|
25
|
-
const tx1 = prepareTransaction({
|
26
|
-
client,
|
27
|
-
chain,
|
28
|
-
to: (await generateAccount({ client })).address,
|
29
|
-
value: 0n,
|
30
|
-
});
|
31
|
-
const tx2 = prepareTransaction({
|
32
|
-
client,
|
33
|
-
chain,
|
34
|
-
to: (await generateAccount({ client })).address,
|
35
|
-
value: 0n,
|
36
|
-
});
|
37
|
-
const result = await sendBatchTransaction({
|
38
|
-
account,
|
39
|
-
transactions: [tx1, tx2],
|
40
|
-
});
|
41
|
-
expect(result.transactionHash).toBeDefined();
|
42
|
-
});
|
43
|
-
});
|