thirdweb 5.95.0-nightly-4c1f384a635054a8cfaaa487e3ba7ada63b221ec-20250415110008 → 5.95.0-nightly-64bd603301b3067b6a69a29f66a28dee7ffa38f5-20250416000349

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 (124) hide show
  1. package/dist/cjs/chains/utils.js +41 -0
  2. package/dist/cjs/chains/utils.js.map +1 -1
  3. package/dist/cjs/event/actions/get-events.js +65 -11
  4. package/dist/cjs/event/actions/get-events.js.map +1 -1
  5. package/dist/cjs/insight/get-events.js +54 -0
  6. package/dist/cjs/insight/get-events.js.map +1 -0
  7. package/dist/cjs/insight/get-nfts.js +4 -4
  8. package/dist/cjs/insight/get-nfts.js.map +1 -1
  9. package/dist/cjs/insight/get-tokens.js +4 -4
  10. package/dist/cjs/insight/get-tokens.js.map +1 -1
  11. package/dist/cjs/insight/get-transactions.js +3 -2
  12. package/dist/cjs/insight/get-transactions.js.map +1 -1
  13. package/dist/cjs/insight/index.js +3 -1
  14. package/dist/cjs/insight/index.js.map +1 -1
  15. package/dist/cjs/pay/buyWithCrypto/getHistory.js +2 -2
  16. package/dist/cjs/pay/buyWithCrypto/getHistory.js.map +1 -1
  17. package/dist/cjs/pay/buyWithCrypto/getStatus.js +2 -2
  18. package/dist/cjs/pay/buyWithCrypto/getStatus.js.map +1 -1
  19. package/dist/cjs/pay/buyWithFiat/getHistory.js +2 -2
  20. package/dist/cjs/pay/buyWithFiat/getHistory.js.map +1 -1
  21. package/dist/cjs/pay/buyWithFiat/getStatus.js +2 -2
  22. package/dist/cjs/pay/buyWithFiat/getStatus.js.map +1 -1
  23. package/dist/cjs/pay/getBuyHistory.js +2 -2
  24. package/dist/cjs/pay/getBuyHistory.js.map +1 -1
  25. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.js +6 -2
  26. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.js.map +1 -1
  27. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/TransferConfirmationScreen.js +3 -1
  28. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/TransferConfirmationScreen.js.map +1 -1
  29. package/dist/cjs/react/web/ui/ConnectWallet/screens/SendFunds.js +3 -1
  30. package/dist/cjs/react/web/ui/ConnectWallet/screens/SendFunds.js.map +1 -1
  31. package/dist/cjs/rpc/fetch-rpc.js +4 -4
  32. package/dist/cjs/rpc/fetch-rpc.js.map +1 -1
  33. package/dist/cjs/transaction/actions/gasless/providers/biconomy.js +0 -1
  34. package/dist/cjs/transaction/actions/gasless/providers/biconomy.js.map +1 -1
  35. package/dist/cjs/transaction/actions/gasless/providers/openzeppelin.js +0 -1
  36. package/dist/cjs/transaction/actions/gasless/providers/openzeppelin.js.map +1 -1
  37. package/dist/cjs/version.js +1 -1
  38. package/dist/esm/chains/utils.js +40 -0
  39. package/dist/esm/chains/utils.js.map +1 -1
  40. package/dist/esm/event/actions/get-events.js +62 -8
  41. package/dist/esm/event/actions/get-events.js.map +1 -1
  42. package/dist/esm/insight/get-events.js +51 -0
  43. package/dist/esm/insight/get-events.js.map +1 -0
  44. package/dist/esm/insight/get-nfts.js +4 -4
  45. package/dist/esm/insight/get-nfts.js.map +1 -1
  46. package/dist/esm/insight/get-tokens.js +4 -4
  47. package/dist/esm/insight/get-tokens.js.map +1 -1
  48. package/dist/esm/insight/get-transactions.js +3 -2
  49. package/dist/esm/insight/get-transactions.js.map +1 -1
  50. package/dist/esm/insight/index.js +1 -0
  51. package/dist/esm/insight/index.js.map +1 -1
  52. package/dist/esm/pay/buyWithCrypto/getHistory.js +2 -2
  53. package/dist/esm/pay/buyWithCrypto/getHistory.js.map +1 -1
  54. package/dist/esm/pay/buyWithCrypto/getStatus.js +2 -2
  55. package/dist/esm/pay/buyWithCrypto/getStatus.js.map +1 -1
  56. package/dist/esm/pay/buyWithFiat/getHistory.js +2 -2
  57. package/dist/esm/pay/buyWithFiat/getHistory.js.map +1 -1
  58. package/dist/esm/pay/buyWithFiat/getStatus.js +2 -2
  59. package/dist/esm/pay/buyWithFiat/getStatus.js.map +1 -1
  60. package/dist/esm/pay/getBuyHistory.js +2 -2
  61. package/dist/esm/pay/getBuyHistory.js.map +1 -1
  62. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.js +6 -2
  63. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.js.map +1 -1
  64. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/TransferConfirmationScreen.js +3 -1
  65. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/TransferConfirmationScreen.js.map +1 -1
  66. package/dist/esm/react/web/ui/ConnectWallet/screens/SendFunds.js +3 -1
  67. package/dist/esm/react/web/ui/ConnectWallet/screens/SendFunds.js.map +1 -1
  68. package/dist/esm/rpc/fetch-rpc.js +4 -4
  69. package/dist/esm/rpc/fetch-rpc.js.map +1 -1
  70. package/dist/esm/transaction/actions/gasless/providers/biconomy.js +0 -1
  71. package/dist/esm/transaction/actions/gasless/providers/biconomy.js.map +1 -1
  72. package/dist/esm/transaction/actions/gasless/providers/openzeppelin.js +0 -1
  73. package/dist/esm/transaction/actions/gasless/providers/openzeppelin.js.map +1 -1
  74. package/dist/esm/version.js +1 -1
  75. package/dist/types/chains/types.d.ts +7 -0
  76. package/dist/types/chains/types.d.ts.map +1 -1
  77. package/dist/types/chains/utils.d.ts +15 -1
  78. package/dist/types/chains/utils.d.ts.map +1 -1
  79. package/dist/types/event/actions/get-events.d.ts +1 -6
  80. package/dist/types/event/actions/get-events.d.ts.map +1 -1
  81. package/dist/types/insight/get-events.d.ts +31 -0
  82. package/dist/types/insight/get-events.d.ts.map +1 -0
  83. package/dist/types/insight/get-nfts.d.ts +1 -1
  84. package/dist/types/insight/get-nfts.d.ts.map +1 -1
  85. package/dist/types/insight/get-tokens.d.ts +1 -1
  86. package/dist/types/insight/get-tokens.d.ts.map +1 -1
  87. package/dist/types/insight/get-transactions.d.ts +1 -1
  88. package/dist/types/insight/get-transactions.d.ts.map +1 -1
  89. package/dist/types/insight/index.d.ts +1 -0
  90. package/dist/types/insight/index.d.ts.map +1 -1
  91. package/dist/types/pay/buyWithCrypto/getHistory.d.ts.map +1 -1
  92. package/dist/types/pay/buyWithCrypto/getStatus.d.ts.map +1 -1
  93. package/dist/types/pay/buyWithFiat/getHistory.d.ts.map +1 -1
  94. package/dist/types/pay/buyWithFiat/getStatus.d.ts.map +1 -1
  95. package/dist/types/pay/getBuyHistory.d.ts.map +1 -1
  96. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.d.ts.map +1 -1
  97. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/TransferConfirmationScreen.d.ts.map +1 -1
  98. package/dist/types/react/web/ui/ConnectWallet/screens/SendFunds.d.ts.map +1 -1
  99. package/dist/types/rpc/fetch-rpc.d.ts.map +1 -1
  100. package/dist/types/transaction/actions/gasless/providers/biconomy.d.ts.map +1 -1
  101. package/dist/types/transaction/actions/gasless/providers/openzeppelin.d.ts.map +1 -1
  102. package/dist/types/version.d.ts +1 -1
  103. package/package.json +2 -2
  104. package/src/chains/types.ts +8 -0
  105. package/src/chains/utils.ts +61 -0
  106. package/src/event/actions/get-events.test.ts +96 -0
  107. package/src/event/actions/get-events.ts +99 -12
  108. package/src/insight/get-events.ts +78 -0
  109. package/src/insight/get-nfts.ts +8 -5
  110. package/src/insight/get-tokens.ts +8 -5
  111. package/src/insight/get-transactions.ts +6 -6
  112. package/src/insight/index.ts +1 -0
  113. package/src/pay/buyWithCrypto/getHistory.ts +4 -2
  114. package/src/pay/buyWithCrypto/getStatus.ts +4 -2
  115. package/src/pay/buyWithFiat/getHistory.ts +4 -2
  116. package/src/pay/buyWithFiat/getStatus.ts +4 -2
  117. package/src/pay/getBuyHistory.ts +4 -2
  118. package/src/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.tsx +10 -2
  119. package/src/react/web/ui/ConnectWallet/screens/Buy/swap/TransferConfirmationScreen.tsx +5 -1
  120. package/src/react/web/ui/ConnectWallet/screens/SendFunds.tsx +5 -1
  121. package/src/rpc/fetch-rpc.ts +6 -4
  122. package/src/transaction/actions/gasless/providers/biconomy.ts +0 -1
  123. package/src/transaction/actions/gasless/providers/openzeppelin.ts +0 -1
  124. package/src/version.ts +1 -1
@@ -3,6 +3,7 @@ import {
3
3
  type GetV1WalletsByWalletAddressTransactionsResponse,
4
4
  getV1WalletsByWalletAddressTransactions,
5
5
  } from "@thirdweb-dev/insight";
6
+ import { stringify } from "viem";
6
7
  import type { Chain } from "../chains/types.js";
7
8
  import type { ThirdwebClient } from "../client/client.js";
8
9
  import { getThirdwebDomains } from "../utils/domains.js";
@@ -30,10 +31,7 @@ export async function getTransactions(args: {
30
31
  client: ThirdwebClient;
31
32
  walletAddress: string;
32
33
  chains: Chain[];
33
- queryOptions?: Omit<
34
- GetV1WalletsByWalletAddressTransactionsData["query"],
35
- "chain"
36
- >;
34
+ queryOptions?: GetV1WalletsByWalletAddressTransactionsData["query"];
37
35
  }): Promise<Transaction[]> {
38
36
  const threeMonthsAgoInSeconds = Math.floor(
39
37
  (Date.now() - 3 * 30 * 24 * 60 * 60 * 1000) / 1000,
@@ -52,15 +50,17 @@ export async function getTransactions(args: {
52
50
  baseUrl: `https://${getThirdwebDomains().insight}`,
53
51
  fetch: getClientFetch(client),
54
52
  query: {
55
- ...queryOptions,
56
53
  chain: chains.map((chain) => chain.id),
54
+ ...queryOptions,
57
55
  },
58
56
  path: {
59
57
  wallet_address: walletAddress,
60
58
  },
61
59
  });
62
60
  if (result.error) {
63
- throw new Error(result.error.error);
61
+ throw new Error(
62
+ `${result.response.status} ${result.response.statusText} - ${result.error ? stringify(result.error) : "Unknown error"}`,
63
+ );
64
64
  }
65
65
  return result.data.data || [];
66
66
  }
@@ -1,3 +1,4 @@
1
1
  export { getOwnedNFTs, type OwnedNFT } from "./get-nfts.js";
2
2
  export { getOwnedTokens, type OwnedToken } from "./get-tokens.js";
3
3
  export { getTransactions, type Transaction } from "./get-transactions.js";
4
+ export { getContractEvents, type ContractEvent } from "./get-events.js";
@@ -79,8 +79,10 @@ export async function getBuyWithCryptoHistory(
79
79
 
80
80
  // Assuming the response directly matches the SwapResponse interface
81
81
  if (!response.ok) {
82
- response.body?.cancel();
83
- throw new Error(`HTTP error! status: ${response.status}`);
82
+ const error = await response.text().catch(() => null);
83
+ throw new Error(
84
+ `HTTP error! status: ${response.status} - ${response.statusText}: ${error || "unknown error"}`,
85
+ );
84
86
  }
85
87
 
86
88
  const data: BuyWithCryptoHistoryData = (await response.json()).result;
@@ -142,8 +142,10 @@ export async function getBuyWithCryptoStatus(
142
142
 
143
143
  // Assuming the response directly matches the BuyWithCryptoStatus interface
144
144
  if (!response.ok) {
145
- response.body?.cancel();
146
- throw new Error(`HTTP error! status: ${response.status}`);
145
+ const error = await response.text().catch(() => null);
146
+ throw new Error(
147
+ `HTTP error! status: ${response.status} - ${response.statusText}: ${error || "unknown error"}`,
148
+ );
147
149
  }
148
150
 
149
151
  const data: BuyWithCryptoStatus = (await response.json()).result;
@@ -78,8 +78,10 @@ export async function getBuyWithFiatHistory(
78
78
 
79
79
  // Assuming the response directly matches the BuyWithFiatStatus response interface
80
80
  if (!response.ok) {
81
- response.body?.cancel();
82
- throw new Error(`HTTP error! status: ${response.status}`);
81
+ const error = await response.text().catch(() => null);
82
+ throw new Error(
83
+ `HTTP error! status: ${response.status} - ${response.statusText}: ${error || "unknown error"}`,
84
+ );
83
85
  }
84
86
 
85
87
  const data: BuyWithFiatHistoryData = (await response.json()).result;
@@ -188,8 +188,10 @@ export async function getBuyWithFiatStatus(
188
188
  const response = await getClientFetch(params.client)(url);
189
189
 
190
190
  if (!response.ok) {
191
- response.body?.cancel();
192
- throw new Error(`HTTP error! status: ${response.status}`);
191
+ const error = await response.text().catch(() => null);
192
+ throw new Error(
193
+ `HTTP error! status: ${response.status} - ${response.statusText}: ${error || "unknown error"}`,
194
+ );
193
195
  }
194
196
 
195
197
  return (await response.json()).result;
@@ -93,8 +93,10 @@ export async function getBuyHistory(
93
93
 
94
94
  // Assuming the response directly matches the SwapResponse interface
95
95
  if (!response.ok) {
96
- response.body?.cancel();
97
- throw new Error(`HTTP error! status: ${response.status}`);
96
+ const error = await response.text().catch(() => null);
97
+ throw new Error(
98
+ `HTTP error! status: ${response.status} - ${response.statusText}: ${error || "unknown error"}`,
99
+ );
98
100
  }
99
101
 
100
102
  const data: BuyHistoryData = (await response.json()).result;
@@ -68,7 +68,11 @@ export function SwapConfirmationScreen(props: {
68
68
 
69
69
  const uiErrorMessage = useMemo(() => {
70
70
  if (step === "approval" && status === "error" && error) {
71
- if (error.toLowerCase().includes("user rejected")) {
71
+ if (
72
+ error.toLowerCase().includes("user rejected") ||
73
+ error.toLowerCase().includes("user closed modal") ||
74
+ error.toLowerCase().includes("user denied")
75
+ ) {
72
76
  return {
73
77
  title: "Failed to Approve",
74
78
  message: "Your wallet rejected the approval request.",
@@ -82,7 +86,11 @@ export function SwapConfirmationScreen(props: {
82
86
  }
83
87
 
84
88
  if (step === "swap" && status === "error" && error) {
85
- if (error.toLowerCase().includes("user rejected")) {
89
+ if (
90
+ error.toLowerCase().includes("user rejected") ||
91
+ error.toLowerCase().includes("user closed modal") ||
92
+ error.toLowerCase().includes("user denied")
93
+ ) {
86
94
  return {
87
95
  title: "Failed to Confirm",
88
96
  message: "Your wallet rejected the confirmation request.",
@@ -112,7 +112,11 @@ export function TransferConfirmationScreen(
112
112
 
113
113
  const uiErrorMessage = useMemo(() => {
114
114
  if (step === "approve" && status.id === "error" && status.error) {
115
- if (status.error.toLowerCase().includes("user rejected")) {
115
+ if (
116
+ status.error.toLowerCase().includes("user rejected") ||
117
+ status.error.toLowerCase().includes("user closed modal") ||
118
+ status.error.toLowerCase().includes("user denied")
119
+ ) {
116
120
  return {
117
121
  title: "Failed to Approve",
118
122
  message: "Your wallet rejected the approval request.",
@@ -145,7 +145,11 @@ export function SendFundsForm(props: {
145
145
  return locale.transactionFailed;
146
146
  }
147
147
 
148
- if (message.includes("user rejected")) {
148
+ if (
149
+ message.includes("user rejected") ||
150
+ message.includes("user closed modal") ||
151
+ message.includes("user denied")
152
+ ) {
149
153
  return locale.transactionRejected;
150
154
  }
151
155
 
@@ -72,9 +72,9 @@ export async function fetchRpc(
72
72
  });
73
73
 
74
74
  if (!response.ok) {
75
- response.body?.cancel();
75
+ const error = await response.text().catch(() => null);
76
76
  throw new Error(
77
- `RPC request failed with status ${response.status} - ${response.statusText}`,
77
+ `RPC request failed with status ${response.status} - ${response.statusText}: ${error || "unknown error"}`,
78
78
  );
79
79
  }
80
80
 
@@ -116,8 +116,10 @@ export async function fetchSingleRpc(
116
116
  });
117
117
 
118
118
  if (!response.ok) {
119
- response.body?.cancel();
120
- throw new Error(`RPC request failed with status ${response.status}`);
119
+ const error = await response.text().catch(() => null);
120
+ throw new Error(
121
+ `RPC request failed with status ${response.status} - ${response.statusText}: ${error || "unknown error"}`,
122
+ );
121
123
  }
122
124
  if (response.headers.get("Content-Type")?.startsWith("application/json")) {
123
125
  return await response.json();
@@ -139,7 +139,6 @@ export async function relayBiconomyTransaction(
139
139
  },
140
140
  );
141
141
  if (!response.ok) {
142
- response.body?.cancel();
143
142
  throw new Error(`Failed to send transaction: ${await response.text()}`);
144
143
  }
145
144
  const json = await response.json();
@@ -157,7 +157,6 @@ export async function relayOpenZeppelinTransaction(
157
157
  });
158
158
 
159
159
  if (!response.ok) {
160
- response.body?.cancel();
161
160
  throw new Error(`Failed to send transaction: ${await response.text()}`);
162
161
  }
163
162
  const json = await response.json();
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = "5.95.0-nightly-4c1f384a635054a8cfaaa487e3ba7ada63b221ec-20250415110008";
1
+ export const version = "5.95.0-nightly-64bd603301b3067b6a69a29f66a28dee7ffa38f5-20250416000349";