@dynamic-labs/sdk-react-core 4.35.0 → 4.36.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 +20 -0
- package/package.cjs +2 -2
- package/package.js +2 -2
- package/package.json +12 -12
- package/src/lib/client/extension/deprecated/mfa/verifyTotpMfaDevice/verifyTotpMfaDevice.d.ts +1 -1
- package/src/lib/client/extension/projectSettings/getProjectSettings/getProjectSettings.d.ts +2 -1
- package/src/lib/client/extension/projectSettings/useProjectSettings/useProjectSettings.d.ts +2 -1
- package/src/lib/client/extension/projectSettings/useRefetchProjectSettings/useRefetchProjectSettings.d.ts +2 -1
- package/src/lib/context/SocialRedirectContext/hooks/useRedirectSocialHandler/useRedirectSocialHandler.cjs +3 -1
- package/src/lib/context/SocialRedirectContext/hooks/useRedirectSocialHandler/useRedirectSocialHandler.js +3 -1
- package/src/lib/context/SocialRedirectContext/utils/getDynamicRedirectData/getDynamicRedirectData.d.ts +1 -0
- package/src/lib/context/SocialRedirectContext/utils/getDynamicRedirectDataFromUrl/getDynamicRedirectDataFromUrl.cjs +2 -1
- package/src/lib/context/SocialRedirectContext/utils/getDynamicRedirectDataFromUrl/getDynamicRedirectDataFromUrl.d.ts +1 -0
- package/src/lib/context/SocialRedirectContext/utils/getDynamicRedirectDataFromUrl/getDynamicRedirectDataFromUrl.js +2 -1
- package/src/lib/data/api/oauth/oauth.cjs +4 -3
- package/src/lib/data/api/oauth/oauth.d.ts +3 -3
- package/src/lib/data/api/oauth/oauth.js +4 -3
- package/src/lib/locale/en/translation.cjs +2 -0
- package/src/lib/locale/en/translation.d.ts +2 -0
- package/src/lib/locale/en/translation.js +2 -0
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/constants/authViewLayoutChecks.cjs +1 -0
- package/src/lib/utils/constants/authViewLayoutChecks.js +1 -0
- package/src/lib/utils/constants/index.d.ts +1 -1
- package/src/lib/utils/constants/localStorage.cjs +3 -0
- package/src/lib/utils/constants/localStorage.d.ts +4 -0
- package/src/lib/utils/constants/localStorage.js +3 -1
- package/src/lib/utils/constants/sessionStorage.cjs +1 -1
- package/src/lib/utils/constants/sessionStorage.js +1 -1
- package/src/lib/utils/functions/getTransactionLink/blockExplorerPatterns.cjs +47 -0
- package/src/lib/utils/functions/getTransactionLink/blockExplorerPatterns.d.ts +26 -0
- package/src/lib/utils/functions/getTransactionLink/blockExplorerPatterns.js +41 -0
- package/src/lib/utils/functions/getTransactionLink/getTransactionLink.cjs +5 -3
- package/src/lib/utils/functions/getTransactionLink/getTransactionLink.js +5 -3
- package/src/lib/utils/functions/socialStorage/socialStorage.d.ts +2 -0
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.cjs +55 -1
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.d.ts +2 -0
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.js +55 -1
- package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.cjs +1 -1
- package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.js +1 -1
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.cjs +5 -2
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.d.ts +4 -1
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.js +5 -2
- package/src/lib/utils/hooks/useSyncDynamicWaas/useSyncDynamicWaas.cjs +43 -6
- package/src/lib/utils/hooks/useSyncDynamicWaas/useSyncDynamicWaas.js +43 -6
- package/src/lib/utils/hooks/useWalletDelegation/useWalletDelegation.cjs +37 -5
- package/src/lib/utils/hooks/useWalletDelegation/useWalletDelegation.d.ts +6 -1
- package/src/lib/utils/hooks/useWalletDelegation/useWalletDelegation.js +37 -5
- package/src/lib/views/WalletDelegation/WalletDelegationView/WalletDelegationView.cjs +68 -101
- package/src/lib/views/WalletDelegation/WalletDelegationView/WalletDelegationView.d.ts +7 -1
- package/src/lib/views/WalletDelegation/WalletDelegationView/WalletDelegationView.js +69 -102
- package/src/lib/views/viewToComponentMap.d.ts +3 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetViews/mapViewToComponent.d.ts +3 -1
|
@@ -103,6 +103,7 @@ const viewsThatPreventModalClose = [
|
|
|
103
103
|
'login-with-sms-verification',
|
|
104
104
|
'backup-unsuccessful',
|
|
105
105
|
'wallet-upgrade-flow-view',
|
|
106
|
+
'wallet-delegation-view',
|
|
106
107
|
];
|
|
107
108
|
/**
|
|
108
109
|
* When hasPendingMfaAction returns true, user is not able to close the modal in these views at all
|
|
@@ -99,6 +99,7 @@ const viewsThatPreventModalClose = [
|
|
|
99
99
|
'login-with-sms-verification',
|
|
100
100
|
'backup-unsuccessful',
|
|
101
101
|
'wallet-upgrade-flow-view',
|
|
102
|
+
'wallet-delegation-view',
|
|
102
103
|
];
|
|
103
104
|
/**
|
|
104
105
|
* When hasPendingMfaAction returns true, user is not able to close the modal in these views at all
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { STORE_STORAGE_KEY, LAST_USED_WALLET, NETWORKS_STORAGE_KEY, THEME, WALLET_PICKER_SEARCH_KEY, EXCHANGE_PICKER_SEARCH_KEY, PHANTOM_SIGNATURE_STATE, DEVICE_FINGERPRINT, } from './localStorage';
|
|
1
|
+
export { STORE_STORAGE_KEY, LAST_USED_WALLET, NETWORKS_STORAGE_KEY, THEME, WALLET_PICKER_SEARCH_KEY, EXCHANGE_PICKER_SEARCH_KEY, PHANTOM_SIGNATURE_STATE, DEVICE_FINGERPRINT, DELEGATION_DENIED_WALLET_IDS, DELEGATION_PROMPT_DISMISSED, DELEGATION_COMPLETED_WALLET_IDS, DELEGATION_STATE, } from './localStorage';
|
|
2
2
|
export { BASE_LIGHT_1, BASE_LIGHT_2, BASE_LIGHT_3, BASE_LIGHT_4, BASE_LIGHT_5, BASE_DARK_5, TEXT_LIGHT_PRIMARY, TEXT_LIGHT_SECONDARY, TEXT_LIGHT_TERTIARY, TEXT_LIGHT_LINK, CONNECTION_LIGHT_GREEN, CONNECTION_LIGHT_ORANGE, ERROR_LIGHT_1, ERROR_LIGHT_2, OVERLAY_LIGHT, HOVER_LIGHT, LOADING_ANIMATION_GRADIENT_LIGHT, BASE_DARK_1, BASE_DARK_2, BASE_DARK_3, BASE_DARK_4, DYNAMIC_CONNECT_BUTTON_BACKGROUND, DYNAMIC_CONNECT_BUTTON_BORDER, DYNAMIC_CONNECT_BUTTON_COLOR, TEXT_DARK_PRIMARY, TEXT_DARK_SECONDARY, TEXT_DARK_TERTIARY, TEXT_DARK_LINK, BRAND_HOVER, BRAND_PRIMARY, BRAND_SECONDARY, CONNECTION_DARK_GREEN, CONNECTION_DARK_ORANGE, ERROR_DARK_1, ERROR_DARK_2, OVERLAY_DARK, HOVER_DARK, LOADING_ANIMATION_GRADIENT_DARK, SHADOW_DOWN_1, SHADOW_DOWN_2, SHADOW_DOWN_3, SHADOW_UP_1, BRAND_HOVER_COLOR, BRAND_PRIMARY_COLOR, BRAND_SECONDARY_COLOR, } from './colors';
|
|
3
3
|
export { BORDER_SQUARE, BORDER_ROUNDED, BORDER_RADIUS } from './theme';
|
|
4
4
|
export { TITLE, BODY_NORMAL, BODY_SMALL, BODY_MINI, BUTTON_PRIMARY, BUTTON_SECONDARY, NUMBERS_BIG, NUMBERS_MEDIUM, } from './typography';
|
|
@@ -20,6 +20,8 @@ const CAPTCHA_TOKEN = 'dynamic_captcha_token';
|
|
|
20
20
|
* Used to identify the purpose of a signature after phantom redirects back to the app in mobile
|
|
21
21
|
*/
|
|
22
22
|
const PHANTOM_SIGNATURE_STATE = 'phantom_verification_type';
|
|
23
|
+
// Wallet Delegation: unified state container for delegation flow
|
|
24
|
+
const DELEGATION_STATE = 'dynamic_delegation_state';
|
|
23
25
|
const STORE_STORAGE_KEY = 'dynamic_store';
|
|
24
26
|
const SECURE_ENCLAVE_WALLET_SESSION_KEYS = 'dynamic_secure_enclave_session_keys';
|
|
25
27
|
const SECURE_ENCLAVE_WALLET_SESSION_KEYS_STORAGE_OPTIONS = {
|
|
@@ -29,6 +31,7 @@ const SECURE_ENCLAVE_WALLET_SESSION_KEYS_STORAGE_OPTIONS = {
|
|
|
29
31
|
exports.BRIDGE_ONBOARDING_COMPLETED = BRIDGE_ONBOARDING_COMPLETED;
|
|
30
32
|
exports.CAPTCHA_TOKEN = CAPTCHA_TOKEN;
|
|
31
33
|
exports.CONNECTED_WALLET_NAME_SERVICE = CONNECTED_WALLET_NAME_SERVICE;
|
|
34
|
+
exports.DELEGATION_STATE = DELEGATION_STATE;
|
|
32
35
|
exports.DEVICE_FINGERPRINT = DEVICE_FINGERPRINT;
|
|
33
36
|
exports.DYNAMIC_CONTEXT_LAST_SESSION_SETTINGS = DYNAMIC_CONTEXT_LAST_SESSION_SETTINGS;
|
|
34
37
|
exports.EMBEDDED_WALLET_SECURE_BANNER = EMBEDDED_WALLET_SECURE_BANNER;
|
|
@@ -27,6 +27,10 @@ export type PhantomSignatureState = {
|
|
|
27
27
|
* Used to identify the purpose of a signature after phantom redirects back to the app in mobile
|
|
28
28
|
*/
|
|
29
29
|
export declare const PHANTOM_SIGNATURE_STATE = "phantom_verification_type";
|
|
30
|
+
export declare const DELEGATION_DENIED_WALLET_IDS = "dynamic_delegation_denied_wallet_ids";
|
|
31
|
+
export declare const DELEGATION_PROMPT_DISMISSED = "dynamic_delegation_prompt_dismissed";
|
|
32
|
+
export declare const DELEGATION_COMPLETED_WALLET_IDS = "dynamic_delegation_completed_wallet_ids";
|
|
33
|
+
export declare const DELEGATION_STATE = "dynamic_delegation_state";
|
|
30
34
|
export declare const STORE_STORAGE_KEY = "dynamic_store";
|
|
31
35
|
export declare const IP_LOOKUP_STORAGE_KEY = "dynamic_ip_lookup";
|
|
32
36
|
export declare const SECURE_ENCLAVE_WALLET_SESSION_KEYS = "dynamic_secure_enclave_session_keys";
|
|
@@ -16,10 +16,12 @@ const CAPTCHA_TOKEN = 'dynamic_captcha_token';
|
|
|
16
16
|
* Used to identify the purpose of a signature after phantom redirects back to the app in mobile
|
|
17
17
|
*/
|
|
18
18
|
const PHANTOM_SIGNATURE_STATE = 'phantom_verification_type';
|
|
19
|
+
// Wallet Delegation: unified state container for delegation flow
|
|
20
|
+
const DELEGATION_STATE = 'dynamic_delegation_state';
|
|
19
21
|
const STORE_STORAGE_KEY = 'dynamic_store';
|
|
20
22
|
const SECURE_ENCLAVE_WALLET_SESSION_KEYS = 'dynamic_secure_enclave_session_keys';
|
|
21
23
|
const SECURE_ENCLAVE_WALLET_SESSION_KEYS_STORAGE_OPTIONS = {
|
|
22
24
|
priority: ['secureStorage', 'localStorage'],
|
|
23
25
|
};
|
|
24
26
|
|
|
25
|
-
export { BRIDGE_ONBOARDING_COMPLETED, CAPTCHA_TOKEN, CONNECTED_WALLET_NAME_SERVICE, DEVICE_FINGERPRINT, DYNAMIC_CONTEXT_LAST_SESSION_SETTINGS, EMBEDDED_WALLET_SECURE_BANNER, EMBEDDED_WALLET_SESSION_SETTINGS, EXCHANGE_PICKER_SEARCH_KEY, LAST_USED_WALLET, NEWTOWEB3_WALLET_EXTENSION_FLAG_KEY, PHANTOM_SIGNATURE_STATE, PHONE_INPUT_DEFAULT_COUNTRY, SECURE_ENCLAVE_WALLET_SESSION_KEYS, SECURE_ENCLAVE_WALLET_SESSION_KEYS_STORAGE_OPTIONS, STORE_STORAGE_KEY, WAGMI_LAST_SESSION_SETTINGS, WALLET_PICKER_SEARCH_KEY };
|
|
27
|
+
export { BRIDGE_ONBOARDING_COMPLETED, CAPTCHA_TOKEN, CONNECTED_WALLET_NAME_SERVICE, DELEGATION_STATE, DEVICE_FINGERPRINT, DYNAMIC_CONTEXT_LAST_SESSION_SETTINGS, EMBEDDED_WALLET_SECURE_BANNER, EMBEDDED_WALLET_SESSION_SETTINGS, EXCHANGE_PICKER_SEARCH_KEY, LAST_USED_WALLET, NEWTOWEB3_WALLET_EXTENSION_FLAG_KEY, PHANTOM_SIGNATURE_STATE, PHONE_INPUT_DEFAULT_COUNTRY, SECURE_ENCLAVE_WALLET_SESSION_KEYS, SECURE_ENCLAVE_WALLET_SESSION_KEYS_STORAGE_OPTIONS, STORE_STORAGE_KEY, WAGMI_LAST_SESSION_SETTINGS, WALLET_PICKER_SEARCH_KEY };
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
|
|
6
6
|
const CLIENT_SESSION_KEYS = 'dynamic_client_session_keys';
|
|
7
7
|
const CLIENT_SESSION_KEYS_STORAGE_OPTIONS = {
|
|
8
|
-
priority: ['secureStorage', '
|
|
8
|
+
priority: ['secureStorage', 'localStorage'],
|
|
9
9
|
};
|
|
10
10
|
const SECURE_ENCLAVE_WALLET_SESSION_KEYS = 'dynamic_secure_enclave_session_keys';
|
|
11
11
|
const SECURE_ENCLAVE_WALLET_SESSION_KEYS_STORAGE_OPTIONS = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
const CLIENT_SESSION_KEYS = 'dynamic_client_session_keys';
|
|
3
3
|
const CLIENT_SESSION_KEYS_STORAGE_OPTIONS = {
|
|
4
|
-
priority: ['secureStorage', '
|
|
4
|
+
priority: ['secureStorage', 'localStorage'],
|
|
5
5
|
};
|
|
6
6
|
const SECURE_ENCLAVE_WALLET_SESSION_KEYS = 'dynamic_secure_enclave_session_keys';
|
|
7
7
|
const SECURE_ENCLAVE_WALLET_SESSION_KEYS_STORAGE_OPTIONS = {
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Block explorer URL patterns for different chains
|
|
8
|
+
* This mapping allows for easy configuration and extension of transaction link formats
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Predefined patterns for known block explorers
|
|
12
|
+
* Add new patterns here as needed for different chains
|
|
13
|
+
*/
|
|
14
|
+
const BLOCK_EXPLORER_PATTERNS = [
|
|
15
|
+
{
|
|
16
|
+
description: 'TRON - Uses hash fragment format',
|
|
17
|
+
domain: 'tronscan.org',
|
|
18
|
+
generateUrl: (baseUrl, hash) => {
|
|
19
|
+
const url = new URL(baseUrl);
|
|
20
|
+
return `${url.origin}/#/transaction/${hash}`;
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
];
|
|
24
|
+
/**
|
|
25
|
+
* Default pattern for standard block explorers
|
|
26
|
+
* Used when no specific pattern matches
|
|
27
|
+
*/
|
|
28
|
+
const DEFAULT_PATTERN = {
|
|
29
|
+
description: 'Standard format used by most block explorers',
|
|
30
|
+
domain: '*',
|
|
31
|
+
generateUrl: (baseUrl, hash) => {
|
|
32
|
+
const url = new URL(baseUrl);
|
|
33
|
+
url.pathname = `/tx/${hash}`;
|
|
34
|
+
return url.toString();
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Find the appropriate pattern for a given block explorer URL
|
|
39
|
+
*/
|
|
40
|
+
const findBlockExplorerPattern = (blockExplorerUrl) => {
|
|
41
|
+
const pattern = BLOCK_EXPLORER_PATTERNS.find((pattern) => blockExplorerUrl.includes(pattern.domain));
|
|
42
|
+
return pattern || DEFAULT_PATTERN;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
exports.BLOCK_EXPLORER_PATTERNS = BLOCK_EXPLORER_PATTERNS;
|
|
46
|
+
exports.DEFAULT_PATTERN = DEFAULT_PATTERN;
|
|
47
|
+
exports.findBlockExplorerPattern = findBlockExplorerPattern;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Block explorer URL patterns for different chains
|
|
3
|
+
* This mapping allows for easy configuration and extension of transaction link formats
|
|
4
|
+
*/
|
|
5
|
+
export interface BlockExplorerPattern {
|
|
6
|
+
/** Domain pattern to match against block explorer URLs */
|
|
7
|
+
domain: string;
|
|
8
|
+
/** Function to generate the transaction URL */
|
|
9
|
+
generateUrl: (baseUrl: string, transactionHash: string) => string;
|
|
10
|
+
/** Description of the pattern for documentation */
|
|
11
|
+
description: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Predefined patterns for known block explorers
|
|
15
|
+
* Add new patterns here as needed for different chains
|
|
16
|
+
*/
|
|
17
|
+
export declare const BLOCK_EXPLORER_PATTERNS: BlockExplorerPattern[];
|
|
18
|
+
/**
|
|
19
|
+
* Default pattern for standard block explorers
|
|
20
|
+
* Used when no specific pattern matches
|
|
21
|
+
*/
|
|
22
|
+
export declare const DEFAULT_PATTERN: BlockExplorerPattern;
|
|
23
|
+
/**
|
|
24
|
+
* Find the appropriate pattern for a given block explorer URL
|
|
25
|
+
*/
|
|
26
|
+
export declare const findBlockExplorerPattern: (blockExplorerUrl: string) => BlockExplorerPattern;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
/**
|
|
3
|
+
* Block explorer URL patterns for different chains
|
|
4
|
+
* This mapping allows for easy configuration and extension of transaction link formats
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Predefined patterns for known block explorers
|
|
8
|
+
* Add new patterns here as needed for different chains
|
|
9
|
+
*/
|
|
10
|
+
const BLOCK_EXPLORER_PATTERNS = [
|
|
11
|
+
{
|
|
12
|
+
description: 'TRON - Uses hash fragment format',
|
|
13
|
+
domain: 'tronscan.org',
|
|
14
|
+
generateUrl: (baseUrl, hash) => {
|
|
15
|
+
const url = new URL(baseUrl);
|
|
16
|
+
return `${url.origin}/#/transaction/${hash}`;
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
];
|
|
20
|
+
/**
|
|
21
|
+
* Default pattern for standard block explorers
|
|
22
|
+
* Used when no specific pattern matches
|
|
23
|
+
*/
|
|
24
|
+
const DEFAULT_PATTERN = {
|
|
25
|
+
description: 'Standard format used by most block explorers',
|
|
26
|
+
domain: '*',
|
|
27
|
+
generateUrl: (baseUrl, hash) => {
|
|
28
|
+
const url = new URL(baseUrl);
|
|
29
|
+
url.pathname = `/tx/${hash}`;
|
|
30
|
+
return url.toString();
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Find the appropriate pattern for a given block explorer URL
|
|
35
|
+
*/
|
|
36
|
+
const findBlockExplorerPattern = (blockExplorerUrl) => {
|
|
37
|
+
const pattern = BLOCK_EXPLORER_PATTERNS.find((pattern) => blockExplorerUrl.includes(pattern.domain));
|
|
38
|
+
return pattern || DEFAULT_PATTERN;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export { BLOCK_EXPLORER_PATTERNS, DEFAULT_PATTERN, findBlockExplorerPattern };
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
6
|
var _tslib = require('../../../../../_virtual/_tslib.cjs');
|
|
7
|
+
var blockExplorerPatterns = require('./blockExplorerPatterns.cjs');
|
|
7
8
|
|
|
8
9
|
const getTransactionLink = (_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ walletConnector, transactionHash, }) {
|
|
9
10
|
try {
|
|
@@ -13,9 +14,10 @@ const getTransactionLink = (_a) => _tslib.__awaiter(void 0, [_a], void 0, functi
|
|
|
13
14
|
const [blockExplorerUrl] = yield walletConnector.getBlockExplorerUrlsForCurrentNetwork();
|
|
14
15
|
if (!blockExplorerUrl)
|
|
15
16
|
return undefined;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
// Find the appropriate pattern for this block explorer
|
|
18
|
+
const pattern = blockExplorerPatterns.findBlockExplorerPattern(blockExplorerUrl);
|
|
19
|
+
// Generate the transaction URL using the pattern
|
|
20
|
+
return pattern.generateUrl(blockExplorerUrl, transactionHash);
|
|
19
21
|
}
|
|
20
22
|
catch (error) {
|
|
21
23
|
return undefined;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { __awaiter } from '../../../../../_virtual/_tslib.js';
|
|
3
|
+
import { findBlockExplorerPattern } from './blockExplorerPatterns.js';
|
|
3
4
|
|
|
4
5
|
const getTransactionLink = (_a) => __awaiter(void 0, [_a], void 0, function* ({ walletConnector, transactionHash, }) {
|
|
5
6
|
try {
|
|
@@ -9,9 +10,10 @@ const getTransactionLink = (_a) => __awaiter(void 0, [_a], void 0, function* ({
|
|
|
9
10
|
const [blockExplorerUrl] = yield walletConnector.getBlockExplorerUrlsForCurrentNetwork();
|
|
10
11
|
if (!blockExplorerUrl)
|
|
11
12
|
return undefined;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
// Find the appropriate pattern for this block explorer
|
|
14
|
+
const pattern = findBlockExplorerPattern(blockExplorerUrl);
|
|
15
|
+
// Generate the transaction URL using the pattern
|
|
16
|
+
return pattern.generateUrl(blockExplorerUrl, transactionHash);
|
|
15
17
|
}
|
|
16
18
|
catch (error) {
|
|
17
19
|
return undefined;
|
|
@@ -4,6 +4,8 @@ import { PayWithDynamicProps } from '../../hooks/usePayWithDynamic/usePayWithDyn
|
|
|
4
4
|
export declare const SOCIAL_STORAGE_KEY = "dynamic_social_storage";
|
|
5
5
|
export type SocialStorageItem = {
|
|
6
6
|
provider: ProviderEnum;
|
|
7
|
+
/** SSO provider id */
|
|
8
|
+
dynamicOauthSsoProviderId: string | undefined;
|
|
7
9
|
/** State issued to IDP on social authentication */
|
|
8
10
|
state: string;
|
|
9
11
|
/** Code verifier used to generate the code challenge for PKCE */
|
|
@@ -98,8 +98,8 @@ require('../../../context/PasskeyContext/PasskeyContext.cjs');
|
|
|
98
98
|
require('../../../context/OnrampContext/OnrampContext.cjs');
|
|
99
99
|
var apiUrl = require('../../constants/waas/apiUrl.cjs');
|
|
100
100
|
var useClientSessionKeys = require('../useClientSessionKeys/useClientSessionKeys.cjs');
|
|
101
|
-
var useRefreshUser = require('../useRefreshUser/useRefreshUser.cjs');
|
|
102
101
|
var useGetMfaToken = require('../useGetMfaToken/useGetMfaToken.cjs');
|
|
102
|
+
var useRefreshUser = require('../useRefreshUser/useRefreshUser.cjs');
|
|
103
103
|
var constants = require('./constants.cjs');
|
|
104
104
|
require('../../../store/state/sendBalances.cjs');
|
|
105
105
|
require('../../../store/state/connectorsInitializing/connectorsInitializing.cjs');
|
|
@@ -366,6 +366,58 @@ const useDynamicWaas = () => {
|
|
|
366
366
|
});
|
|
367
367
|
}), [getWalletConnector]);
|
|
368
368
|
const getWaasWallets = React.useCallback(() => userWallets.filter((w) => w.key === 'dynamicwaas'), [userWallets]);
|
|
369
|
+
const processSignOnWalletSettings = React.useCallback(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
370
|
+
var _g;
|
|
371
|
+
if (!(user === null || user === void 0 ? void 0 : user.verifiedCredentials)) {
|
|
372
|
+
return;
|
|
373
|
+
}
|
|
374
|
+
const waasWallets = user.verifiedCredentials.filter((vc) => { var _a; return vc.walletName === 'dynamicwaas' && ((_a = vc.walletProperties) === null || _a === void 0 ? void 0 : _a.settings); });
|
|
375
|
+
for (const wallet of waasWallets) {
|
|
376
|
+
try {
|
|
377
|
+
const settings = (_g = wallet.walletProperties) === null || _g === void 0 ? void 0 : _g.settings;
|
|
378
|
+
const { address, chain } = wallet;
|
|
379
|
+
if (!settings || !address || !chain) {
|
|
380
|
+
continue;
|
|
381
|
+
}
|
|
382
|
+
const { shouldRefreshOnNextSignOn, reshareOnNextSignOn } = settings;
|
|
383
|
+
const chainName = values.VerifiedCredentialNameToChainEnum[chain];
|
|
384
|
+
const walletConnector = getWalletConnector(chainName);
|
|
385
|
+
if (!walletConnector) {
|
|
386
|
+
continue;
|
|
387
|
+
}
|
|
388
|
+
if (shouldRefreshOnNextSignOn) {
|
|
389
|
+
yield walletConnector.refreshWalletAccountShares({
|
|
390
|
+
accountAddress: address,
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
if (reshareOnNextSignOn) {
|
|
394
|
+
yield walletConnector.reshareWalletAccountShares({
|
|
395
|
+
accountAddress: address,
|
|
396
|
+
thresholdSignatureScheme: reshareOnNextSignOn,
|
|
397
|
+
});
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
catch (error) {
|
|
401
|
+
walletConnectorCore.logger.error('Failed to process wallet settings:', {
|
|
402
|
+
error,
|
|
403
|
+
wallet,
|
|
404
|
+
});
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
yield refresh();
|
|
408
|
+
}), [user, getWalletConnector, refresh]);
|
|
409
|
+
const needsSettingsProcessing = React.useMemo(() => {
|
|
410
|
+
if (!(user === null || user === void 0 ? void 0 : user.verifiedCredentials) || !dynamicWaasIsEnabled) {
|
|
411
|
+
return false;
|
|
412
|
+
}
|
|
413
|
+
return user.verifiedCredentials.some((vc) => {
|
|
414
|
+
var _a;
|
|
415
|
+
return vc.walletName === 'dynamicwaas' &&
|
|
416
|
+
((_a = vc.walletProperties) === null || _a === void 0 ? void 0 : _a.settings) &&
|
|
417
|
+
(vc.walletProperties.settings.shouldRefreshOnNextSignOn ||
|
|
418
|
+
vc.walletProperties.settings.reshareOnNextSignOn);
|
|
419
|
+
});
|
|
420
|
+
}, [user, dynamicWaasIsEnabled]);
|
|
369
421
|
return {
|
|
370
422
|
createWalletAccount,
|
|
371
423
|
delegateKeyShares,
|
|
@@ -374,6 +426,8 @@ const useDynamicWaas = () => {
|
|
|
374
426
|
getWalletConnector,
|
|
375
427
|
importPrivateKey,
|
|
376
428
|
needsAutoCreateWalletChains,
|
|
429
|
+
needsSettingsProcessing,
|
|
430
|
+
processSignOnWalletSettings,
|
|
377
431
|
upgradeToDynamicWaas,
|
|
378
432
|
};
|
|
379
433
|
};
|
|
@@ -31,6 +31,8 @@ export declare const useDynamicWaas: () => {
|
|
|
31
31
|
privateKey: string;
|
|
32
32
|
}) => Promise<void>;
|
|
33
33
|
needsAutoCreateWalletChains: ChainEnum[];
|
|
34
|
+
needsSettingsProcessing: boolean;
|
|
35
|
+
processSignOnWalletSettings: () => Promise<void>;
|
|
34
36
|
upgradeToDynamicWaas: ({ privateKey, wallet, }: {
|
|
35
37
|
privateKey: string;
|
|
36
38
|
wallet: Wallet<WalletConnectorCore.WalletConnector>;
|
|
@@ -94,8 +94,8 @@ import '../../../context/PasskeyContext/PasskeyContext.js';
|
|
|
94
94
|
import '../../../context/OnrampContext/OnrampContext.js';
|
|
95
95
|
import { DEFAULT_WAAS_API_URL } from '../../constants/waas/apiUrl.js';
|
|
96
96
|
import { useClientSessionKeys } from '../useClientSessionKeys/useClientSessionKeys.js';
|
|
97
|
-
import { useRefreshUser } from '../useRefreshUser/useRefreshUser.js';
|
|
98
97
|
import { useGetMfaToken } from '../useGetMfaToken/useGetMfaToken.js';
|
|
98
|
+
import { useRefreshUser } from '../useRefreshUser/useRefreshUser.js';
|
|
99
99
|
import { DYNAMIC_WAAS_CONNECTOR_NOT_FOUND_ERROR, NO_ENABLED_CHAINS_ERROR, INVALID_CHAINS_ERROR, WALLET_CREATION_FAILED_ERROR } from './constants.js';
|
|
100
100
|
import '../../../store/state/sendBalances.js';
|
|
101
101
|
import '../../../store/state/connectorsInitializing/connectorsInitializing.js';
|
|
@@ -362,6 +362,58 @@ const useDynamicWaas = () => {
|
|
|
362
362
|
});
|
|
363
363
|
}), [getWalletConnector]);
|
|
364
364
|
const getWaasWallets = useCallback(() => userWallets.filter((w) => w.key === 'dynamicwaas'), [userWallets]);
|
|
365
|
+
const processSignOnWalletSettings = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
366
|
+
var _g;
|
|
367
|
+
if (!(user === null || user === void 0 ? void 0 : user.verifiedCredentials)) {
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
const waasWallets = user.verifiedCredentials.filter((vc) => { var _a; return vc.walletName === 'dynamicwaas' && ((_a = vc.walletProperties) === null || _a === void 0 ? void 0 : _a.settings); });
|
|
371
|
+
for (const wallet of waasWallets) {
|
|
372
|
+
try {
|
|
373
|
+
const settings = (_g = wallet.walletProperties) === null || _g === void 0 ? void 0 : _g.settings;
|
|
374
|
+
const { address, chain } = wallet;
|
|
375
|
+
if (!settings || !address || !chain) {
|
|
376
|
+
continue;
|
|
377
|
+
}
|
|
378
|
+
const { shouldRefreshOnNextSignOn, reshareOnNextSignOn } = settings;
|
|
379
|
+
const chainName = VerifiedCredentialNameToChainEnum[chain];
|
|
380
|
+
const walletConnector = getWalletConnector(chainName);
|
|
381
|
+
if (!walletConnector) {
|
|
382
|
+
continue;
|
|
383
|
+
}
|
|
384
|
+
if (shouldRefreshOnNextSignOn) {
|
|
385
|
+
yield walletConnector.refreshWalletAccountShares({
|
|
386
|
+
accountAddress: address,
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
if (reshareOnNextSignOn) {
|
|
390
|
+
yield walletConnector.reshareWalletAccountShares({
|
|
391
|
+
accountAddress: address,
|
|
392
|
+
thresholdSignatureScheme: reshareOnNextSignOn,
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
catch (error) {
|
|
397
|
+
logger.error('Failed to process wallet settings:', {
|
|
398
|
+
error,
|
|
399
|
+
wallet,
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
yield refresh();
|
|
404
|
+
}), [user, getWalletConnector, refresh]);
|
|
405
|
+
const needsSettingsProcessing = useMemo(() => {
|
|
406
|
+
if (!(user === null || user === void 0 ? void 0 : user.verifiedCredentials) || !dynamicWaasIsEnabled) {
|
|
407
|
+
return false;
|
|
408
|
+
}
|
|
409
|
+
return user.verifiedCredentials.some((vc) => {
|
|
410
|
+
var _a;
|
|
411
|
+
return vc.walletName === 'dynamicwaas' &&
|
|
412
|
+
((_a = vc.walletProperties) === null || _a === void 0 ? void 0 : _a.settings) &&
|
|
413
|
+
(vc.walletProperties.settings.shouldRefreshOnNextSignOn ||
|
|
414
|
+
vc.walletProperties.settings.reshareOnNextSignOn);
|
|
415
|
+
});
|
|
416
|
+
}, [user, dynamicWaasIsEnabled]);
|
|
365
417
|
return {
|
|
366
418
|
createWalletAccount,
|
|
367
419
|
delegateKeyShares,
|
|
@@ -370,6 +422,8 @@ const useDynamicWaas = () => {
|
|
|
370
422
|
getWalletConnector,
|
|
371
423
|
importPrivateKey,
|
|
372
424
|
needsAutoCreateWalletChains,
|
|
425
|
+
needsSettingsProcessing,
|
|
426
|
+
processSignOnWalletSettings,
|
|
373
427
|
upgradeToDynamicWaas,
|
|
374
428
|
};
|
|
375
429
|
};
|
|
@@ -191,7 +191,7 @@ const useSocialAccounts = () => {
|
|
|
191
191
|
const response = yield oauth.unlinkOAuth({
|
|
192
192
|
environmentId,
|
|
193
193
|
primaryWalletId: primaryWalletId$1,
|
|
194
|
-
|
|
194
|
+
verifiedCredentialId: (_b = verifiedCredential.id) !== null && _b !== void 0 ? _b : '',
|
|
195
195
|
});
|
|
196
196
|
if (!response) {
|
|
197
197
|
handleError(provider, types.SocialOAuthErrorCode.UNLINK_ERROR, `Failed to unlink social account: ${provider} | ${verifiedCredential.id}`, { raiseAuthFailure: false });
|
|
@@ -187,7 +187,7 @@ const useSocialAccounts = () => {
|
|
|
187
187
|
const response = yield unlinkOAuth({
|
|
188
188
|
environmentId,
|
|
189
189
|
primaryWalletId,
|
|
190
|
-
|
|
190
|
+
verifiedCredentialId: (_b = verifiedCredential.id) !== null && _b !== void 0 ? _b : '',
|
|
191
191
|
});
|
|
192
192
|
if (!response) {
|
|
193
193
|
handleError(provider, SocialOAuthErrorCode.UNLINK_ERROR, `Failed to unlink social account: ${provider} | ${verifiedCredential.id}`, { raiseAuthFailure: false });
|
|
@@ -207,7 +207,7 @@ const useSocialAuth = ({ onSettled, onError, onFarcasterUrl, }) => {
|
|
|
207
207
|
verifyFunction: () => apiCall(),
|
|
208
208
|
});
|
|
209
209
|
}), [handleError, initAuth, onSettled]);
|
|
210
|
-
const completeConnection = React.useCallback((_b) => _tslib.__awaiter(void 0, [_b], void 0, function* ({ authMode, provider, state, authCode, captchaToken, verifier, telegramAuthToken, forceCreateUser = false, }) {
|
|
210
|
+
const completeConnection = React.useCallback((_b) => _tslib.__awaiter(void 0, [_b], void 0, function* ({ authMode, provider, state, authCode, captchaToken, verifier, telegramAuthToken, forceCreateUser = false, ssoProviderId, }) {
|
|
211
211
|
try {
|
|
212
212
|
let sessionPublicKey = undefined;
|
|
213
213
|
utils.tracing.logEvent('oauth', 'completeConnection', utils.tracing.formatObject({
|
|
@@ -245,6 +245,7 @@ const useSocialAuth = ({ onSettled, onError, onFarcasterUrl, }) => {
|
|
|
245
245
|
code: authCode,
|
|
246
246
|
codeVerifier: verifier,
|
|
247
247
|
sessionPublicKey,
|
|
248
|
+
ssoProviderId,
|
|
248
249
|
state,
|
|
249
250
|
});
|
|
250
251
|
yield signInAccount(provider, apiCall);
|
|
@@ -371,7 +372,7 @@ const useSocialAuth = ({ onSettled, onError, onFarcasterUrl, }) => {
|
|
|
371
372
|
shouldRegisterSessionKeysOnSignin,
|
|
372
373
|
signInAccount,
|
|
373
374
|
]);
|
|
374
|
-
const connectSocialAccount = React.useCallback((_d) => _tslib.__awaiter(void 0, [_d], void 0, function* ({ authMode, provider, validator, captchaToken, isHeadlessSocialSignIn, payingWithDynamic, triggerFundFromExchangeOnSuccess, redirectUrl, telegramAuthToken, showWidgetAfterConnection, }) {
|
|
375
|
+
const connectSocialAccount = React.useCallback((_d) => _tslib.__awaiter(void 0, [_d], void 0, function* ({ authMode, provider, validator, captchaToken, isHeadlessSocialSignIn, payingWithDynamic, triggerFundFromExchangeOnSuccess, redirectUrl, telegramAuthToken, showWidgetAfterConnection, ssoProviderId, }) {
|
|
375
376
|
var _e, _f;
|
|
376
377
|
clearError();
|
|
377
378
|
setIsProcessing(true);
|
|
@@ -404,6 +405,7 @@ const useSocialAuth = ({ onSettled, onError, onFarcasterUrl, }) => {
|
|
|
404
405
|
socialStorage.setSocialStorageFor(provider, {
|
|
405
406
|
captchaToken,
|
|
406
407
|
codeVerifier: usingPkce ? verifier : undefined,
|
|
408
|
+
dynamicOauthSsoProviderId: ssoProviderId,
|
|
407
409
|
isHeadlessSocialSignIn,
|
|
408
410
|
mode: authMode,
|
|
409
411
|
payingWithDynamic,
|
|
@@ -451,6 +453,7 @@ const useSocialAuth = ({ onSettled, onError, onFarcasterUrl, }) => {
|
|
|
451
453
|
authMode,
|
|
452
454
|
captchaToken,
|
|
453
455
|
provider,
|
|
456
|
+
ssoProviderId,
|
|
454
457
|
state,
|
|
455
458
|
telegramAuthToken,
|
|
456
459
|
verifier,
|
|
@@ -20,10 +20,12 @@ export type ConnectSocialAccountProps = {
|
|
|
20
20
|
payingWithDynamic?: PayWithDynamicProps;
|
|
21
21
|
/** marks the flow as initiated by headless sign-in API */
|
|
22
22
|
isHeadlessSocialSignIn?: boolean;
|
|
23
|
+
/** SSO provider ID for social authentication */
|
|
24
|
+
ssoProviderId?: string;
|
|
23
25
|
};
|
|
24
26
|
export declare const useSocialAuth: ({ onSettled, onError, onFarcasterUrl, }: UseSocialAuthProps) => {
|
|
25
27
|
readonly checkValidProvider: (provider: ProviderEnum, authMode: SocialAuthMode) => boolean;
|
|
26
|
-
readonly completeConnection: ({ authMode, provider, state, authCode, captchaToken, verifier, telegramAuthToken, forceCreateUser, }: {
|
|
28
|
+
readonly completeConnection: ({ authMode, provider, state, authCode, captchaToken, verifier, telegramAuthToken, forceCreateUser, ssoProviderId, }: {
|
|
27
29
|
authMode: SocialAuthMode;
|
|
28
30
|
provider: ProviderEnum;
|
|
29
31
|
state: string;
|
|
@@ -32,6 +34,7 @@ export declare const useSocialAuth: ({ onSettled, onError, onFarcasterUrl, }: Us
|
|
|
32
34
|
verifier?: string | undefined;
|
|
33
35
|
telegramAuthToken?: string | undefined;
|
|
34
36
|
forceCreateUser?: boolean | undefined;
|
|
37
|
+
ssoProviderId?: string | undefined;
|
|
35
38
|
}) => Promise<void>;
|
|
36
39
|
readonly connectSocialAccount: (props: ConnectSocialAccountProps) => Promise<void>;
|
|
37
40
|
readonly error: SocialOAuthError | undefined;
|
|
@@ -203,7 +203,7 @@ const useSocialAuth = ({ onSettled, onError, onFarcasterUrl, }) => {
|
|
|
203
203
|
verifyFunction: () => apiCall(),
|
|
204
204
|
});
|
|
205
205
|
}), [handleError, initAuth$1, onSettled]);
|
|
206
|
-
const completeConnection = useCallback((_b) => __awaiter(void 0, [_b], void 0, function* ({ authMode, provider, state, authCode, captchaToken, verifier, telegramAuthToken, forceCreateUser = false, }) {
|
|
206
|
+
const completeConnection = useCallback((_b) => __awaiter(void 0, [_b], void 0, function* ({ authMode, provider, state, authCode, captchaToken, verifier, telegramAuthToken, forceCreateUser = false, ssoProviderId, }) {
|
|
207
207
|
try {
|
|
208
208
|
let sessionPublicKey = undefined;
|
|
209
209
|
tracing.logEvent('oauth', 'completeConnection', tracing.formatObject({
|
|
@@ -241,6 +241,7 @@ const useSocialAuth = ({ onSettled, onError, onFarcasterUrl, }) => {
|
|
|
241
241
|
code: authCode,
|
|
242
242
|
codeVerifier: verifier,
|
|
243
243
|
sessionPublicKey,
|
|
244
|
+
ssoProviderId,
|
|
244
245
|
state,
|
|
245
246
|
});
|
|
246
247
|
yield signInAccount(provider, apiCall);
|
|
@@ -367,7 +368,7 @@ const useSocialAuth = ({ onSettled, onError, onFarcasterUrl, }) => {
|
|
|
367
368
|
shouldRegisterSessionKeysOnSignin,
|
|
368
369
|
signInAccount,
|
|
369
370
|
]);
|
|
370
|
-
const connectSocialAccount = useCallback((_d) => __awaiter(void 0, [_d], void 0, function* ({ authMode, provider, validator, captchaToken, isHeadlessSocialSignIn, payingWithDynamic, triggerFundFromExchangeOnSuccess, redirectUrl, telegramAuthToken, showWidgetAfterConnection, }) {
|
|
371
|
+
const connectSocialAccount = useCallback((_d) => __awaiter(void 0, [_d], void 0, function* ({ authMode, provider, validator, captchaToken, isHeadlessSocialSignIn, payingWithDynamic, triggerFundFromExchangeOnSuccess, redirectUrl, telegramAuthToken, showWidgetAfterConnection, ssoProviderId, }) {
|
|
371
372
|
var _e, _f;
|
|
372
373
|
clearError();
|
|
373
374
|
setIsProcessing(true);
|
|
@@ -400,6 +401,7 @@ const useSocialAuth = ({ onSettled, onError, onFarcasterUrl, }) => {
|
|
|
400
401
|
setSocialStorageFor(provider, {
|
|
401
402
|
captchaToken,
|
|
402
403
|
codeVerifier: usingPkce ? verifier : undefined,
|
|
404
|
+
dynamicOauthSsoProviderId: ssoProviderId,
|
|
403
405
|
isHeadlessSocialSignIn,
|
|
404
406
|
mode: authMode,
|
|
405
407
|
payingWithDynamic,
|
|
@@ -447,6 +449,7 @@ const useSocialAuth = ({ onSettled, onError, onFarcasterUrl, }) => {
|
|
|
447
449
|
authMode,
|
|
448
450
|
captchaToken,
|
|
449
451
|
provider,
|
|
452
|
+
ssoProviderId,
|
|
450
453
|
state,
|
|
451
454
|
telegramAuthToken,
|
|
452
455
|
verifier,
|