thirdweb 5.102.3 → 5.102.4-nightly-de297e4c9787982f0d66d3898f32a45768a68bc9-20250603000531
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/analytics/track/helpers.js +41 -0
- package/dist/cjs/analytics/track/helpers.js.map +1 -0
- package/dist/cjs/analytics/track/transaction.js +25 -0
- package/dist/cjs/analytics/track/transaction.js.map +1 -1
- package/dist/cjs/insight/get-tokens.js +5 -6
- package/dist/cjs/insight/get-tokens.js.map +1 -1
- package/dist/cjs/react/core/hooks/transaction/useSendTransaction.js +13 -0
- package/dist/cjs/react/core/hooks/transaction/useSendTransaction.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/fetchBalancesForWallet.js +28 -8
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/fetchBalancesForWallet.js.map +1 -1
- package/dist/cjs/transaction/actions/estimate-gas.js +2 -0
- package/dist/cjs/transaction/actions/estimate-gas.js.map +1 -1
- package/dist/cjs/transaction/actions/simulate.js +1 -0
- package/dist/cjs/transaction/actions/simulate.js.map +1 -1
- package/dist/cjs/transaction/extract-error.js +13 -1
- package/dist/cjs/transaction/extract-error.js.map +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/version.js.map +1 -1
- package/dist/cjs/wallets/injected/index.js +35 -17
- package/dist/cjs/wallets/injected/index.js.map +1 -1
- package/dist/cjs/wallets/smart/index.js +16 -0
- package/dist/cjs/wallets/smart/index.js.map +1 -1
- package/dist/esm/analytics/track/helpers.js +37 -0
- package/dist/esm/analytics/track/helpers.js.map +1 -0
- package/dist/esm/analytics/track/transaction.js +24 -0
- package/dist/esm/analytics/track/transaction.js.map +1 -1
- package/dist/esm/insight/get-tokens.js +5 -6
- package/dist/esm/insight/get-tokens.js.map +1 -1
- package/dist/esm/react/core/hooks/transaction/useSendTransaction.js +13 -0
- package/dist/esm/react/core/hooks/transaction/useSendTransaction.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/fetchBalancesForWallet.js +28 -8
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/fetchBalancesForWallet.js.map +1 -1
- package/dist/esm/transaction/actions/estimate-gas.js +2 -0
- package/dist/esm/transaction/actions/estimate-gas.js.map +1 -1
- package/dist/esm/transaction/actions/simulate.js +1 -0
- package/dist/esm/transaction/actions/simulate.js.map +1 -1
- package/dist/esm/transaction/extract-error.js +13 -1
- package/dist/esm/transaction/extract-error.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/esm/wallets/injected/index.js +35 -17
- package/dist/esm/wallets/injected/index.js.map +1 -1
- package/dist/esm/wallets/smart/index.js +16 -0
- package/dist/esm/wallets/smart/index.js.map +1 -1
- package/dist/types/analytics/track/helpers.d.ts +12 -0
- package/dist/types/analytics/track/helpers.d.ts.map +1 -0
- package/dist/types/analytics/track/transaction.d.ts +15 -0
- package/dist/types/analytics/track/transaction.d.ts.map +1 -1
- package/dist/types/insight/get-tokens.d.ts +2 -2
- package/dist/types/insight/get-tokens.d.ts.map +1 -1
- package/dist/types/react/core/hooks/transaction/useSendTransaction.d.ts.map +1 -1
- package/dist/types/transaction/actions/estimate-gas.d.ts.map +1 -1
- package/dist/types/transaction/actions/simulate.d.ts.map +1 -1
- package/dist/types/transaction/extract-error.d.ts +1 -0
- package/dist/types/transaction/extract-error.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/injected/index.d.ts.map +1 -1
- package/dist/types/wallets/smart/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/analytics/track/helpers.test.ts +109 -0
- package/src/analytics/track/helpers.ts +49 -0
- package/src/analytics/track/transaction.test.ts +110 -1
- package/src/analytics/track/transaction.ts +37 -0
- package/src/insight/get-tokens.ts +13 -11
- package/src/react/core/hooks/transaction/useSendTransaction.ts +14 -0
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/fetchBalancesForWallet.tsx +32 -8
- package/src/transaction/actions/estimate-gas.ts +2 -0
- package/src/transaction/actions/simulate.ts +1 -0
- package/src/transaction/extract-error.ts +16 -1
- package/src/version.ts +1 -1
- package/src/wallets/injected/index.ts +36 -18
- package/src/wallets/smart/index.ts +16 -0
@@ -1,5 +1,7 @@
|
|
1
1
|
import type { Abi } from "abitype";
|
2
2
|
import { type Hex, decodeErrorResult, stringify } from "viem";
|
3
|
+
import { isInsufficientFundsError } from "../analytics/track/helpers.js";
|
4
|
+
import { trackInsufficientFundsError } from "../analytics/track/transaction.js";
|
3
5
|
import { resolveContractAbi } from "../contract/actions/resolve-abi.js";
|
4
6
|
import type { ThirdwebContract } from "../contract/contract.js";
|
5
7
|
import { isHex } from "../utils/encoding/hex.js";
|
@@ -11,8 +13,21 @@ import { IS_DEV } from "../utils/process.js";
|
|
11
13
|
export async function extractError<abi extends Abi>(args: {
|
12
14
|
error: unknown;
|
13
15
|
contract?: ThirdwebContract<abi>;
|
16
|
+
fromAddress?: string;
|
14
17
|
}) {
|
15
|
-
const { error, contract } = args;
|
18
|
+
const { error, contract, fromAddress } = args;
|
19
|
+
|
20
|
+
// Track insufficient funds errors during transaction preparation
|
21
|
+
if (isInsufficientFundsError(error) && contract) {
|
22
|
+
trackInsufficientFundsError({
|
23
|
+
client: contract.client,
|
24
|
+
error,
|
25
|
+
walletAddress: fromAddress,
|
26
|
+
chainId: contract.chain?.id,
|
27
|
+
contractAddress: contract.address,
|
28
|
+
});
|
29
|
+
}
|
30
|
+
|
16
31
|
const result = await extractErrorResult({ error, contract });
|
17
32
|
if (result) {
|
18
33
|
return new TransactionError(result, contract);
|
package/src/version.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export const version = "5.102.
|
1
|
+
export const version = "5.102.4-nightly-de297e4c9787982f0d66d3898f32a45768a68bc9-20250603000531";
|
@@ -5,7 +5,9 @@ import {
|
|
5
5
|
serializeTypedData,
|
6
6
|
validateTypedData,
|
7
7
|
} from "viem";
|
8
|
+
import { isInsufficientFundsError } from "../../analytics/track/helpers.js";
|
8
9
|
import { trackTransaction } from "../../analytics/track/transaction.js";
|
10
|
+
import { trackInsufficientFundsError } from "../../analytics/track/transaction.js";
|
9
11
|
import type { Chain } from "../../chains/types.js";
|
10
12
|
import { getCachedChain, getChainMetadata } from "../../chains/utils.js";
|
11
13
|
import type { ThirdwebClient } from "../../client/client.js";
|
@@ -200,25 +202,41 @@ function createAccount({
|
|
200
202
|
},
|
201
203
|
];
|
202
204
|
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
205
|
+
try {
|
206
|
+
const transactionHash = (await provider.request({
|
207
|
+
method: "eth_sendTransaction",
|
208
|
+
// @ts-expect-error - overriding types here
|
209
|
+
params,
|
210
|
+
})) as Hex;
|
211
|
+
|
212
|
+
trackTransaction({
|
213
|
+
client,
|
214
|
+
chainId: tx.chainId,
|
215
|
+
walletAddress: getAddress(address),
|
216
|
+
walletType: id,
|
217
|
+
transactionHash,
|
218
|
+
contractAddress: tx.to ?? undefined,
|
219
|
+
gasPrice: tx.gasPrice,
|
220
|
+
});
|
221
|
+
|
222
|
+
return {
|
223
|
+
transactionHash,
|
224
|
+
};
|
225
|
+
} catch (error) {
|
226
|
+
// Track insufficient funds errors
|
227
|
+
if (isInsufficientFundsError(error)) {
|
228
|
+
trackInsufficientFundsError({
|
229
|
+
client,
|
230
|
+
error,
|
231
|
+
walletAddress: getAddress(address),
|
232
|
+
chainId: tx.chainId,
|
233
|
+
contractAddress: tx.to || undefined,
|
234
|
+
transactionValue: tx.value,
|
235
|
+
});
|
236
|
+
}
|
218
237
|
|
219
|
-
|
220
|
-
|
221
|
-
};
|
238
|
+
throw error;
|
239
|
+
}
|
222
240
|
},
|
223
241
|
async signMessage({ message }) {
|
224
242
|
if (!account.address) {
|
@@ -1,5 +1,7 @@
|
|
1
1
|
import type * as ox__TypedData from "ox/TypedData";
|
2
|
+
import { isInsufficientFundsError } from "../../analytics/track/helpers.js";
|
2
3
|
import { trackTransaction } from "../../analytics/track/transaction.js";
|
4
|
+
import { trackInsufficientFundsError } from "../../analytics/track/transaction.js";
|
3
5
|
import type { Chain } from "../../chains/types.js";
|
4
6
|
import { getCachedChain } from "../../chains/utils.js";
|
5
7
|
import type { ThirdwebClient } from "../../client/client.js";
|
@@ -559,6 +561,20 @@ async function _sendUserOp(args: {
|
|
559
561
|
chain: options.chain,
|
560
562
|
transactionHash: receipt.transactionHash,
|
561
563
|
};
|
564
|
+
} catch (error) {
|
565
|
+
// Track insufficient funds errors
|
566
|
+
if (isInsufficientFundsError(error)) {
|
567
|
+
trackInsufficientFundsError({
|
568
|
+
client: options.client,
|
569
|
+
error,
|
570
|
+
walletAddress: options.accountContract.address,
|
571
|
+
chainId: options.chain.id,
|
572
|
+
contractAddress: await resolvePromisedValue(executeTx.to ?? undefined),
|
573
|
+
transactionValue: await resolvePromisedValue(executeTx.value),
|
574
|
+
});
|
575
|
+
}
|
576
|
+
|
577
|
+
throw error;
|
562
578
|
} finally {
|
563
579
|
// reset the isDeploying flag after every transaction or error
|
564
580
|
clearAccountDeploying(options.accountContract);
|