thirdweb 5.121.2 → 5.121.4

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 (139) hide show
  1. package/dist/cjs/insight/get-nfts.js +2 -2
  2. package/dist/cjs/insight/get-nfts.js.map +1 -1
  3. package/dist/cjs/react/core/hooks/x402/useFetchWithPaymentCore.js +1 -0
  4. package/dist/cjs/react/core/hooks/x402/useFetchWithPaymentCore.js.map +1 -1
  5. package/dist/cjs/react/native/hooks/x402/useFetchWithPayment.js +1 -1
  6. package/dist/cjs/react/web/hooks/x402/useFetchWithPayment.js +2 -2
  7. package/dist/cjs/react/web/hooks/x402/useFetchWithPayment.js.map +1 -1
  8. package/dist/cjs/react/web/ui/x402/PaymentErrorModal.js +4 -4
  9. package/dist/cjs/react/web/ui/x402/PaymentErrorModal.js.map +1 -1
  10. package/dist/cjs/version.js +1 -1
  11. package/dist/cjs/x402/encode.js +41 -2
  12. package/dist/cjs/x402/encode.js.map +1 -1
  13. package/dist/cjs/x402/fetchWithPayment.js +56 -33
  14. package/dist/cjs/x402/fetchWithPayment.js.map +1 -1
  15. package/dist/cjs/x402/schemas.js +134 -2
  16. package/dist/cjs/x402/schemas.js.map +1 -1
  17. package/dist/cjs/x402/sign.js +56 -15
  18. package/dist/cjs/x402/sign.js.map +1 -1
  19. package/dist/esm/insight/get-nfts.js +2 -2
  20. package/dist/esm/insight/get-nfts.js.map +1 -1
  21. package/dist/esm/react/core/hooks/x402/useFetchWithPaymentCore.js +2 -1
  22. package/dist/esm/react/core/hooks/x402/useFetchWithPaymentCore.js.map +1 -1
  23. package/dist/esm/react/native/hooks/x402/useFetchWithPayment.js +1 -1
  24. package/dist/esm/react/web/hooks/x402/useFetchWithPayment.js +2 -2
  25. package/dist/esm/react/web/hooks/x402/useFetchWithPayment.js.map +1 -1
  26. package/dist/esm/react/web/ui/x402/PaymentErrorModal.js +5 -5
  27. package/dist/esm/react/web/ui/x402/PaymentErrorModal.js.map +1 -1
  28. package/dist/esm/version.js +1 -1
  29. package/dist/esm/x402/encode.js +40 -2
  30. package/dist/esm/x402/encode.js.map +1 -1
  31. package/dist/esm/x402/fetchWithPayment.js +57 -35
  32. package/dist/esm/x402/fetchWithPayment.js.map +1 -1
  33. package/dist/esm/x402/schemas.js +129 -1
  34. package/dist/esm/x402/schemas.js.map +1 -1
  35. package/dist/esm/x402/sign.js +57 -16
  36. package/dist/esm/x402/sign.js.map +1 -1
  37. package/dist/scripts/bridge-widget.js +64 -64
  38. package/dist/types/react/core/hooks/x402/useFetchWithPaymentCore.d.ts +1 -0
  39. package/dist/types/react/core/hooks/x402/useFetchWithPaymentCore.d.ts.map +1 -1
  40. package/dist/types/react/native/hooks/x402/useFetchWithPayment.d.ts +1 -1
  41. package/dist/types/react/web/hooks/x402/useFetchWithPayment.d.ts +1 -1
  42. package/dist/types/react/web/hooks/x402/useFetchWithPayment.d.ts.map +1 -1
  43. package/dist/types/react/web/ui/x402/PaymentErrorModal.d.ts +1 -0
  44. package/dist/types/react/web/ui/x402/PaymentErrorModal.d.ts.map +1 -1
  45. package/dist/types/version.d.ts +1 -1
  46. package/dist/types/x402/encode.d.ts +7 -0
  47. package/dist/types/x402/encode.d.ts.map +1 -1
  48. package/dist/types/x402/fetchWithPayment.d.ts +10 -1
  49. package/dist/types/x402/fetchWithPayment.d.ts.map +1 -1
  50. package/dist/types/x402/schemas.d.ts +60 -2
  51. package/dist/types/x402/schemas.d.ts.map +1 -1
  52. package/dist/types/x402/sign.d.ts +13 -1
  53. package/dist/types/x402/sign.d.ts.map +1 -1
  54. package/package.json +17 -16
  55. package/src/contract/actions/resolve-abi.test.ts +3 -5
  56. package/src/extensions/airdrop/write/airdropERC721WithSignature.test.ts +4 -5
  57. package/src/extensions/erc1155/drop1155.test.ts +1 -1
  58. package/src/extensions/erc1155/write/sigMint1155.test.ts +189 -187
  59. package/src/extensions/erc20/drop20.test.ts +1 -1
  60. package/src/extensions/erc721/write/sigMint721.test.ts +4 -6
  61. package/src/extensions/modules/ClaimableERC1155/claimableERC1155.test.ts +180 -178
  62. package/src/extensions/modules/ClaimableERC20/claimableERC20.test.ts +1 -1
  63. package/src/extensions/modules/ClaimableERC721/claimableERC721.test.ts +1 -1
  64. package/src/extensions/prebuilts/process-ref-deployments.test.ts +1 -1
  65. package/src/insight/get-nfts.ts +2 -2
  66. package/src/react/core/account/provider.test.tsx +1 -0
  67. package/src/react/core/hooks/others/useWalletBalance.test.tsx +1 -0
  68. package/src/react/core/hooks/pay/useBuyWithFiatQuotesForProviders.test.tsx +1 -0
  69. package/src/react/core/hooks/useStepExecutor.test.tsx +1 -0
  70. package/src/react/core/hooks/wallets/useAddConnectedWallet.test.tsx +1 -0
  71. package/src/react/core/hooks/wallets/useAutoConnectCore.test.tsx +1 -0
  72. package/src/react/core/hooks/wallets/useConnect.test.tsx +1 -0
  73. package/src/react/core/hooks/wallets/useSetActiveWallet.test.tsx +1 -0
  74. package/src/react/core/hooks/wallets/useSwitchActiveWalletChain.test.tsx +1 -0
  75. package/src/react/core/hooks/x402/useFetchWithPaymentCore.ts +6 -1
  76. package/src/react/core/providers/connection-manager.test.tsx +1 -0
  77. package/src/react/core/wallet/provider.test.tsx +1 -0
  78. package/src/react/native/hooks/wallets/useUnlinkProfile.test.tsx +1 -0
  79. package/src/react/native/hooks/x402/useFetchWithPayment.ts +1 -1
  80. package/src/react/web/hooks/wallets/useUnlinkProfile.test.tsx +1 -0
  81. package/src/react/web/hooks/x402/useFetchWithPayment.tsx +3 -1
  82. package/src/react/web/ui/AutoConnect/AutoConnect.test.tsx +1 -0
  83. package/src/react/web/ui/Bridge/StepRunner.test.tsx +1 -0
  84. package/src/react/web/ui/Bridge/common/token-query.test.tsx +1 -0
  85. package/src/react/web/ui/ConnectWallet/ConnectButton.test.tsx +1 -0
  86. package/src/react/web/ui/ConnectWallet/Details.test.tsx +1 -0
  87. package/src/react/web/ui/ConnectWallet/NetworkSelector.test.tsx +1 -0
  88. package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/currencies.test.tsx +1 -0
  89. package/src/react/web/ui/ConnectWallet/screens/LinkedProfilesScreen.test.tsx +1 -0
  90. package/src/react/web/ui/ConnectWallet/screens/ManageWalletScreen.test.tsx +1 -0
  91. package/src/react/web/ui/ConnectWallet/screens/PrivateKey.test.tsx +1 -0
  92. package/src/react/web/ui/ConnectWallet/screens/ReceiveFunds.test.tsx +1 -0
  93. package/src/react/web/ui/ConnectWallet/screens/SendFunds.test.tsx +1 -0
  94. package/src/react/web/ui/ConnectWallet/screens/SignatureScreen.test.tsx +1 -0
  95. package/src/react/web/ui/ConnectWallet/screens/StartScreen.test.tsx +1 -0
  96. package/src/react/web/ui/MediaRenderer/MediaRenderer.test.tsx +1 -0
  97. package/src/react/web/ui/MediaRenderer/icons.test.tsx +1 -0
  98. package/src/react/web/ui/MediaRenderer/useResolvedMediaType.test.tsx +1 -0
  99. package/src/react/web/ui/SiteEmbed.test.tsx +1 -0
  100. package/src/react/web/ui/SiteLink.test.tsx +1 -0
  101. package/src/react/web/ui/TransactionButton/TransactionButton.test.tsx +1 -0
  102. package/src/react/web/ui/components/ChainIcon.test.tsx +1 -0
  103. package/src/react/web/ui/hooks/useCopyClipboard.test.tsx +1 -0
  104. package/src/react/web/ui/hooks/useDebouncedValue.test.tsx +1 -0
  105. package/src/react/web/ui/hooks/useShowMore.test.tsx +28 -12
  106. package/src/react/web/ui/prebuilt/Account/address.test.tsx +1 -0
  107. package/src/react/web/ui/prebuilt/Account/avatar.test.tsx +1 -0
  108. package/src/react/web/ui/prebuilt/Account/balance.test.tsx +1 -0
  109. package/src/react/web/ui/prebuilt/Account/name.test.tsx +1 -0
  110. package/src/react/web/ui/prebuilt/Chain/icon.test.tsx +1 -0
  111. package/src/react/web/ui/prebuilt/Chain/name.test.tsx +1 -0
  112. package/src/react/web/ui/prebuilt/Chain/provider.test.tsx +1 -0
  113. package/src/react/web/ui/prebuilt/NFT/description.test.tsx +1 -0
  114. package/src/react/web/ui/prebuilt/NFT/media.test.tsx +1 -0
  115. package/src/react/web/ui/prebuilt/NFT/name.test.tsx +1 -0
  116. package/src/react/web/ui/prebuilt/NFT/provider.test.tsx +1 -0
  117. package/src/react/web/ui/prebuilt/Token/name.test.tsx +1 -0
  118. package/src/react/web/ui/prebuilt/Token/provider.test.tsx +1 -0
  119. package/src/react/web/ui/prebuilt/Token/symbol.test.tsx +1 -0
  120. package/src/react/web/ui/prebuilt/Wallet/icon.test.tsx +1 -0
  121. package/src/react/web/ui/prebuilt/Wallet/name.test.tsx +1 -0
  122. package/src/react/web/ui/prebuilt/thirdweb/BuyDirectListingButton/BuyDirectListingButton.test.tsx +1 -0
  123. package/src/react/web/ui/prebuilt/thirdweb/ClaimButton/ClaimButton.test.tsx +1 -0
  124. package/src/react/web/ui/prebuilt/thirdweb/CreateDirectListingButton/CreateDirectListingButton.test.tsx +1 -0
  125. package/src/react/web/ui/x402/PaymentErrorModal.tsx +9 -4
  126. package/src/react/web/utils/canFitWideModal.test.tsx +1 -0
  127. package/src/react/web/wallets/in-app/CountrySelector.test.tsx +1 -0
  128. package/src/react/web/wallets/in-app/InputSelectionUI.test.tsx +1 -0
  129. package/src/react/web/wallets/shared/ConnectWalletSocialOptions.test.tsx +1 -0
  130. package/src/version.ts +1 -1
  131. package/src/wallets/in-app/web/lib/auth/redirect-state.test.tsx +1 -0
  132. package/src/wallets/in-app/web/lib/get-url-token.test.tsx +1 -0
  133. package/src/wallets/in-app/web/utils/iFrameCommunication/IframeCommunicator.test.tsx +1 -0
  134. package/src/x402/encode.ts +46 -2
  135. package/src/x402/fetchWithPayment.test.ts +1173 -104
  136. package/src/x402/fetchWithPayment.ts +72 -54
  137. package/src/x402/schemas.test.ts +123 -0
  138. package/src/x402/schemas.ts +199 -6
  139. package/src/x402/sign.ts +86 -10
@@ -20,234 +20,236 @@ import { getInstalledModules } from "../__generated__/IModularCore/read/getInsta
20
20
  import * as BatchMetadataERC1155 from "../BatchMetadataERC1155/index.js";
21
21
  import * as ClaimableERC1155 from "./index.js";
22
22
 
23
- describe.runIf(process.env.TW_SECRET_KEY)("ModularClaimableERC1155", () => {
24
- let contract: ThirdwebContract;
25
- beforeAll(async () => {
26
- const address = await deployModularContract({
27
- account: TEST_ACCOUNT_A,
28
- chain: ANVIL_CHAIN,
29
- client: TEST_CLIENT,
30
- core: "ERC1155",
31
- modules: [
32
- ClaimableERC1155.module({
33
- primarySaleRecipient: TEST_ACCOUNT_A.address,
23
+ describe
24
+ .runIf(process.env.TW_SECRET_KEY)
25
+ .skip("ModularClaimableERC1155", () => {
26
+ let contract: ThirdwebContract;
27
+ beforeAll(async () => {
28
+ const address = await deployModularContract({
29
+ account: TEST_ACCOUNT_A,
30
+ chain: ANVIL_CHAIN,
31
+ client: TEST_CLIENT,
32
+ core: "ERC1155",
33
+ modules: [
34
+ ClaimableERC1155.module({
35
+ primarySaleRecipient: TEST_ACCOUNT_A.address,
36
+ }),
37
+ BatchMetadataERC1155.module(),
38
+ ],
39
+ params: {
40
+ contractURI: TEST_CONTRACT_URI,
41
+ name: "TestDropERC1155",
42
+ },
43
+ });
44
+ contract = getContract({
45
+ address,
46
+ chain: ANVIL_CHAIN,
47
+ client: TEST_CLIENT,
48
+ });
49
+ }, 120000);
50
+
51
+ it("should have erc1155 module", async () => {
52
+ const modules = await getInstalledModules({ contract });
53
+ expect(modules.length).toBe(2);
54
+ });
55
+
56
+ it("should upload metadata", async () => {
57
+ const transaction = BatchMetadataERC1155.uploadMetadata({
58
+ contract,
59
+ metadatas: Array.from(
60
+ { length: 10 },
61
+ (_, index) =>
62
+ `ipfs://QmP4JFzBhTGvb27GnJ9eL9vZGYpNBGjHnPudWndruiNERm/${index}`,
63
+ ),
64
+ });
65
+
66
+ await sendAndConfirmTransaction({
67
+ account: TEST_ACCOUNT_A,
68
+ transaction,
69
+ });
70
+ });
71
+
72
+ it("should not claim without claim conditions", async () => {
73
+ // should throw
74
+ await expect(
75
+ sendAndConfirmTransaction({
76
+ account: TEST_ACCOUNT_A,
77
+ transaction: ClaimableERC1155.mint({
78
+ contract,
79
+ quantity: 1,
80
+ to: TEST_ACCOUNT_A.address,
81
+ tokenId: 123123123213n,
82
+ }),
34
83
  }),
35
- BatchMetadataERC1155.module(),
36
- ],
37
- params: {
38
- contractURI: TEST_CONTRACT_URI,
39
- name: "TestDropERC1155",
40
- },
41
- });
42
- contract = getContract({
43
- address,
44
- chain: ANVIL_CHAIN,
45
- client: TEST_CLIENT,
46
- });
47
- }, 120000);
48
-
49
- it("should have erc1155 module", async () => {
50
- const modules = await getInstalledModules({ contract });
51
- expect(modules.length).toBe(2);
52
- });
53
-
54
- it("should upload metadata", async () => {
55
- const transaction = BatchMetadataERC1155.uploadMetadata({
56
- contract,
57
- metadatas: Array.from(
58
- { length: 10 },
59
- (_, index) =>
60
- `ipfs://QmP4JFzBhTGvb27GnJ9eL9vZGYpNBGjHnPudWndruiNERm/${index}`,
61
- ),
62
- });
63
-
64
- await sendAndConfirmTransaction({
65
- account: TEST_ACCOUNT_A,
66
- transaction,
84
+ ).rejects.toThrowError(/ClaimableOutOfTimeWindow/);
67
85
  });
68
- });
69
86
 
70
- it("should not claim without claim conditions", async () => {
71
- // should throw
72
- await expect(
73
- sendAndConfirmTransaction({
87
+ it("should claim tokens with claim conditions", async () => {
88
+ await sendAndConfirmTransaction({
74
89
  account: TEST_ACCOUNT_A,
75
- transaction: ClaimableERC1155.mint({
90
+ transaction: ClaimableERC1155.setClaimCondition({
76
91
  contract,
77
- quantity: 1,
78
- to: TEST_ACCOUNT_A.address,
79
- tokenId: 123123123213n,
92
+ maxClaimableSupply: "1",
93
+ pricePerToken: "0.1",
94
+ tokenId: 0n,
80
95
  }),
81
- }),
82
- ).rejects.toThrowError(/ClaimableOutOfTimeWindow/);
83
- });
96
+ });
97
+
98
+ // should throw if claiming more than supply
99
+ await expect(
100
+ sendAndConfirmTransaction({
101
+ account: TEST_ACCOUNT_A,
102
+ transaction: ClaimableERC1155.mint({
103
+ contract,
104
+ quantity: 1000,
105
+ to: TEST_ACCOUNT_A.address,
106
+ tokenId: 0n,
107
+ }),
108
+ }),
109
+ ).rejects.toThrowError(/ClaimableOutOfSupply/);
84
110
 
85
- it("should claim tokens with claim conditions", async () => {
86
- await sendAndConfirmTransaction({
87
- account: TEST_ACCOUNT_A,
88
- transaction: ClaimableERC1155.setClaimCondition({
111
+ let balance = await balanceOf({
89
112
  contract,
90
- maxClaimableSupply: "1",
91
- pricePerToken: "0.1",
113
+ owner: TEST_ACCOUNT_A.address,
92
114
  tokenId: 0n,
93
- }),
94
- });
115
+ });
95
116
 
96
- // should throw if claiming more than supply
97
- await expect(
98
- sendAndConfirmTransaction({
117
+ expect(balance).toBe(0n);
118
+
119
+ await sendAndConfirmTransaction({
99
120
  account: TEST_ACCOUNT_A,
100
121
  transaction: ClaimableERC1155.mint({
101
122
  contract,
102
- quantity: 1000,
123
+ quantity: 1,
103
124
  to: TEST_ACCOUNT_A.address,
104
125
  tokenId: 0n,
105
126
  }),
106
- }),
107
- ).rejects.toThrowError(/ClaimableOutOfSupply/);
127
+ });
108
128
 
109
- let balance = await balanceOf({
110
- contract,
111
- owner: TEST_ACCOUNT_A.address,
112
- tokenId: 0n,
113
- });
114
-
115
- expect(balance).toBe(0n);
116
-
117
- await sendAndConfirmTransaction({
118
- account: TEST_ACCOUNT_A,
119
- transaction: ClaimableERC1155.mint({
129
+ balance = await balanceOf({
120
130
  contract,
121
- quantity: 1,
122
- to: TEST_ACCOUNT_A.address,
131
+ owner: TEST_ACCOUNT_A.address,
123
132
  tokenId: 0n,
124
- }),
125
- });
133
+ });
134
+ expect(balance).toBe(1n);
126
135
 
127
- balance = await balanceOf({
128
- contract,
129
- owner: TEST_ACCOUNT_A.address,
130
- tokenId: 0n,
131
- });
132
- expect(balance).toBe(1n);
133
-
134
- const all = await getNFTs({
135
- contract,
136
- });
137
- expect(all.length).toBe(10);
138
-
139
- const owned = await getOwnedNFTs({
140
- address: TEST_ACCOUNT_A.address,
141
- contract,
142
- });
143
- expect(owned.length).toBe(1);
144
- expect(owned?.[0]?.metadata.name).toBe("Test 0");
145
- expect(owned?.[0]?.quantityOwned).toBe(1n);
146
- });
136
+ const all = await getNFTs({
137
+ contract,
138
+ });
139
+ expect(all.length).toBe(10);
147
140
 
148
- it("should claim tokens with allowlist", async () => {
149
- await sendAndConfirmTransaction({
150
- account: TEST_ACCOUNT_A,
151
- transaction: ClaimableERC1155.setClaimCondition({
152
- allowList: [TEST_ACCOUNT_A.address, TEST_ACCOUNT_B.address],
141
+ const owned = await getOwnedNFTs({
142
+ address: TEST_ACCOUNT_A.address,
153
143
  contract,
154
- maxClaimableSupply: "2",
155
- pricePerToken: "0.1",
156
- tokenId: 0n,
157
- }),
144
+ });
145
+ expect(owned.length).toBe(1);
146
+ expect(owned?.[0]?.metadata.name).toBe("Test 0");
147
+ expect(owned?.[0]?.quantityOwned).toBe(1n);
158
148
  });
159
149
 
160
- // should throw if not in allowlist
161
- await expect(
162
- sendAndConfirmTransaction({
163
- account: TEST_ACCOUNT_C,
164
- transaction: ClaimableERC1155.mint({
150
+ it("should claim tokens with allowlist", async () => {
151
+ await sendAndConfirmTransaction({
152
+ account: TEST_ACCOUNT_A,
153
+ transaction: ClaimableERC1155.setClaimCondition({
154
+ allowList: [TEST_ACCOUNT_A.address, TEST_ACCOUNT_B.address],
165
155
  contract,
166
- quantity: 1,
167
- to: TEST_ACCOUNT_C.address,
156
+ maxClaimableSupply: "2",
157
+ pricePerToken: "0.1",
168
158
  tokenId: 0n,
169
159
  }),
170
- }),
171
- ).rejects.toThrowError(/ClaimableNotInAllowlist/);
160
+ });
161
+
162
+ // should throw if not in allowlist
163
+ await expect(
164
+ sendAndConfirmTransaction({
165
+ account: TEST_ACCOUNT_C,
166
+ transaction: ClaimableERC1155.mint({
167
+ contract,
168
+ quantity: 1,
169
+ to: TEST_ACCOUNT_C.address,
170
+ tokenId: 0n,
171
+ }),
172
+ }),
173
+ ).rejects.toThrowError(/ClaimableNotInAllowlist/);
174
+
175
+ // should throw if in allowlist but over supply
176
+ await expect(
177
+ sendAndConfirmTransaction({
178
+ account: TEST_ACCOUNT_C,
179
+ transaction: ClaimableERC1155.mint({
180
+ contract,
181
+ quantity: 3,
182
+ to: TEST_ACCOUNT_C.address,
183
+ tokenId: 0n,
184
+ }),
185
+ }),
186
+ ).rejects.toThrowError(/ClaimableOutOfSupply/);
172
187
 
173
- // should throw if in allowlist but over supply
174
- await expect(
175
- sendAndConfirmTransaction({
188
+ // can claim to address in allowlist (regardless of sender)
189
+ await sendAndConfirmTransaction({
176
190
  account: TEST_ACCOUNT_C,
177
191
  transaction: ClaimableERC1155.mint({
178
192
  contract,
179
- quantity: 3,
180
- to: TEST_ACCOUNT_C.address,
193
+ quantity: 2,
194
+ to: TEST_ACCOUNT_B.address,
181
195
  tokenId: 0n,
182
196
  }),
183
- }),
184
- ).rejects.toThrowError(/ClaimableOutOfSupply/);
197
+ });
185
198
 
186
- // can claim to address in allowlist (regardless of sender)
187
- await sendAndConfirmTransaction({
188
- account: TEST_ACCOUNT_C,
189
- transaction: ClaimableERC1155.mint({
199
+ const balance = await balanceOf({
190
200
  contract,
191
- quantity: 2,
192
- to: TEST_ACCOUNT_B.address,
201
+ owner: TEST_ACCOUNT_B.address,
193
202
  tokenId: 0n,
194
- }),
203
+ });
204
+ expect(balance).toBe(2n);
195
205
  });
196
206
 
197
- const balance = await balanceOf({
198
- contract,
199
- owner: TEST_ACCOUNT_B.address,
200
- tokenId: 0n,
201
- });
202
- expect(balance).toBe(2n);
203
- });
207
+ it("should claim tokens with max per wallet", async () => {
208
+ await sendAndConfirmTransaction({
209
+ account: TEST_ACCOUNT_A,
210
+ transaction: ClaimableERC1155.setClaimCondition({
211
+ contract,
212
+ maxClaimablePerWallet: 1,
213
+ maxClaimableSupply: 10,
214
+ tokenId: 0n,
215
+ }),
216
+ });
204
217
 
205
- it("should claim tokens with max per wallet", async () => {
206
- await sendAndConfirmTransaction({
207
- account: TEST_ACCOUNT_A,
208
- transaction: ClaimableERC1155.setClaimCondition({
218
+ let balance = await balanceOf({
209
219
  contract,
210
- maxClaimablePerWallet: 1,
211
- maxClaimableSupply: 10,
220
+ owner: TEST_ACCOUNT_C.address,
212
221
  tokenId: 0n,
213
- }),
214
- });
215
-
216
- let balance = await balanceOf({
217
- contract,
218
- owner: TEST_ACCOUNT_C.address,
219
- tokenId: 0n,
220
- });
221
- expect(balance).toBe(0n);
222
+ });
223
+ expect(balance).toBe(0n);
224
+
225
+ // should throw if max per wallet is reached
226
+ await expect(
227
+ sendAndConfirmTransaction({
228
+ account: TEST_ACCOUNT_C,
229
+ transaction: ClaimableERC1155.mint({
230
+ contract,
231
+ quantity: 4,
232
+ to: TEST_ACCOUNT_C.address,
233
+ tokenId: 0n,
234
+ }),
235
+ }),
236
+ ).rejects.toThrowError(/ClaimableMaxMintPerWalletExceeded/);
222
237
 
223
- // should throw if max per wallet is reached
224
- await expect(
225
- sendAndConfirmTransaction({
238
+ await sendAndConfirmTransaction({
226
239
  account: TEST_ACCOUNT_C,
227
240
  transaction: ClaimableERC1155.mint({
228
241
  contract,
229
- quantity: 4,
242
+ quantity: 1,
230
243
  to: TEST_ACCOUNT_C.address,
231
244
  tokenId: 0n,
232
245
  }),
233
- }),
234
- ).rejects.toThrowError(/ClaimableMaxMintPerWalletExceeded/);
246
+ });
235
247
 
236
- await sendAndConfirmTransaction({
237
- account: TEST_ACCOUNT_C,
238
- transaction: ClaimableERC1155.mint({
248
+ balance = await balanceOf({
239
249
  contract,
240
- quantity: 1,
241
- to: TEST_ACCOUNT_C.address,
250
+ owner: TEST_ACCOUNT_C.address,
242
251
  tokenId: 0n,
243
- }),
244
- });
245
-
246
- balance = await balanceOf({
247
- contract,
248
- owner: TEST_ACCOUNT_C.address,
249
- tokenId: 0n,
252
+ });
253
+ expect(balance).toBe(1n);
250
254
  });
251
- expect(balance).toBe(1n);
252
255
  });
253
- });
@@ -17,7 +17,7 @@ import { deployModularContract } from "../../prebuilts/deploy-modular.js";
17
17
  import { getInstalledModules } from "../__generated__/IModularCore/read/getInstalledModules.js";
18
18
  import * as ClaimableERC20 from "./index.js";
19
19
 
20
- describe.runIf(process.env.TW_SECRET_KEY)("ModularDropERC20", () => {
20
+ describe.runIf(process.env.TW_SECRET_KEY).skip("ModularDropERC20", () => {
21
21
  let contract: ThirdwebContract;
22
22
  beforeAll(async () => {
23
23
  const address = await deployModularContract({
@@ -18,7 +18,7 @@ import { getInstalledModules } from "../__generated__/IModularCore/read/getInsta
18
18
  import * as BatchMetadataERC721 from "../BatchMetadataERC721/index.js";
19
19
  import * as ClaimableERC721 from "./index.js";
20
20
 
21
- describe.runIf(process.env.TW_SECRET_KEY)("ModularClaimableERC721", () => {
21
+ describe.runIf(process.env.TW_SECRET_KEY).skip("ModularClaimableERC721", () => {
22
22
  let contract: ThirdwebContract;
23
23
  beforeAll(async () => {
24
24
  const address = await deployModularContract({
@@ -8,7 +8,7 @@ import { readContract } from "../../transaction/read-contract.js";
8
8
  import { getInstalledModules } from "../modules/__generated__/IModularCore/read/getInstalledModules.js";
9
9
  import { deployPublishedContract } from "./deploy-published.js";
10
10
 
11
- describe.runIf(process.env.TW_SECRET_KEY)(
11
+ describe.runIf(process.env.TW_SECRET_KEY).skip(
12
12
  "deployref",
13
13
  {
14
14
  timeout: 120000,
@@ -313,7 +313,7 @@ async function transformNFTModel(
313
313
  supply: supply,
314
314
  tokenAddress: contract?.address ?? "",
315
315
  tokenId: BigInt(token_id),
316
- tokenUri: replaceIPFSGateway(metadata_url) ?? "",
316
+ tokenUri: replaceIPFSGateway(metadata_url ?? undefined) ?? "",
317
317
  type: "ERC1155",
318
318
  });
319
319
  } else {
@@ -322,7 +322,7 @@ async function transformNFTModel(
322
322
  owner: owners?.[0],
323
323
  tokenAddress: contract?.address ?? "",
324
324
  tokenId: BigInt(token_id),
325
- tokenUri: replaceIPFSGateway(metadata_url) ?? "",
325
+ tokenUri: replaceIPFSGateway(metadata_url ?? undefined) ?? "",
326
326
  type: "ERC721",
327
327
  });
328
328
  }
@@ -1,3 +1,4 @@
1
+ // @vitest-environment happy-dom
1
2
  import { describe, expect, it } from "vitest";
2
3
  import { render, screen } from "~test/react-render.js";
3
4
  import { TEST_CLIENT } from "~test/test-clients.js";
@@ -1,3 +1,4 @@
1
+ // @vitest-environment happy-dom
1
2
  import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
2
3
  import { renderHook, waitFor } from "@testing-library/react";
3
4
  import type { ReactNode } from "react";
@@ -1,3 +1,4 @@
1
+ // @vitest-environment happy-dom
1
2
  import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
2
3
  import { renderHook, waitFor } from "@testing-library/react";
3
4
  import type React from "react";
@@ -1,3 +1,4 @@
1
+ // @vitest-environment happy-dom
1
2
  import { act, renderHook, waitFor } from "@testing-library/react";
2
3
  import { describe, expect, it, vi } from "vitest";
3
4
  import { TEST_CLIENT } from "~test/test-clients.js";
@@ -1,3 +1,4 @@
1
+ // @vitest-environment happy-dom
1
2
  import { renderHook } from "@testing-library/react";
2
3
  import type { ReactNode } from "react";
3
4
  import { describe, expect, it } from "vitest";
@@ -1,3 +1,4 @@
1
+ // @vitest-environment happy-dom
1
2
  import { renderHook, waitFor } from "@testing-library/react";
2
3
  import type { ReactNode } from "react";
3
4
  import { describe, expect, it } from "vitest";
@@ -1,3 +1,4 @@
1
+ // @vitest-environment happy-dom
1
2
  import { renderHook } from "@testing-library/react";
2
3
  import type { ReactNode } from "react";
3
4
  import { beforeEach, describe, expect, it } from "vitest";
@@ -1,3 +1,4 @@
1
+ // @vitest-environment happy-dom
1
2
  import { renderHook } from "@testing-library/react";
2
3
  import type { ReactNode } from "react";
3
4
  import { describe, expect, it } from "vitest";
@@ -1,3 +1,4 @@
1
+ // @vitest-environment happy-dom
1
2
  import { renderHook } from "@testing-library/react";
2
3
  import type { ReactNode } from "react";
3
4
  import { optimism } from "thirdweb/chains";
@@ -4,7 +4,10 @@ import { useMutation } from "@tanstack/react-query";
4
4
  import type { ThirdwebClient } from "../../../../client/client.js";
5
5
  import type { AsyncStorage } from "../../../../utils/storage/AsyncStorage.js";
6
6
  import type { Wallet } from "../../../../wallets/interfaces/wallet.js";
7
- import { wrapFetchWithPayment } from "../../../../x402/fetchWithPayment.js";
7
+ import {
8
+ getRequestUrl,
9
+ wrapFetchWithPayment,
10
+ } from "../../../../x402/fetchWithPayment.js";
8
11
  import type { RequestedPaymentRequirements } from "../../../../x402/schemas.js";
9
12
  import type { PaymentRequiredResult } from "../../../../x402/types.js";
10
13
  import { useActiveWallet } from "../wallets/useActiveWallet.js";
@@ -24,6 +27,7 @@ export type UseFetchWithPaymentOptions = {
24
27
 
25
28
  type ShowErrorModalCallback = (data: {
26
29
  errorData: PaymentRequiredResult["responseBody"];
30
+ requestUrl?: string;
27
31
  onRetry: () => void;
28
32
  onCancel: () => void;
29
33
  }) => void;
@@ -107,6 +111,7 @@ export function useFetchWithPaymentCore(
107
111
  return new Promise<unknown>((resolve, reject) => {
108
112
  showErrorModal({
109
113
  errorData: errorBody,
114
+ requestUrl: getRequestUrl(input),
110
115
  onRetry: async () => {
111
116
  // Retry the entire fetch+error handling logic recursively
112
117
  // Pass currentWallet to avoid re-showing connect modal with stale wallet state
@@ -1,3 +1,4 @@
1
+ // @vitest-environment happy-dom
1
2
  import { describe, expect, it } from "vitest";
2
3
  import { renderHook } from "~test/react-render.js";
3
4
  import { useConnectionManager } from "./connection-manager.js";
@@ -1,3 +1,4 @@
1
+ // @vitest-environment happy-dom
1
2
  /** biome-ignore-all lint/nursery/useUniqueElementIds: "id" is not the html attribute here (TODO: we should not use "id" as a key in the first place) */
2
3
  import { type FC, useContext } from "react";
3
4
  import { describe, expect, it, vi } from "vitest";
@@ -1,3 +1,4 @@
1
+ // @vitest-environment happy-dom
1
2
  import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
2
3
  import { act, renderHook } from "@testing-library/react";
3
4
  import type React from "react";
@@ -27,7 +27,7 @@ export type { UseFetchWithPaymentOptions };
27
27
  *
28
28
  * @param client - The thirdweb client used to access RPC infrastructure
29
29
  * @param options - Optional configuration for payment handling
30
- * @param options.maxValue - The maximum allowed payment amount in base units
30
+ * @param options.maxValue - The maximum allowed payment amount in base units. `0n` only allows zero-amount payments
31
31
  * @param options.paymentRequirementsSelector - Custom function to select payment requirements from available options
32
32
  * @param options.parseAs - How to parse the response: "json" (default), "text", or "raw"
33
33
  * @param options.storage - Storage for caching permit signatures (for "upto" scheme). Provide your own AsyncStorage implementation for React Native.
@@ -1,3 +1,4 @@
1
+ // @vitest-environment happy-dom
1
2
  import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
2
3
  import { act, renderHook } from "@testing-library/react";
3
4
  import type React from "react";
@@ -78,7 +78,7 @@ type UseFetchWithPaymentConfig = UseFetchWithPaymentOptions & {
78
78
  *
79
79
  * @param client - The thirdweb client used to access RPC infrastructure
80
80
  * @param options - Optional configuration for payment handling
81
- * @param options.maxValue - The maximum allowed payment amount in base units
81
+ * @param options.maxValue - The maximum allowed payment amount in base units. `0n` only allows zero-amount payments
82
82
  * @param options.paymentRequirementsSelector - Custom function to select payment requirements from available options
83
83
  * @param options.parseAs - How to parse the response: "json" (default), "text", or "raw"
84
84
  * @param options.uiEnabled - Whether to show the UI for connection, funding or payment retries (defaults to true). Set to false to handle errors yourself
@@ -196,6 +196,7 @@ export function useFetchWithPayment(
196
196
  const showErrorModal = showModal
197
197
  ? (data: {
198
198
  errorData: Parameters<typeof PaymentErrorModal>[0]["errorData"];
199
+ requestUrl?: string;
199
200
  onRetry: () => void;
200
201
  onCancel: () => void;
201
202
  }) => {
@@ -203,6 +204,7 @@ export function useFetchWithPayment(
203
204
  <PaymentErrorModal
204
205
  client={client}
205
206
  errorData={data.errorData}
207
+ requestUrl={data.requestUrl}
206
208
  onCancel={() => {
207
209
  setRootEl(null);
208
210
  data.onCancel();
@@ -1,3 +1,4 @@
1
+ // @vitest-environment happy-dom
1
2
  import { describe, it } from "vitest";
2
3
  import { render } from "../../../../../test/src/react-render.js";
3
4
  import { TEST_CLIENT } from "../../../../../test/src/test-clients.js";
@@ -1,3 +1,4 @@
1
+ // @vitest-environment happy-dom
1
2
  import { fireEvent, render, screen, waitFor } from "@testing-library/react";
2
3
  import { beforeEach, describe, expect, it, vi } from "vitest";
3
4
  import { TEST_CLIENT } from "~test/test-clients.js";
@@ -1,3 +1,4 @@
1
+ // @vitest-environment happy-dom
1
2
  import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
2
3
  import { renderHook, waitFor } from "@testing-library/react";
3
4
  import type { ReactNode } from "react";
@@ -1,3 +1,4 @@
1
+ // @vitest-environment happy-dom
1
2
  import {
2
3
  afterAll,
3
4
  beforeAll,
@@ -1,3 +1,4 @@
1
+ // @vitest-environment happy-dom
1
2
  import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
2
3
  import type { FC } from "react";
3
4
  import { beforeEach, describe, expect, it, vi } from "vitest";
@@ -1,3 +1,4 @@
1
+ // @vitest-environment happy-dom
1
2
  import { describe, expect, it, vi } from "vitest";
2
3
  import { render, screen, waitFor } from "~test/react-render.js";
3
4
  import { TEST_CLIENT } from "~test/test-clients.js";
@@ -1,3 +1,4 @@
1
+ // @vitest-environment happy-dom
1
2
  import { describe, expect, it } from "vitest";
2
3
  import { CADIcon } from "../../../icons/currencies/CADIcon.js";
3
4
  import { EURIcon } from "../../../icons/currencies/EURIcon.js";
@@ -1,3 +1,4 @@
1
+ // @vitest-environment happy-dom
1
2
  import { beforeEach, describe, expect, it, vi } from "vitest";
2
3
  import { render, screen } from "../../../../../../test/src/react-render.js";
3
4
  import { useSocialProfiles } from "../../../../core/social/useSocialProfiles.js";