thirdweb 5.101.1 → 5.101.2-nightly-e14a1349e120b684c5cbf05a80eca5f1a7a2ad5d-20250528000438
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/extensions/erc721/drops/write/updateMetadata.js +18 -4
- package/dist/cjs/extensions/erc721/drops/write/updateMetadata.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/components/Spinner.js +1 -1
- package/dist/cjs/react/web/ui/components/Spinner.js.map +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/version.js.map +1 -1
- package/dist/cjs/wallets/in-app/core/actions/get-enclave-user-status.js +0 -1
- package/dist/cjs/wallets/in-app/core/actions/get-enclave-user-status.js.map +1 -1
- package/dist/cjs/wallets/in-app/core/authentication/guest.js +4 -2
- package/dist/cjs/wallets/in-app/core/authentication/guest.js.map +1 -1
- package/dist/esm/extensions/erc721/drops/write/updateMetadata.js +18 -4
- package/dist/esm/extensions/erc721/drops/write/updateMetadata.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/components/Spinner.js +1 -1
- package/dist/esm/react/web/ui/components/Spinner.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/esm/wallets/in-app/core/actions/get-enclave-user-status.js +0 -1
- package/dist/esm/wallets/in-app/core/actions/get-enclave-user-status.js.map +1 -1
- package/dist/esm/wallets/in-app/core/authentication/guest.js +4 -2
- package/dist/esm/wallets/in-app/core/authentication/guest.js.map +1 -1
- package/dist/types/extensions/erc721/drops/write/updateMetadata.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/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/dist/types/version.d.ts.map +1 -1
- package/dist/types/wallets/in-app/core/actions/get-enclave-user-status.d.ts.map +1 -1
- package/dist/types/wallets/in-app/core/authentication/guest.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/extensions/erc721/drops/write/updateMetadata.test.ts +43 -0
- package/src/extensions/erc721/drops/write/updateMetadata.ts +23 -10
- 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/components/Spinner.tsx +2 -2
- package/src/version.ts +1 -1
- package/src/wallets/in-app/core/actions/get-enclave-user-status.ts +0 -1
- package/src/wallets/in-app/core/authentication/guest.ts +6 -1
- package/src/wallets/in-app/web/lib/in-app-integration.test.ts +128 -89
@@ -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
|
+
);
|