@dynamic-labs/sdk-react-core 4.0.0-alpha.31 → 4.0.0-alpha.32
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 +8 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +11 -11
- package/src/lib/components/TransactionCard/TransactionCard.cjs +2 -1
- package/src/lib/components/TransactionCard/TransactionCard.js +2 -1
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.cjs +25 -13
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.js +26 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
|
|
2
|
+
## [4.0.0-alpha.32](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.31...v4.0.0-alpha.32) (2024-11-13)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* **client:** convert the wallet when using wallets.embedded.getWallet ([#7430](https://github.com/dynamic-labs/dynamic-auth/issues/7430)) ([f852a09](https://github.com/dynamic-labs/dynamic-auth/commit/f852a09695141389c275d1ca27c26595a78d8051))
|
|
8
|
+
* refresh blockhash for solana embedded and use confirmed commitment ([#7425](https://github.com/dynamic-labs/dynamic-auth/issues/7425)) ([25b4169](https://github.com/dynamic-labs/dynamic-auth/commit/25b4169950b32619731f10f3372f80e71ede4ae5))
|
|
9
|
+
|
|
2
10
|
## [4.0.0-alpha.31](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.30...v4.0.0-alpha.31) (2024-11-13)
|
|
3
11
|
|
|
4
12
|
|
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.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.32",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@dynamic-labs/sdk-api-core": "0.0.563",
|
|
6
6
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
|
@@ -13,16 +13,16 @@
|
|
|
13
13
|
"react-i18next": "13.5.0",
|
|
14
14
|
"yup": "0.32.11",
|
|
15
15
|
"react-international-phone": "4.2.5",
|
|
16
|
-
"@dynamic-labs/assert-package-version": "4.0.0-alpha.
|
|
17
|
-
"@dynamic-labs/iconic": "4.0.0-alpha.
|
|
18
|
-
"@dynamic-labs/logger": "4.0.0-alpha.
|
|
19
|
-
"@dynamic-labs/multi-wallet": "4.0.0-alpha.
|
|
20
|
-
"@dynamic-labs/rpc-providers": "4.0.0-alpha.
|
|
21
|
-
"@dynamic-labs/store": "4.0.0-alpha.
|
|
22
|
-
"@dynamic-labs/types": "4.0.0-alpha.
|
|
23
|
-
"@dynamic-labs/utils": "4.0.0-alpha.
|
|
24
|
-
"@dynamic-labs/wallet-book": "4.0.0-alpha.
|
|
25
|
-
"@dynamic-labs/wallet-connector-core": "4.0.0-alpha.
|
|
16
|
+
"@dynamic-labs/assert-package-version": "4.0.0-alpha.32",
|
|
17
|
+
"@dynamic-labs/iconic": "4.0.0-alpha.32",
|
|
18
|
+
"@dynamic-labs/logger": "4.0.0-alpha.32",
|
|
19
|
+
"@dynamic-labs/multi-wallet": "4.0.0-alpha.32",
|
|
20
|
+
"@dynamic-labs/rpc-providers": "4.0.0-alpha.32",
|
|
21
|
+
"@dynamic-labs/store": "4.0.0-alpha.32",
|
|
22
|
+
"@dynamic-labs/types": "4.0.0-alpha.32",
|
|
23
|
+
"@dynamic-labs/utils": "4.0.0-alpha.32",
|
|
24
|
+
"@dynamic-labs/wallet-book": "4.0.0-alpha.32",
|
|
25
|
+
"@dynamic-labs/wallet-connector-core": "4.0.0-alpha.32",
|
|
26
26
|
"bs58": "5.0.0",
|
|
27
27
|
"eventemitter3": "5.0.1"
|
|
28
28
|
},
|
|
@@ -110,7 +110,8 @@ const TransactionCard = ({ transaction, simulationResult, isGasSponsored, }) =>
|
|
|
110
110
|
const renderAssetTransfer = (transfer, index, array) => {
|
|
111
111
|
var _a, _b;
|
|
112
112
|
if (transfer.asset.type === 'NATIVE' &&
|
|
113
|
-
transfer.asset.chainName === 'Solana'
|
|
113
|
+
transfer.asset.chainName === 'Solana' &&
|
|
114
|
+
transaction.fee.gas) {
|
|
114
115
|
transfer.amount = (Number(transfer.amount) -
|
|
115
116
|
Number(transaction.fee.gas) / Math.pow(10, 9)).toString();
|
|
116
117
|
}
|
|
@@ -102,7 +102,8 @@ const TransactionCard = ({ transaction, simulationResult, isGasSponsored, }) =>
|
|
|
102
102
|
const renderAssetTransfer = (transfer, index, array) => {
|
|
103
103
|
var _a, _b;
|
|
104
104
|
if (transfer.asset.type === 'NATIVE' &&
|
|
105
|
-
transfer.asset.chainName === 'Solana'
|
|
105
|
+
transfer.asset.chainName === 'Solana' &&
|
|
106
|
+
transaction.fee.gas) {
|
|
106
107
|
transfer.amount = (Number(transfer.amount) -
|
|
107
108
|
Number(transaction.fee.gas) / Math.pow(10, 9)).toString();
|
|
108
109
|
}
|
|
@@ -100,7 +100,6 @@ var bs58__default = /*#__PURE__*/_interopDefaultLegacy(bs58);
|
|
|
100
100
|
|
|
101
101
|
const FEE_REFRESH_INTERVAL = 20000;
|
|
102
102
|
const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation, onClickBack, walletConnector, onClickClose, title, displayPoweredByDynamicFooter = false, copykey, hideModal, currentToken, isNativeToken, transactionValue, isModal, sendBalanceTransaction, }) => {
|
|
103
|
-
var _a, _b;
|
|
104
103
|
const { primaryWallet, environmentId } = useInternalDynamicContext.useInternalDynamicContext();
|
|
105
104
|
const [isGasSponsored, setIsGasSponsored] = React.useState(false);
|
|
106
105
|
const update = useForceUpdate.useForceUpdate();
|
|
@@ -189,10 +188,13 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
|
|
|
189
188
|
}
|
|
190
189
|
},
|
|
191
190
|
});
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
191
|
+
React.useEffect(() => {
|
|
192
|
+
var _a;
|
|
193
|
+
// solana gas sponsorship check
|
|
194
|
+
if ((_a = transaction.isGasSponsored) === null || _a === void 0 ? void 0 : _a.call(transaction)) {
|
|
195
|
+
setIsGasSponsored(true);
|
|
196
|
+
}
|
|
197
|
+
}, [transaction]);
|
|
196
198
|
const { mutate: send, isLoading, error: transactionError, } = useMutation.useMutation(mutation, {
|
|
197
199
|
onFailure: (error) => {
|
|
198
200
|
fetchTransactionFee();
|
|
@@ -270,17 +272,27 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
|
|
|
270
272
|
isLoading,
|
|
271
273
|
simulationResult,
|
|
272
274
|
]);
|
|
275
|
+
React.useEffect(() => {
|
|
276
|
+
var _a;
|
|
277
|
+
if (isSimulationComplete && !sendBalanceTransaction) {
|
|
278
|
+
// if simulation threw an error, or if there are no out assets for solana (which means the simulation failed)
|
|
279
|
+
if (!simulationResult ||
|
|
280
|
+
(simulationResult.outAssets.length === 0 &&
|
|
281
|
+
!chainId &&
|
|
282
|
+
!((_a = transaction.isGasSponsored) === null || _a === void 0 ? void 0 : _a.call(transaction)))) {
|
|
283
|
+
transaction.simulationFailed = true;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}, [
|
|
287
|
+
simulationResult,
|
|
288
|
+
chainId,
|
|
289
|
+
transaction,
|
|
290
|
+
sendBalanceTransaction,
|
|
291
|
+
isSimulationComplete,
|
|
292
|
+
]);
|
|
273
293
|
if (!isSimulationComplete) {
|
|
274
294
|
return null;
|
|
275
295
|
}
|
|
276
|
-
// if simulation threw an error, or if there are no out assets for solana (which means the simulation failed)
|
|
277
|
-
if ((!simulationResult ||
|
|
278
|
-
(!simulationResult.outAssets.length &&
|
|
279
|
-
!chainId &&
|
|
280
|
-
!((_b = transaction.isGasSponsored) === null || _b === void 0 ? void 0 : _b.call(transaction)))) &&
|
|
281
|
-
!sendBalanceTransaction) {
|
|
282
|
-
transaction.simulationFailed = true;
|
|
283
|
-
}
|
|
284
296
|
return (jsxRuntime.jsx(TransactionConfirmationPageLayout.TransactionConfirmationPageLayout, { total: total, currentToken: currentToken, transactionValue: transactionValue, isNativeToken: isNativeToken, onClickBack: onClickBack, onClickClose: onClickClose, copykey: copykey, title: title, hideModal: hideModal, isLoading: isLoading, onClickSend: () => send(), onSuccess: (tx) => onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(tx), displayPoweredByDynamicFooter: displayPoweredByDynamicFooter, disableSendButton: isBalanceLoading, error: errorMessage, alert: alert, walletConnector: walletConnector, transaction: transaction, isGasSponsored: isGasSponsored, isGasSponsoredLoading: isGasSponsoredLoading, walletKey: (primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.key) || '', simulationResult: simulationResult, sendBalanceTransaction: sendBalanceTransaction }));
|
|
285
297
|
};
|
|
286
298
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { __awaiter } from '../../../../_virtual/_tslib.js';
|
|
3
3
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
4
|
-
import { useState, useMemo } from 'react';
|
|
4
|
+
import { useState, useMemo, useEffect } from 'react';
|
|
5
5
|
import { useTranslation } from 'react-i18next';
|
|
6
6
|
import bs58 from 'bs58';
|
|
7
7
|
import { TransactionGasCannotBeSponsoredError } from '@dynamic-labs/utils';
|
|
@@ -92,7 +92,6 @@ import { useInternalDynamicContext } from '../../context/DynamicContext/useDynam
|
|
|
92
92
|
|
|
93
93
|
const FEE_REFRESH_INTERVAL = 20000;
|
|
94
94
|
const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation, onClickBack, walletConnector, onClickClose, title, displayPoweredByDynamicFooter = false, copykey, hideModal, currentToken, isNativeToken, transactionValue, isModal, sendBalanceTransaction, }) => {
|
|
95
|
-
var _a, _b;
|
|
96
95
|
const { primaryWallet, environmentId } = useInternalDynamicContext();
|
|
97
96
|
const [isGasSponsored, setIsGasSponsored] = useState(false);
|
|
98
97
|
const update = useForceUpdate();
|
|
@@ -181,10 +180,13 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
|
|
|
181
180
|
}
|
|
182
181
|
},
|
|
183
182
|
});
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
183
|
+
useEffect(() => {
|
|
184
|
+
var _a;
|
|
185
|
+
// solana gas sponsorship check
|
|
186
|
+
if ((_a = transaction.isGasSponsored) === null || _a === void 0 ? void 0 : _a.call(transaction)) {
|
|
187
|
+
setIsGasSponsored(true);
|
|
188
|
+
}
|
|
189
|
+
}, [transaction]);
|
|
188
190
|
const { mutate: send, isLoading, error: transactionError, } = useMutation(mutation, {
|
|
189
191
|
onFailure: (error) => {
|
|
190
192
|
fetchTransactionFee();
|
|
@@ -262,17 +264,27 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
|
|
|
262
264
|
isLoading,
|
|
263
265
|
simulationResult,
|
|
264
266
|
]);
|
|
267
|
+
useEffect(() => {
|
|
268
|
+
var _a;
|
|
269
|
+
if (isSimulationComplete && !sendBalanceTransaction) {
|
|
270
|
+
// if simulation threw an error, or if there are no out assets for solana (which means the simulation failed)
|
|
271
|
+
if (!simulationResult ||
|
|
272
|
+
(simulationResult.outAssets.length === 0 &&
|
|
273
|
+
!chainId &&
|
|
274
|
+
!((_a = transaction.isGasSponsored) === null || _a === void 0 ? void 0 : _a.call(transaction)))) {
|
|
275
|
+
transaction.simulationFailed = true;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}, [
|
|
279
|
+
simulationResult,
|
|
280
|
+
chainId,
|
|
281
|
+
transaction,
|
|
282
|
+
sendBalanceTransaction,
|
|
283
|
+
isSimulationComplete,
|
|
284
|
+
]);
|
|
265
285
|
if (!isSimulationComplete) {
|
|
266
286
|
return null;
|
|
267
287
|
}
|
|
268
|
-
// if simulation threw an error, or if there are no out assets for solana (which means the simulation failed)
|
|
269
|
-
if ((!simulationResult ||
|
|
270
|
-
(!simulationResult.outAssets.length &&
|
|
271
|
-
!chainId &&
|
|
272
|
-
!((_b = transaction.isGasSponsored) === null || _b === void 0 ? void 0 : _b.call(transaction)))) &&
|
|
273
|
-
!sendBalanceTransaction) {
|
|
274
|
-
transaction.simulationFailed = true;
|
|
275
|
-
}
|
|
276
288
|
return (jsx(TransactionConfirmationPageLayout, { total: total, currentToken: currentToken, transactionValue: transactionValue, isNativeToken: isNativeToken, onClickBack: onClickBack, onClickClose: onClickClose, copykey: copykey, title: title, hideModal: hideModal, isLoading: isLoading, onClickSend: () => send(), onSuccess: (tx) => onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(tx), displayPoweredByDynamicFooter: displayPoweredByDynamicFooter, disableSendButton: isBalanceLoading, error: errorMessage, alert: alert, walletConnector: walletConnector, transaction: transaction, isGasSponsored: isGasSponsored, isGasSponsoredLoading: isGasSponsoredLoading, walletKey: (primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.key) || '', simulationResult: simulationResult, sendBalanceTransaction: sendBalanceTransaction }));
|
|
277
289
|
};
|
|
278
290
|
|