@dynamic-labs/sdk-react-core 4.45.3 → 4.46.0

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/CHANGELOG.md CHANGED
@@ -1,4 +1,12 @@
1
1
 
2
+ ## [4.46.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.45.3...v4.46.0) (2025-11-19)
3
+
4
+
5
+ ### Features
6
+
7
+ * **react-native:** add client.solana.simulateTransaction method ([#9910](https://github.com/dynamic-labs/dynamic-auth/issues/9910)) ([61bbe45](https://github.com/dynamic-labs/dynamic-auth/commit/61bbe453eeb2790dffc533aa57f6bc050c3c0461))
8
+ * **react-native:** add simulateEVMTransactionAA and simulateEVMTransaction methods ([#9907](https://github.com/dynamic-labs/dynamic-auth/issues/9907)) ([e54d63e](https://github.com/dynamic-labs/dynamic-auth/commit/e54d63eaa80c2bc865ef6199405b0ed7943d4b83))
9
+
2
10
  ### [4.45.3](https://github.com/dynamic-labs/dynamic-auth/compare/v4.45.2...v4.45.3) (2025-11-18)
3
11
 
4
12
 
package/package.cjs CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var version = "4.45.3";
6
+ var version = "4.46.0";
7
7
  var dependencies = {
8
8
  "@dynamic-labs/sdk-api-core": "0.0.821",
9
9
  "@dynamic-labs-sdk/client": "0.1.0-alpha.28",
package/package.js CHANGED
@@ -1,5 +1,5 @@
1
1
  'use client'
2
- var version = "4.45.3";
2
+ var version = "4.46.0";
3
3
  var dependencies = {
4
4
  "@dynamic-labs/sdk-api-core": "0.0.821",
5
5
  "@dynamic-labs-sdk/client": "0.1.0-alpha.28",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/sdk-react-core",
3
- "version": "4.45.3",
3
+ "version": "4.46.0",
4
4
  "dependencies": {
5
5
  "@dynamic-labs/sdk-api-core": "0.0.821",
6
6
  "@dynamic-labs-sdk/client": "0.1.0-alpha.28",
@@ -15,17 +15,17 @@
15
15
  "yup": "0.32.11",
16
16
  "react-international-phone": "4.5.0",
17
17
  "bs58": "5.0.0",
18
- "@dynamic-labs/assert-package-version": "4.45.3",
19
- "@dynamic-labs/iconic": "4.45.3",
20
- "@dynamic-labs/locale": "4.45.3",
21
- "@dynamic-labs/logger": "4.45.3",
22
- "@dynamic-labs/multi-wallet": "4.45.3",
23
- "@dynamic-labs/rpc-providers": "4.45.3",
24
- "@dynamic-labs/store": "4.45.3",
25
- "@dynamic-labs/types": "4.45.3",
26
- "@dynamic-labs/utils": "4.45.3",
27
- "@dynamic-labs/wallet-book": "4.45.3",
28
- "@dynamic-labs/wallet-connector-core": "4.45.3",
18
+ "@dynamic-labs/assert-package-version": "4.46.0",
19
+ "@dynamic-labs/iconic": "4.46.0",
20
+ "@dynamic-labs/locale": "4.46.0",
21
+ "@dynamic-labs/logger": "4.46.0",
22
+ "@dynamic-labs/multi-wallet": "4.46.0",
23
+ "@dynamic-labs/rpc-providers": "4.46.0",
24
+ "@dynamic-labs/store": "4.46.0",
25
+ "@dynamic-labs/types": "4.46.0",
26
+ "@dynamic-labs/utils": "4.46.0",
27
+ "@dynamic-labs/wallet-book": "4.46.0",
28
+ "@dynamic-labs/wallet-connector-core": "4.46.0",
29
29
  "eventemitter3": "5.0.1"
30
30
  },
31
31
  "devDependencies": {
@@ -25,10 +25,14 @@ const useEVMTransactionSimulation = () => {
25
25
  var _a, _b;
26
26
  if (!(primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector) ||
27
27
  !utils.isZeroDevConnector(primaryWallet.connector)) {
28
- return handleSimulationError(new Error('Account abstraction simulation requires ZeroDev connector'), 'AA');
28
+ const error = new Error('Account abstraction simulation requires ZeroDev connector');
29
+ handleSimulationError(error, 'AA');
30
+ throw error;
29
31
  }
30
32
  if (!chainId) {
31
- return handleSimulationError(new Error('No chain ID found'), 'AA');
33
+ const error = new Error('No chain ID found');
34
+ handleSimulationError(error, 'AA');
35
+ throw error;
32
36
  }
33
37
  const { transaction } = params;
34
38
  try {
@@ -36,12 +40,16 @@ const useEVMTransactionSimulation = () => {
36
40
  const connector = primaryWallet.connector;
37
41
  const { userOperation } = yield connector.getCurrentUserOperation(transaction);
38
42
  if (!userOperation) {
39
- return handleSimulationError(new Error('failed to get user operation'), 'AA');
43
+ const error = new Error('failed to get user operation');
44
+ handleSimulationError(error, 'AA');
45
+ throw error;
40
46
  }
41
47
  const formattedUserOperation = yield connector.formatUserOperation(userOperation);
42
48
  const entryPoint = (_a = connector.getAccountAbstractionProvider()) === null || _a === void 0 ? void 0 : _a.account.entryPoint;
43
49
  if (!entryPoint) {
44
- return handleSimulationError(new Error('No entry point address found'), 'AA');
50
+ const error = new Error('No entry point address found');
51
+ handleSimulationError(error, 'AA');
52
+ throw error;
45
53
  }
46
54
  const result = yield blockaid.simulateBlockaidUserOperation({
47
55
  chainId,
@@ -51,7 +59,9 @@ const useEVMTransactionSimulation = () => {
51
59
  value: ((_b = transaction.value) === null || _b === void 0 ? void 0 : _b.toString()) || '0',
52
60
  });
53
61
  if (!result) {
54
- return handleSimulationError(new Error('Simulation failed: No result returned'), 'AA');
62
+ const error = new Error('Simulation failed: No result returned');
63
+ handleSimulationError(error, 'AA');
64
+ throw error;
55
65
  }
56
66
  const fee = utils.calculateAAFees(userOperation);
57
67
  const isSponsored = yield connector.canSponsorTransactionGas(transaction);
@@ -66,10 +76,11 @@ const useEVMTransactionSimulation = () => {
66
76
  isLoading: false,
67
77
  result: resultWithFee,
68
78
  });
69
- return;
79
+ return result;
70
80
  }
71
81
  catch (error) {
72
- return handleSimulationError(error, 'AA');
82
+ handleSimulationError(error, 'AA');
83
+ throw error;
73
84
  }
74
85
  }), [
75
86
  chainId,
@@ -83,15 +94,21 @@ const useEVMTransactionSimulation = () => {
83
94
  var _c;
84
95
  const { transaction } = params;
85
96
  if (!(primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector)) {
86
- return handleSimulationError(new Error('No wallet connected'), 'EVM');
97
+ const error = new Error('No wallet connected');
98
+ handleSimulationError(error, 'EVM');
99
+ throw error;
87
100
  }
88
101
  if (!chainId) {
89
- return handleSimulationError(new Error('No chain ID found'), 'EVM');
102
+ const error = new Error('No chain ID found');
103
+ handleSimulationError(error, 'EVM');
104
+ throw error;
90
105
  }
91
106
  try {
92
107
  setSimulationState({ isLoading: true });
93
108
  if (!utils.isEthereumWallet(primaryWallet)) {
94
- return handleSimulationError(new Error('EVM simulation requires Ethereum wallet'), 'EVM');
109
+ const error = new Error('EVM simulation requires Ethereum wallet');
110
+ handleSimulationError(error, 'EVM');
111
+ throw error;
95
112
  }
96
113
  const publicClient = yield primaryWallet.getPublicClient();
97
114
  const totalFee = yield utils.calculateEVMFees(publicClient, transaction);
@@ -104,7 +121,9 @@ const useEVMTransactionSimulation = () => {
104
121
  value: ((_c = transaction.value) === null || _c === void 0 ? void 0 : _c.toString()) || '0',
105
122
  });
106
123
  if (!result) {
107
- return handleSimulationError(new Error('Simulation failed: No result returned'), 'EVM');
124
+ const error = new Error('Simulation failed: No result returned');
125
+ handleSimulationError(error, 'EVM');
126
+ throw error;
108
127
  }
109
128
  const resultWithFee = utils.generateAllFeeData(totalFee, nativeTokenDecimals, result);
110
129
  // Filter out native asset if it's just gas fee (no ETH transfer)
@@ -115,10 +134,11 @@ const useEVMTransactionSimulation = () => {
115
134
  isLoading: false,
116
135
  result: resultWithFee,
117
136
  });
118
- return;
137
+ return resultWithFee;
119
138
  }
120
139
  catch (error) {
121
- return handleSimulationError(error, 'EVM');
140
+ handleSimulationError(error, 'EVM');
141
+ throw error;
122
142
  }
123
143
  }), [
124
144
  chainId,
@@ -1,4 +1,5 @@
1
1
  import { IEVMTransaction } from '@dynamic-labs/types';
2
+ import { SimulateTransactionResponse } from '@dynamic-labs/sdk-api-core';
2
3
  import { type TransactionType, type FeeData, type SimulationState } from './useBaseTransactionSimulation';
3
4
  export type { TransactionType, SimulationState, FeeData };
4
5
  export type EVMTransactionParams = {
@@ -6,7 +7,7 @@ export type EVMTransactionParams = {
6
7
  type: Omit<TransactionType, 'SignAllTransactions' | 'SignTransaction'>;
7
8
  };
8
9
  export type EVMTransactionSimulationHook = {
9
- simulateEVMTransaction: (params: EVMTransactionParams) => Promise<void>;
10
- simulateEVMTransactionAA: (params: EVMTransactionParams) => Promise<void>;
10
+ simulateEVMTransaction: (params: EVMTransactionParams) => Promise<SimulateTransactionResponse>;
11
+ simulateEVMTransactionAA: (params: EVMTransactionParams) => Promise<SimulateTransactionResponse>;
11
12
  } & SimulationState;
12
13
  export declare const useEVMTransactionSimulation: () => EVMTransactionSimulationHook;
@@ -21,10 +21,14 @@ const useEVMTransactionSimulation = () => {
21
21
  var _a, _b;
22
22
  if (!(primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector) ||
23
23
  !isZeroDevConnector(primaryWallet.connector)) {
24
- return handleSimulationError(new Error('Account abstraction simulation requires ZeroDev connector'), 'AA');
24
+ const error = new Error('Account abstraction simulation requires ZeroDev connector');
25
+ handleSimulationError(error, 'AA');
26
+ throw error;
25
27
  }
26
28
  if (!chainId) {
27
- return handleSimulationError(new Error('No chain ID found'), 'AA');
29
+ const error = new Error('No chain ID found');
30
+ handleSimulationError(error, 'AA');
31
+ throw error;
28
32
  }
29
33
  const { transaction } = params;
30
34
  try {
@@ -32,12 +36,16 @@ const useEVMTransactionSimulation = () => {
32
36
  const connector = primaryWallet.connector;
33
37
  const { userOperation } = yield connector.getCurrentUserOperation(transaction);
34
38
  if (!userOperation) {
35
- return handleSimulationError(new Error('failed to get user operation'), 'AA');
39
+ const error = new Error('failed to get user operation');
40
+ handleSimulationError(error, 'AA');
41
+ throw error;
36
42
  }
37
43
  const formattedUserOperation = yield connector.formatUserOperation(userOperation);
38
44
  const entryPoint = (_a = connector.getAccountAbstractionProvider()) === null || _a === void 0 ? void 0 : _a.account.entryPoint;
39
45
  if (!entryPoint) {
40
- return handleSimulationError(new Error('No entry point address found'), 'AA');
46
+ const error = new Error('No entry point address found');
47
+ handleSimulationError(error, 'AA');
48
+ throw error;
41
49
  }
42
50
  const result = yield simulateBlockaidUserOperation({
43
51
  chainId,
@@ -47,7 +55,9 @@ const useEVMTransactionSimulation = () => {
47
55
  value: ((_b = transaction.value) === null || _b === void 0 ? void 0 : _b.toString()) || '0',
48
56
  });
49
57
  if (!result) {
50
- return handleSimulationError(new Error('Simulation failed: No result returned'), 'AA');
58
+ const error = new Error('Simulation failed: No result returned');
59
+ handleSimulationError(error, 'AA');
60
+ throw error;
51
61
  }
52
62
  const fee = calculateAAFees(userOperation);
53
63
  const isSponsored = yield connector.canSponsorTransactionGas(transaction);
@@ -62,10 +72,11 @@ const useEVMTransactionSimulation = () => {
62
72
  isLoading: false,
63
73
  result: resultWithFee,
64
74
  });
65
- return;
75
+ return result;
66
76
  }
67
77
  catch (error) {
68
- return handleSimulationError(error, 'AA');
78
+ handleSimulationError(error, 'AA');
79
+ throw error;
69
80
  }
70
81
  }), [
71
82
  chainId,
@@ -79,15 +90,21 @@ const useEVMTransactionSimulation = () => {
79
90
  var _c;
80
91
  const { transaction } = params;
81
92
  if (!(primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector)) {
82
- return handleSimulationError(new Error('No wallet connected'), 'EVM');
93
+ const error = new Error('No wallet connected');
94
+ handleSimulationError(error, 'EVM');
95
+ throw error;
83
96
  }
84
97
  if (!chainId) {
85
- return handleSimulationError(new Error('No chain ID found'), 'EVM');
98
+ const error = new Error('No chain ID found');
99
+ handleSimulationError(error, 'EVM');
100
+ throw error;
86
101
  }
87
102
  try {
88
103
  setSimulationState({ isLoading: true });
89
104
  if (!isEthereumWallet(primaryWallet)) {
90
- return handleSimulationError(new Error('EVM simulation requires Ethereum wallet'), 'EVM');
105
+ const error = new Error('EVM simulation requires Ethereum wallet');
106
+ handleSimulationError(error, 'EVM');
107
+ throw error;
91
108
  }
92
109
  const publicClient = yield primaryWallet.getPublicClient();
93
110
  const totalFee = yield calculateEVMFees(publicClient, transaction);
@@ -100,7 +117,9 @@ const useEVMTransactionSimulation = () => {
100
117
  value: ((_c = transaction.value) === null || _c === void 0 ? void 0 : _c.toString()) || '0',
101
118
  });
102
119
  if (!result) {
103
- return handleSimulationError(new Error('Simulation failed: No result returned'), 'EVM');
120
+ const error = new Error('Simulation failed: No result returned');
121
+ handleSimulationError(error, 'EVM');
122
+ throw error;
104
123
  }
105
124
  const resultWithFee = generateAllFeeData(totalFee, nativeTokenDecimals, result);
106
125
  // Filter out native asset if it's just gas fee (no ETH transfer)
@@ -111,10 +130,11 @@ const useEVMTransactionSimulation = () => {
111
130
  isLoading: false,
112
131
  result: resultWithFee,
113
132
  });
114
- return;
133
+ return resultWithFee;
115
134
  }
116
135
  catch (error) {
117
- return handleSimulationError(error, 'EVM');
136
+ handleSimulationError(error, 'EVM');
137
+ throw error;
118
138
  }
119
139
  }), [
120
140
  chainId,
@@ -19,7 +19,9 @@ const useSVMTransactionSimulation = () => {
19
19
  const { simulationState, setSimulationState, nativeTokenDecimals, handleSimulationError, primaryWallet, environmentId, } = useBaseTransactionSimulation.useBaseTransactionSimulation('useSVMTransactionSimulation');
20
20
  const simulateSVMTransaction = React.useCallback((params) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
21
21
  if (!(primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector) || primaryWallet.chain !== sdkApiCore.ChainEnum.Sol) {
22
- return handleSimulationError(new Error('Solana simulation requires Solana wallet'));
22
+ const error = new Error('Solana simulation requires Solana wallet');
23
+ handleSimulationError(error);
24
+ throw error;
23
25
  }
24
26
  const transactions = Array.isArray(params.transaction)
25
27
  ? params.transaction
@@ -48,12 +50,16 @@ const useSVMTransactionSimulation = () => {
48
50
  transactions: encodedTransactions,
49
51
  });
50
52
  if (!result) {
51
- return handleSimulationError(new Error('Simulation failed: No result returned'));
53
+ const error = new Error('Simulation failed: No result returned');
54
+ handleSimulationError(error);
55
+ throw error;
52
56
  }
53
57
  const finalFee = isSponsored ? BigInt(0) : fee || BigInt(0);
54
58
  // For Solana, we need to ensure we have a valid fee
55
59
  if (!isSponsored && finalFee === BigInt(0)) {
56
- return handleSimulationError(new Error('Failed to calculate transaction fee'));
60
+ const error = new Error('Failed to calculate transaction fee');
61
+ handleSimulationError(error);
62
+ throw error;
57
63
  }
58
64
  const resultWithFee = utils.generateAllFeeData(finalFee, nativeTokenDecimals, result);
59
65
  // simulations include gas fees in the outAssets, so we need to remove them
@@ -64,10 +70,11 @@ const useSVMTransactionSimulation = () => {
64
70
  isLoading: false,
65
71
  result: resultWithFee,
66
72
  });
67
- return;
73
+ return resultWithFee;
68
74
  }
69
75
  catch (error) {
70
- return handleSimulationError(error);
76
+ handleSimulationError(error);
77
+ throw error;
71
78
  }
72
79
  }), [
73
80
  primaryWallet,
@@ -1,3 +1,4 @@
1
+ import { SimulateTransactionResponse } from '@dynamic-labs/sdk-api-core';
1
2
  import { ISolanaTransaction } from '@dynamic-labs/types';
2
3
  import { type TransactionType, type SimulationState, type FeeData } from './useBaseTransactionSimulation';
3
4
  export type { TransactionType, SimulationState, FeeData };
@@ -7,6 +8,6 @@ export type SVMTransactionParams = {
7
8
  type: Omit<TransactionType, 'SendTransaction'>;
8
9
  };
9
10
  export type SVMTransactionSimulationHook = {
10
- simulateSVMTransaction: (params: SVMTransactionParams) => Promise<void>;
11
+ simulateSVMTransaction: (params: SVMTransactionParams) => Promise<SimulateTransactionResponse>;
11
12
  } & SimulationState;
12
13
  export declare const useSVMTransactionSimulation: () => SVMTransactionSimulationHook;
@@ -11,7 +11,9 @@ const useSVMTransactionSimulation = () => {
11
11
  const { simulationState, setSimulationState, nativeTokenDecimals, handleSimulationError, primaryWallet, environmentId, } = useBaseTransactionSimulation('useSVMTransactionSimulation');
12
12
  const simulateSVMTransaction = useCallback((params) => __awaiter(void 0, void 0, void 0, function* () {
13
13
  if (!(primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector) || primaryWallet.chain !== ChainEnum.Sol) {
14
- return handleSimulationError(new Error('Solana simulation requires Solana wallet'));
14
+ const error = new Error('Solana simulation requires Solana wallet');
15
+ handleSimulationError(error);
16
+ throw error;
15
17
  }
16
18
  const transactions = Array.isArray(params.transaction)
17
19
  ? params.transaction
@@ -40,12 +42,16 @@ const useSVMTransactionSimulation = () => {
40
42
  transactions: encodedTransactions,
41
43
  });
42
44
  if (!result) {
43
- return handleSimulationError(new Error('Simulation failed: No result returned'));
45
+ const error = new Error('Simulation failed: No result returned');
46
+ handleSimulationError(error);
47
+ throw error;
44
48
  }
45
49
  const finalFee = isSponsored ? BigInt(0) : fee || BigInt(0);
46
50
  // For Solana, we need to ensure we have a valid fee
47
51
  if (!isSponsored && finalFee === BigInt(0)) {
48
- return handleSimulationError(new Error('Failed to calculate transaction fee'));
52
+ const error = new Error('Failed to calculate transaction fee');
53
+ handleSimulationError(error);
54
+ throw error;
49
55
  }
50
56
  const resultWithFee = generateAllFeeData(finalFee, nativeTokenDecimals, result);
51
57
  // simulations include gas fees in the outAssets, so we need to remove them
@@ -56,10 +62,11 @@ const useSVMTransactionSimulation = () => {
56
62
  isLoading: false,
57
63
  result: resultWithFee,
58
64
  });
59
- return;
65
+ return resultWithFee;
60
66
  }
61
67
  catch (error) {
62
- return handleSimulationError(error);
68
+ handleSimulationError(error);
69
+ throw error;
63
70
  }
64
71
  }), [
65
72
  primaryWallet,