@dynamic-labs/sdk-react-core 4.9.11 → 4.9.12
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 +10 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +11 -11
- package/src/lib/context/ErrorContext/hooks/useErrorText/useErrorText.cjs +1 -0
- package/src/lib/context/ErrorContext/hooks/useErrorText/useErrorText.js +1 -0
- package/src/lib/locale/en/translation.cjs +6 -1
- package/src/lib/locale/en/translation.d.ts +6 -1
- package/src/lib/locale/en/translation.js +6 -1
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.cjs +6 -1
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.js +7 -2
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.cjs +0 -1
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.js +0 -1
- package/src/lib/views/SendBalanceView/SendBalanceView.cjs +6 -12
- package/src/lib/views/SendBalanceView/SendBalanceView.js +6 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
|
|
2
|
+
### [4.9.12](https://github.com/dynamic-labs/dynamic-auth/compare/v4.9.11...v4.9.12) (2025-03-28)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* prevent event subscription from throwing a page error ([#8393](https://github.com/dynamic-labs/dynamic-auth/issues/8393)) ([eda85cd](https://github.com/dynamic-labs/dynamic-auth/commit/eda85cdeed4cc208e20618882cf3e5a54b176356))
|
|
8
|
+
* global wallet popup in rainbowkit reopening ([#8395](https://github.com/dynamic-labs/dynamic-auth/issues/8395)) ([5473e87](https://github.com/dynamic-labs/dynamic-auth/commit/5473e87834c5a2102f7d87fc649590726bc390c7))
|
|
9
|
+
* notify user when sei is not enable in keplr ([#8396](https://github.com/dynamic-labs/dynamic-auth/issues/8396)) ([79aea59](https://github.com/dynamic-labs/dynamic-auth/commit/79aea59bde82dabbe070a1f0fc5ac484a696e7ac))
|
|
10
|
+
* respect tokenBalance order from backend for SendBalance view ([#8398](https://github.com/dynamic-labs/dynamic-auth/issues/8398)) ([fdb0e1c](https://github.com/dynamic-labs/dynamic-auth/commit/fdb0e1cc2f1614326f506dfdb1726f4c5baf9c0c))
|
|
11
|
+
|
|
2
12
|
### [4.9.11](https://github.com/dynamic-labs/dynamic-auth/compare/v4.9.10...v4.9.11) (2025-03-26)
|
|
3
13
|
|
|
4
14
|
|
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.9.
|
|
3
|
+
"version": "4.9.12",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@dynamic-labs/sdk-api-core": "0.0.644",
|
|
6
6
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
|
@@ -14,16 +14,16 @@
|
|
|
14
14
|
"yup": "0.32.11",
|
|
15
15
|
"react-international-phone": "4.2.5",
|
|
16
16
|
"bs58": "5.0.0",
|
|
17
|
-
"@dynamic-labs/assert-package-version": "4.9.
|
|
18
|
-
"@dynamic-labs/iconic": "4.9.
|
|
19
|
-
"@dynamic-labs/logger": "4.9.
|
|
20
|
-
"@dynamic-labs/multi-wallet": "4.9.
|
|
21
|
-
"@dynamic-labs/rpc-providers": "4.9.
|
|
22
|
-
"@dynamic-labs/store": "4.9.
|
|
23
|
-
"@dynamic-labs/types": "4.9.
|
|
24
|
-
"@dynamic-labs/utils": "4.9.
|
|
25
|
-
"@dynamic-labs/wallet-book": "4.9.
|
|
26
|
-
"@dynamic-labs/wallet-connector-core": "4.9.
|
|
17
|
+
"@dynamic-labs/assert-package-version": "4.9.12",
|
|
18
|
+
"@dynamic-labs/iconic": "4.9.12",
|
|
19
|
+
"@dynamic-labs/logger": "4.9.12",
|
|
20
|
+
"@dynamic-labs/multi-wallet": "4.9.12",
|
|
21
|
+
"@dynamic-labs/rpc-providers": "4.9.12",
|
|
22
|
+
"@dynamic-labs/store": "4.9.12",
|
|
23
|
+
"@dynamic-labs/types": "4.9.12",
|
|
24
|
+
"@dynamic-labs/utils": "4.9.12",
|
|
25
|
+
"@dynamic-labs/wallet-book": "4.9.12",
|
|
26
|
+
"@dynamic-labs/wallet-connector-core": "4.9.12",
|
|
27
27
|
"eventemitter3": "5.0.1"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
@@ -20,6 +20,7 @@ const mapErrorCodeToTranslation = {
|
|
|
20
20
|
[utils.ErrorCode.CONNECTION_REJECTED]: 'dyn_error.connection_rejected',
|
|
21
21
|
[utils.ErrorCode.MISSING_PUBLIC_ADDRESS]: 'dyn_error.missing_public_address',
|
|
22
22
|
[utils.ErrorCode.CONNECTION_PROPOSAL_EXPIRED]: 'dyn_error.connection_proposal_expired',
|
|
23
|
+
[utils.ErrorCode.SEI_NOT_ENABLED_IN_KEPLR_WALLET]: 'dyn_error.sei_not_enabled_in_keplr_wallet',
|
|
23
24
|
};
|
|
24
25
|
/** A hook that listens to the error context and returns a translated value */
|
|
25
26
|
const useErrorText = () => {
|
|
@@ -16,6 +16,7 @@ const mapErrorCodeToTranslation = {
|
|
|
16
16
|
[ErrorCode.CONNECTION_REJECTED]: 'dyn_error.connection_rejected',
|
|
17
17
|
[ErrorCode.MISSING_PUBLIC_ADDRESS]: 'dyn_error.missing_public_address',
|
|
18
18
|
[ErrorCode.CONNECTION_PROPOSAL_EXPIRED]: 'dyn_error.connection_proposal_expired',
|
|
19
|
+
[ErrorCode.SEI_NOT_ENABLED_IN_KEPLR_WALLET]: 'dyn_error.sei_not_enabled_in_keplr_wallet',
|
|
19
20
|
};
|
|
20
21
|
/** A hook that listens to the error context and returns a translated value */
|
|
21
22
|
const useErrorText = () => {
|
|
@@ -2360,7 +2360,7 @@ const translation = {
|
|
|
2360
2360
|
* {
|
|
2361
2361
|
success: 'Transaction processing',
|
|
2362
2362
|
success_txn_link: 'View transaction',
|
|
2363
|
-
|
|
2363
|
+
|
|
2364
2364
|
funding_method_selection: {
|
|
2365
2365
|
title: 'Deposit',
|
|
2366
2366
|
qr_option: 'Receive by QR',
|
|
@@ -2467,6 +2467,10 @@ const translation = {
|
|
|
2467
2467
|
'This social account is already linked to a different profile.',
|
|
2468
2468
|
connection_rejected: 'Connection rejected. Please try again.',
|
|
2469
2469
|
missing_public_address: 'Connection cancelled. Please try again',
|
|
2470
|
+
connection_proposal_expired:
|
|
2471
|
+
'Connection proposal expired. Please try again.',
|
|
2472
|
+
sei_not_enabled_in_keplr_wallet:
|
|
2473
|
+
'Sei network is not enabled in Keplr. Please enable it and try again.',
|
|
2470
2474
|
}
|
|
2471
2475
|
*/
|
|
2472
2476
|
dyn_error: {
|
|
@@ -2480,6 +2484,7 @@ const translation = {
|
|
|
2480
2484
|
connection_rejected: 'Connection rejected. Please try again.',
|
|
2481
2485
|
missing_public_address: 'Connection cancelled. Please try again',
|
|
2482
2486
|
connection_proposal_expired: 'Connection proposal expired. Please try again.',
|
|
2487
|
+
sei_not_enabled_in_keplr_wallet: 'Sei network is not enabled in Keplr. Please enable it and try again.',
|
|
2483
2488
|
},
|
|
2484
2489
|
};
|
|
2485
2490
|
|
|
@@ -2356,7 +2356,7 @@ export declare const translation: {
|
|
|
2356
2356
|
* {
|
|
2357
2357
|
success: 'Transaction processing',
|
|
2358
2358
|
success_txn_link: 'View transaction',
|
|
2359
|
-
|
|
2359
|
+
|
|
2360
2360
|
funding_method_selection: {
|
|
2361
2361
|
title: 'Deposit',
|
|
2362
2362
|
qr_option: 'Receive by QR',
|
|
@@ -2463,6 +2463,10 @@ export declare const translation: {
|
|
|
2463
2463
|
'This social account is already linked to a different profile.',
|
|
2464
2464
|
connection_rejected: 'Connection rejected. Please try again.',
|
|
2465
2465
|
missing_public_address: 'Connection cancelled. Please try again',
|
|
2466
|
+
connection_proposal_expired:
|
|
2467
|
+
'Connection proposal expired. Please try again.',
|
|
2468
|
+
sei_not_enabled_in_keplr_wallet:
|
|
2469
|
+
'Sei network is not enabled in Keplr. Please enable it and try again.',
|
|
2466
2470
|
}
|
|
2467
2471
|
*/
|
|
2468
2472
|
dyn_error: {
|
|
@@ -2476,5 +2480,6 @@ export declare const translation: {
|
|
|
2476
2480
|
connection_rejected: string;
|
|
2477
2481
|
missing_public_address: string;
|
|
2478
2482
|
connection_proposal_expired: string;
|
|
2483
|
+
sei_not_enabled_in_keplr_wallet: string;
|
|
2479
2484
|
};
|
|
2480
2485
|
};
|
|
@@ -2356,7 +2356,7 @@ const translation = {
|
|
|
2356
2356
|
* {
|
|
2357
2357
|
success: 'Transaction processing',
|
|
2358
2358
|
success_txn_link: 'View transaction',
|
|
2359
|
-
|
|
2359
|
+
|
|
2360
2360
|
funding_method_selection: {
|
|
2361
2361
|
title: 'Deposit',
|
|
2362
2362
|
qr_option: 'Receive by QR',
|
|
@@ -2463,6 +2463,10 @@ const translation = {
|
|
|
2463
2463
|
'This social account is already linked to a different profile.',
|
|
2464
2464
|
connection_rejected: 'Connection rejected. Please try again.',
|
|
2465
2465
|
missing_public_address: 'Connection cancelled. Please try again',
|
|
2466
|
+
connection_proposal_expired:
|
|
2467
|
+
'Connection proposal expired. Please try again.',
|
|
2468
|
+
sei_not_enabled_in_keplr_wallet:
|
|
2469
|
+
'Sei network is not enabled in Keplr. Please enable it and try again.',
|
|
2466
2470
|
}
|
|
2467
2471
|
*/
|
|
2468
2472
|
dyn_error: {
|
|
@@ -2476,6 +2480,7 @@ const translation = {
|
|
|
2476
2480
|
connection_rejected: 'Connection rejected. Please try again.',
|
|
2477
2481
|
missing_public_address: 'Connection cancelled. Please try again',
|
|
2478
2482
|
connection_proposal_expired: 'Connection proposal expired. Please try again.',
|
|
2483
|
+
sei_not_enabled_in_keplr_wallet: 'Sei network is not enabled in Keplr. Please enable it and try again.',
|
|
2479
2484
|
},
|
|
2480
2485
|
};
|
|
2481
2486
|
|
|
@@ -133,8 +133,13 @@ const useConnectAndSign = ({ shouldUpdateWallets = true, shouldCallCallback = tr
|
|
|
133
133
|
const userCancelled = (err === null || err === void 0 ? void 0 : err.code) === 'user-cancelled';
|
|
134
134
|
if (!userCancelled)
|
|
135
135
|
logger.logger.debug(err);
|
|
136
|
-
setErrorMessage((_a = err === null || err === void 0 ? void 0 : err.code) === null || _a === void 0 ? void 0 : _a.toString());
|
|
137
136
|
clearStackAndPushInitialView();
|
|
137
|
+
if (err instanceof utils.CustomError) {
|
|
138
|
+
setError(err.message, err.code);
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
setErrorMessage((_a = err === null || err === void 0 ? void 0 : err.code) === null || _a === void 0 ? void 0 : _a.toString());
|
|
142
|
+
}
|
|
138
143
|
};
|
|
139
144
|
const handleWalletConnectionError = (error) => {
|
|
140
145
|
if (error instanceof utils.GetAddressCancelledError) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { __awaiter } from '../../../../../../_virtual/_tslib.js';
|
|
3
|
-
import { StorageService,
|
|
3
|
+
import { StorageService, CustomError, GetAddressCancelledError } from '@dynamic-labs/utils';
|
|
4
4
|
import { isEmailWalletConnector, isEmailOTPWalletConnector, isBloctoConnector } from '@dynamic-labs/wallet-connector-core';
|
|
5
5
|
import { useCaptchaContext } from '../../../../context/CaptchaContext/CaptchaContext.js';
|
|
6
6
|
import 'react';
|
|
@@ -129,8 +129,13 @@ const useConnectAndSign = ({ shouldUpdateWallets = true, shouldCallCallback = tr
|
|
|
129
129
|
const userCancelled = (err === null || err === void 0 ? void 0 : err.code) === 'user-cancelled';
|
|
130
130
|
if (!userCancelled)
|
|
131
131
|
logger.debug(err);
|
|
132
|
-
setErrorMessage((_a = err === null || err === void 0 ? void 0 : err.code) === null || _a === void 0 ? void 0 : _a.toString());
|
|
133
132
|
clearStackAndPushInitialView();
|
|
133
|
+
if (err instanceof CustomError) {
|
|
134
|
+
setError(err.message, err.code);
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
setErrorMessage((_a = err === null || err === void 0 ? void 0 : err.code) === null || _a === void 0 ? void 0 : _a.toString());
|
|
138
|
+
}
|
|
134
139
|
};
|
|
135
140
|
const handleWalletConnectionError = (error) => {
|
|
136
141
|
if (error instanceof GetAddressCancelledError) {
|
|
@@ -126,21 +126,15 @@ const SendBalanceView = ({ initialRecipientAddress = '', initialValue, onClickBa
|
|
|
126
126
|
const { showFiat } = useInternalDynamicContext.useInternalDynamicContext();
|
|
127
127
|
const walletConnector = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector;
|
|
128
128
|
const { chain } = useFetchChain.useFetchChain(walletConnector);
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
: sdkApiCore.ChainEnum.Evm,
|
|
129
|
+
// token balances are ordered in the backend - this should just be a passthrough
|
|
130
|
+
const { tokenBalances: orderedTokenBalances, isLoading } = useTokenBalances.useTokenBalances({
|
|
131
|
+
chainName: (walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.connectedChain) === 'SOL' ? sdkApiCore.ChainEnum.Sol : sdkApiCore.ChainEnum.Evm,
|
|
133
132
|
includeFiat: showFiat,
|
|
134
133
|
includeNativeBalance: true,
|
|
135
134
|
});
|
|
136
135
|
if (!primaryWallet) {
|
|
137
136
|
throw new utils.DynamicError('Primary wallet is not available, send balance cannot be displayed');
|
|
138
137
|
}
|
|
139
|
-
const moveNativeTokenToFirstPosition = (tokenBalances) => {
|
|
140
|
-
const filteredArray = tokenBalances.filter((t) => t.address !== zeroAddress && t.address !== nativeSolanaAddress);
|
|
141
|
-
const nativeToken = tokenBalances.find((t) => usingNative(t));
|
|
142
|
-
return nativeToken ? [nativeToken].concat(filteredArray) : filteredArray;
|
|
143
|
-
};
|
|
144
138
|
if (walletConnector && !walletConnectorCore.isSendBalanceWalletConnector(walletConnector)) {
|
|
145
139
|
throw new utils.DynamicError('Primary wallet is not eligible for this operation. It must implement ISendBalanceWalletConnector');
|
|
146
140
|
}
|
|
@@ -155,9 +149,9 @@ const SendBalanceView = ({ initialRecipientAddress = '', initialValue, onClickBa
|
|
|
155
149
|
};
|
|
156
150
|
}, [chain === null || chain === void 0 ? void 0 : chain.chainId, chain === null || chain === void 0 ? void 0 : chain.name, walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.connectedChain]);
|
|
157
151
|
React.useEffect(() => {
|
|
158
|
-
if (
|
|
159
|
-
setTokenBalances(
|
|
160
|
-
}, [
|
|
152
|
+
if (orderedTokenBalances)
|
|
153
|
+
setTokenBalances(orderedTokenBalances);
|
|
154
|
+
}, [orderedTokenBalances]);
|
|
161
155
|
React.useEffect(() => {
|
|
162
156
|
if (!walletConnector)
|
|
163
157
|
return;
|
|
@@ -122,21 +122,15 @@ const SendBalanceView = ({ initialRecipientAddress = '', initialValue, onClickBa
|
|
|
122
122
|
const { showFiat } = useInternalDynamicContext();
|
|
123
123
|
const walletConnector = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector;
|
|
124
124
|
const { chain } = useFetchChain(walletConnector);
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
: ChainEnum.Evm,
|
|
125
|
+
// token balances are ordered in the backend - this should just be a passthrough
|
|
126
|
+
const { tokenBalances: orderedTokenBalances, isLoading } = useTokenBalances({
|
|
127
|
+
chainName: (walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.connectedChain) === 'SOL' ? ChainEnum.Sol : ChainEnum.Evm,
|
|
129
128
|
includeFiat: showFiat,
|
|
130
129
|
includeNativeBalance: true,
|
|
131
130
|
});
|
|
132
131
|
if (!primaryWallet) {
|
|
133
132
|
throw new DynamicError('Primary wallet is not available, send balance cannot be displayed');
|
|
134
133
|
}
|
|
135
|
-
const moveNativeTokenToFirstPosition = (tokenBalances) => {
|
|
136
|
-
const filteredArray = tokenBalances.filter((t) => t.address !== zeroAddress && t.address !== nativeSolanaAddress);
|
|
137
|
-
const nativeToken = tokenBalances.find((t) => usingNative(t));
|
|
138
|
-
return nativeToken ? [nativeToken].concat(filteredArray) : filteredArray;
|
|
139
|
-
};
|
|
140
134
|
if (walletConnector && !isSendBalanceWalletConnector(walletConnector)) {
|
|
141
135
|
throw new DynamicError('Primary wallet is not eligible for this operation. It must implement ISendBalanceWalletConnector');
|
|
142
136
|
}
|
|
@@ -151,9 +145,9 @@ const SendBalanceView = ({ initialRecipientAddress = '', initialValue, onClickBa
|
|
|
151
145
|
};
|
|
152
146
|
}, [chain === null || chain === void 0 ? void 0 : chain.chainId, chain === null || chain === void 0 ? void 0 : chain.name, walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.connectedChain]);
|
|
153
147
|
useEffect(() => {
|
|
154
|
-
if (
|
|
155
|
-
setTokenBalances(
|
|
156
|
-
}, [
|
|
148
|
+
if (orderedTokenBalances)
|
|
149
|
+
setTokenBalances(orderedTokenBalances);
|
|
150
|
+
}, [orderedTokenBalances]);
|
|
157
151
|
useEffect(() => {
|
|
158
152
|
if (!walletConnector)
|
|
159
153
|
return;
|