@dynamic-labs/sdk-react-core 4.61.0 → 4.61.1
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,11 @@
|
|
|
1
1
|
|
|
2
|
+
### [4.61.1](https://github.com/dynamic-labs/dynamic-auth/compare/v4.61.0...v4.61.1) (2026-02-11)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* remove warning when SVM gas sponsorship enabled ([#10412](https://github.com/dynamic-labs/dynamic-auth/issues/10412)) ([dc1a615](https://github.com/dynamic-labs/dynamic-auth/commit/dc1a615a43c89942c9b17101bb1da4492df8140b))
|
|
8
|
+
|
|
2
9
|
## [4.61.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.60.1...v4.61.0) (2026-02-10)
|
|
3
10
|
|
|
4
11
|
|
package/package.cjs
CHANGED
package/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/sdk-react-core",
|
|
3
|
-
"version": "4.61.
|
|
3
|
+
"version": "4.61.1",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@dynamic-labs/sdk-api-core": "0.0.864",
|
|
6
6
|
"@dynamic-labs-sdk/client": "0.8.0",
|
|
@@ -16,17 +16,17 @@
|
|
|
16
16
|
"yup": "0.32.11",
|
|
17
17
|
"react-international-phone": "4.5.0",
|
|
18
18
|
"bs58": "5.0.0",
|
|
19
|
-
"@dynamic-labs/assert-package-version": "4.61.
|
|
20
|
-
"@dynamic-labs/iconic": "4.61.
|
|
21
|
-
"@dynamic-labs/locale": "4.61.
|
|
22
|
-
"@dynamic-labs/logger": "4.61.
|
|
23
|
-
"@dynamic-labs/multi-wallet": "4.61.
|
|
24
|
-
"@dynamic-labs/rpc-providers": "4.61.
|
|
25
|
-
"@dynamic-labs/store": "4.61.
|
|
26
|
-
"@dynamic-labs/types": "4.61.
|
|
27
|
-
"@dynamic-labs/utils": "4.61.
|
|
28
|
-
"@dynamic-labs/wallet-book": "4.61.
|
|
29
|
-
"@dynamic-labs/wallet-connector-core": "4.61.
|
|
19
|
+
"@dynamic-labs/assert-package-version": "4.61.1",
|
|
20
|
+
"@dynamic-labs/iconic": "4.61.1",
|
|
21
|
+
"@dynamic-labs/locale": "4.61.1",
|
|
22
|
+
"@dynamic-labs/logger": "4.61.1",
|
|
23
|
+
"@dynamic-labs/multi-wallet": "4.61.1",
|
|
24
|
+
"@dynamic-labs/rpc-providers": "4.61.1",
|
|
25
|
+
"@dynamic-labs/store": "4.61.1",
|
|
26
|
+
"@dynamic-labs/types": "4.61.1",
|
|
27
|
+
"@dynamic-labs/utils": "4.61.1",
|
|
28
|
+
"@dynamic-labs/wallet-book": "4.61.1",
|
|
29
|
+
"@dynamic-labs/wallet-connector-core": "4.61.1",
|
|
30
30
|
"eventemitter3": "5.0.1"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
@@ -30,6 +30,7 @@ require('@dynamic-labs-sdk/client/core');
|
|
|
30
30
|
require('../../client/client.cjs');
|
|
31
31
|
require('@dynamic-labs-sdk/client');
|
|
32
32
|
require('../../config/ApiEndpoint.cjs');
|
|
33
|
+
var useProjectSettings = require('../../client/extension/projectSettings/useProjectSettings/useProjectSettings.cjs');
|
|
33
34
|
require('@dynamic-labs/locale');
|
|
34
35
|
var blockaid = require('../../data/api/transactions/blockaid.cjs');
|
|
35
36
|
require('../../store/state/dynamicContextProps/dynamicContextProps.cjs');
|
|
@@ -129,7 +130,10 @@ var SimulationStatus;
|
|
|
129
130
|
SimulationStatus["SUCCESS"] = "success";
|
|
130
131
|
})(SimulationStatus || (SimulationStatus = {}));
|
|
131
132
|
const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation, onClickBack, walletConnector, onClickClose, title, displayPoweredByDynamicFooter = false, copykey, hideModal, currentToken, isNativeToken, transactionValue, isModal, sendBalanceTransaction, }) => {
|
|
133
|
+
var _a, _b, _c;
|
|
132
134
|
const { primaryWallet, environmentId } = useInternalDynamicContext.useInternalDynamicContext();
|
|
135
|
+
const projectSettings = useProjectSettings.useProjectSettings();
|
|
136
|
+
const svmGasSponsorshipEnabled = (_c = (_b = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _a === void 0 ? void 0 : _a.embeddedWallets) === null || _b === void 0 ? void 0 : _b.svmGasSponsorshipEnabled) !== null && _c !== void 0 ? _c : false;
|
|
133
137
|
const [isGasSponsored, setIsGasSponsored] = React.useState(false);
|
|
134
138
|
const [isGasSponsoredLoading, setIsGasSponsoredLoading] = React.useState(false);
|
|
135
139
|
const update = useForceUpdate.useForceUpdate();
|
|
@@ -149,7 +153,7 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
|
|
|
149
153
|
const [recipient, setRecipient] = React.useState(undefined);
|
|
150
154
|
const isFetchingSimulationRef = React.useRef(false);
|
|
151
155
|
const fetchSimulationResult = React.useCallback(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
152
|
-
var
|
|
156
|
+
var _d, _e, _f, _g, _h, _j, _k;
|
|
153
157
|
if (simulationState.status !== SimulationStatus.LOADING) {
|
|
154
158
|
return;
|
|
155
159
|
}
|
|
@@ -187,19 +191,19 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
|
|
|
187
191
|
const formattedUserOperation = yield connector.formatUserOperation(userOperation);
|
|
188
192
|
// Set the gas fee on the transaction, only for zero dev
|
|
189
193
|
transaction.fee.gas = calculateGasUnits(userOperation);
|
|
190
|
-
const entryPoint = yield ((
|
|
194
|
+
const entryPoint = yield ((_d = connector.getAccountAbstractionProvider()) === null || _d === void 0 ? void 0 : _d.account.entryPoint);
|
|
191
195
|
if (!entryPoint) {
|
|
192
196
|
logger.logger.error('[TransactionConfirmationView] Simulation failed: No entry point address found');
|
|
193
197
|
setSimulationState({ status: SimulationStatus.FAILED });
|
|
194
198
|
return;
|
|
195
199
|
}
|
|
196
|
-
setRecipient((
|
|
200
|
+
setRecipient((_e = transaction === null || transaction === void 0 ? void 0 : transaction.getTransactionRecipient) === null || _e === void 0 ? void 0 : _e.call(transaction));
|
|
197
201
|
result = yield blockaid.simulateBlockaidUserOperation({
|
|
198
202
|
chainId: String(chainId),
|
|
199
203
|
entryPoint,
|
|
200
204
|
environmentId,
|
|
201
205
|
userOperation: formattedUserOperation,
|
|
202
|
-
value: ((
|
|
206
|
+
value: ((_f = transaction.value) === null || _f === void 0 ? void 0 : _f.toString()) || '0',
|
|
203
207
|
});
|
|
204
208
|
}
|
|
205
209
|
else {
|
|
@@ -210,7 +214,7 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
|
|
|
210
214
|
else {
|
|
211
215
|
// Handle SOLANA
|
|
212
216
|
if ((walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.connectedChain) === 'SOL') {
|
|
213
|
-
const encodedTransactions = (
|
|
217
|
+
const encodedTransactions = (_g = transaction.multipleTransactions) === null || _g === void 0 ? void 0 : _g.map((tx) => bs58__default["default"].encode(tx.serialize({ requireAllSignatures: false })));
|
|
214
218
|
if (!encodedTransactions) {
|
|
215
219
|
logger.logger.error('[TransactionConfirmationView] Simulation failed: No encoded transactions');
|
|
216
220
|
setSimulationState({ status: SimulationStatus.FAILED });
|
|
@@ -224,7 +228,7 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
|
|
|
224
228
|
});
|
|
225
229
|
}
|
|
226
230
|
else if ((walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.connectedChain) === 'EVM') {
|
|
227
|
-
setRecipient((
|
|
231
|
+
setRecipient((_h = transaction === null || transaction === void 0 ? void 0 : transaction.getTransactionRecipient) === null || _h === void 0 ? void 0 : _h.call(transaction));
|
|
228
232
|
// EVM
|
|
229
233
|
result = yield blockaid.simulateBlockaidEVMTransaction({
|
|
230
234
|
chainId: String(chainId),
|
|
@@ -232,7 +236,7 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
|
|
|
232
236
|
environmentId,
|
|
233
237
|
from: transaction.from,
|
|
234
238
|
to: transaction.to || '',
|
|
235
|
-
value: ((
|
|
239
|
+
value: ((_j = transaction.value) === null || _j === void 0 ? void 0 : _j.toString()) || '0',
|
|
236
240
|
});
|
|
237
241
|
}
|
|
238
242
|
else if ((walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.connectedChain) === 'TON') {
|
|
@@ -240,7 +244,7 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
|
|
|
240
244
|
return;
|
|
241
245
|
}
|
|
242
246
|
}
|
|
243
|
-
if (!result && ((
|
|
247
|
+
if (!result && ((_k = primaryWallet.connector) === null || _k === void 0 ? void 0 : _k.key) !== 'zerodev') {
|
|
244
248
|
logger.logger.warn('[TransactionConfirmationView] Simulation failed: No result');
|
|
245
249
|
setSimulationState({ status: SimulationStatus.FAILED });
|
|
246
250
|
return;
|
|
@@ -293,13 +297,19 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
|
|
|
293
297
|
}
|
|
294
298
|
}, [primaryWallet, transaction, update]);
|
|
295
299
|
React.useEffect(() => {
|
|
300
|
+
// If SVM gas sponsorship is enabled in project settings, treat as sponsored
|
|
301
|
+
// before the fee payer is actually replaced (which happens at send time)
|
|
302
|
+
if (svmGasSponsorshipEnabled && (walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.connectedChain) === 'SOL') {
|
|
303
|
+
setIsGasSponsored(true);
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
296
306
|
// Solana gas sponsorship check
|
|
297
307
|
// Only set for transactions that implement isGasSponsored (Solana)
|
|
298
308
|
// ZeroDev/EVM transactions handle sponsorship via fetchSimulationResult
|
|
299
309
|
if (transaction.isGasSponsored) {
|
|
300
310
|
setIsGasSponsored(transaction.isGasSponsored());
|
|
301
311
|
}
|
|
302
|
-
}, [transaction]);
|
|
312
|
+
}, [transaction, svmGasSponsorshipEnabled, walletConnector]);
|
|
303
313
|
const { mutate: send, isLoading, error: transactionError, } = useMutation.useMutation(mutation, {
|
|
304
314
|
onFailure: React.useCallback((error) => {
|
|
305
315
|
fetchTransactionFee();
|
|
@@ -26,6 +26,7 @@ import '@dynamic-labs-sdk/client/core';
|
|
|
26
26
|
import '../../client/client.js';
|
|
27
27
|
import '@dynamic-labs-sdk/client';
|
|
28
28
|
import '../../config/ApiEndpoint.js';
|
|
29
|
+
import { useProjectSettings } from '../../client/extension/projectSettings/useProjectSettings/useProjectSettings.js';
|
|
29
30
|
import '@dynamic-labs/locale';
|
|
30
31
|
import { simulateBlockaidUserOperation, simulateBlockaidSVMTransaction, simulateBlockaidEVMTransaction } from '../../data/api/transactions/blockaid.js';
|
|
31
32
|
import '../../store/state/dynamicContextProps/dynamicContextProps.js';
|
|
@@ -121,7 +122,10 @@ var SimulationStatus;
|
|
|
121
122
|
SimulationStatus["SUCCESS"] = "success";
|
|
122
123
|
})(SimulationStatus || (SimulationStatus = {}));
|
|
123
124
|
const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation, onClickBack, walletConnector, onClickClose, title, displayPoweredByDynamicFooter = false, copykey, hideModal, currentToken, isNativeToken, transactionValue, isModal, sendBalanceTransaction, }) => {
|
|
125
|
+
var _a, _b, _c;
|
|
124
126
|
const { primaryWallet, environmentId } = useInternalDynamicContext();
|
|
127
|
+
const projectSettings = useProjectSettings();
|
|
128
|
+
const svmGasSponsorshipEnabled = (_c = (_b = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _a === void 0 ? void 0 : _a.embeddedWallets) === null || _b === void 0 ? void 0 : _b.svmGasSponsorshipEnabled) !== null && _c !== void 0 ? _c : false;
|
|
125
129
|
const [isGasSponsored, setIsGasSponsored] = useState(false);
|
|
126
130
|
const [isGasSponsoredLoading, setIsGasSponsoredLoading] = useState(false);
|
|
127
131
|
const update = useForceUpdate();
|
|
@@ -141,7 +145,7 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
|
|
|
141
145
|
const [recipient, setRecipient] = useState(undefined);
|
|
142
146
|
const isFetchingSimulationRef = useRef(false);
|
|
143
147
|
const fetchSimulationResult = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
144
|
-
var
|
|
148
|
+
var _d, _e, _f, _g, _h, _j, _k;
|
|
145
149
|
if (simulationState.status !== SimulationStatus.LOADING) {
|
|
146
150
|
return;
|
|
147
151
|
}
|
|
@@ -179,19 +183,19 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
|
|
|
179
183
|
const formattedUserOperation = yield connector.formatUserOperation(userOperation);
|
|
180
184
|
// Set the gas fee on the transaction, only for zero dev
|
|
181
185
|
transaction.fee.gas = calculateGasUnits(userOperation);
|
|
182
|
-
const entryPoint = yield ((
|
|
186
|
+
const entryPoint = yield ((_d = connector.getAccountAbstractionProvider()) === null || _d === void 0 ? void 0 : _d.account.entryPoint);
|
|
183
187
|
if (!entryPoint) {
|
|
184
188
|
logger.error('[TransactionConfirmationView] Simulation failed: No entry point address found');
|
|
185
189
|
setSimulationState({ status: SimulationStatus.FAILED });
|
|
186
190
|
return;
|
|
187
191
|
}
|
|
188
|
-
setRecipient((
|
|
192
|
+
setRecipient((_e = transaction === null || transaction === void 0 ? void 0 : transaction.getTransactionRecipient) === null || _e === void 0 ? void 0 : _e.call(transaction));
|
|
189
193
|
result = yield simulateBlockaidUserOperation({
|
|
190
194
|
chainId: String(chainId),
|
|
191
195
|
entryPoint,
|
|
192
196
|
environmentId,
|
|
193
197
|
userOperation: formattedUserOperation,
|
|
194
|
-
value: ((
|
|
198
|
+
value: ((_f = transaction.value) === null || _f === void 0 ? void 0 : _f.toString()) || '0',
|
|
195
199
|
});
|
|
196
200
|
}
|
|
197
201
|
else {
|
|
@@ -202,7 +206,7 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
|
|
|
202
206
|
else {
|
|
203
207
|
// Handle SOLANA
|
|
204
208
|
if ((walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.connectedChain) === 'SOL') {
|
|
205
|
-
const encodedTransactions = (
|
|
209
|
+
const encodedTransactions = (_g = transaction.multipleTransactions) === null || _g === void 0 ? void 0 : _g.map((tx) => bs58.encode(tx.serialize({ requireAllSignatures: false })));
|
|
206
210
|
if (!encodedTransactions) {
|
|
207
211
|
logger.error('[TransactionConfirmationView] Simulation failed: No encoded transactions');
|
|
208
212
|
setSimulationState({ status: SimulationStatus.FAILED });
|
|
@@ -216,7 +220,7 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
|
|
|
216
220
|
});
|
|
217
221
|
}
|
|
218
222
|
else if ((walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.connectedChain) === 'EVM') {
|
|
219
|
-
setRecipient((
|
|
223
|
+
setRecipient((_h = transaction === null || transaction === void 0 ? void 0 : transaction.getTransactionRecipient) === null || _h === void 0 ? void 0 : _h.call(transaction));
|
|
220
224
|
// EVM
|
|
221
225
|
result = yield simulateBlockaidEVMTransaction({
|
|
222
226
|
chainId: String(chainId),
|
|
@@ -224,7 +228,7 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
|
|
|
224
228
|
environmentId,
|
|
225
229
|
from: transaction.from,
|
|
226
230
|
to: transaction.to || '',
|
|
227
|
-
value: ((
|
|
231
|
+
value: ((_j = transaction.value) === null || _j === void 0 ? void 0 : _j.toString()) || '0',
|
|
228
232
|
});
|
|
229
233
|
}
|
|
230
234
|
else if ((walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.connectedChain) === 'TON') {
|
|
@@ -232,7 +236,7 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
|
|
|
232
236
|
return;
|
|
233
237
|
}
|
|
234
238
|
}
|
|
235
|
-
if (!result && ((
|
|
239
|
+
if (!result && ((_k = primaryWallet.connector) === null || _k === void 0 ? void 0 : _k.key) !== 'zerodev') {
|
|
236
240
|
logger.warn('[TransactionConfirmationView] Simulation failed: No result');
|
|
237
241
|
setSimulationState({ status: SimulationStatus.FAILED });
|
|
238
242
|
return;
|
|
@@ -285,13 +289,19 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
|
|
|
285
289
|
}
|
|
286
290
|
}, [primaryWallet, transaction, update]);
|
|
287
291
|
useEffect(() => {
|
|
292
|
+
// If SVM gas sponsorship is enabled in project settings, treat as sponsored
|
|
293
|
+
// before the fee payer is actually replaced (which happens at send time)
|
|
294
|
+
if (svmGasSponsorshipEnabled && (walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.connectedChain) === 'SOL') {
|
|
295
|
+
setIsGasSponsored(true);
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
288
298
|
// Solana gas sponsorship check
|
|
289
299
|
// Only set for transactions that implement isGasSponsored (Solana)
|
|
290
300
|
// ZeroDev/EVM transactions handle sponsorship via fetchSimulationResult
|
|
291
301
|
if (transaction.isGasSponsored) {
|
|
292
302
|
setIsGasSponsored(transaction.isGasSponsored());
|
|
293
303
|
}
|
|
294
|
-
}, [transaction]);
|
|
304
|
+
}, [transaction, svmGasSponsorshipEnabled, walletConnector]);
|
|
295
305
|
const { mutate: send, isLoading, error: transactionError, } = useMutation(mutation, {
|
|
296
306
|
onFailure: useCallback((error) => {
|
|
297
307
|
fetchTransactionFee();
|