@dynamic-labs/sdk-react-core 4.65.0 → 4.67.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 +32 -0
- package/package.cjs +4 -4
- package/package.js +4 -4
- package/package.json +15 -15
- package/src/index.cjs +2 -0
- package/src/index.d.ts +2 -2
- package/src/index.js +1 -0
- package/src/lib/Main.cjs +1 -0
- package/src/lib/Main.js +1 -0
- package/src/lib/client/extension/functions/hasElevatedAccessToken/hasElevatedAccessToken.cjs +18 -0
- package/src/lib/client/extension/functions/hasElevatedAccessToken/hasElevatedAccessToken.d.ts +1 -0
- package/src/lib/client/extension/functions/hasElevatedAccessToken/hasElevatedAccessToken.js +14 -0
- package/src/lib/client/extension/functions/hasElevatedAccessToken/index.d.ts +1 -0
- package/src/lib/client/extension/index.d.ts +1 -0
- package/src/lib/context/DynamicContext/DynamicContext.cjs +20 -19
- package/src/lib/context/DynamicContext/DynamicContext.js +20 -19
- package/src/lib/context/DynamicContext/types/SettingsOverrides.d.ts +10 -0
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/constants/values.cjs +2 -0
- package/src/lib/utils/constants/values.js +2 -0
- package/src/lib/utils/functions/compareChains/compareChains.cjs +1 -0
- package/src/lib/utils/functions/compareChains/compareChains.js +1 -0
- package/src/lib/utils/hooks/index.d.ts +2 -1
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.cjs +7 -3
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.d.ts +4 -1
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.js +7 -3
- package/src/lib/utils/hooks/useNetworkConfigurationsFromProjectSettings/useNetworkConfigurationsFromProjectSettings.cjs +7 -2
- package/src/lib/utils/hooks/useNetworkConfigurationsFromProjectSettings/useNetworkConfigurationsFromProjectSettings.d.ts +2 -1
- package/src/lib/utils/hooks/useNetworkConfigurationsFromProjectSettings/useNetworkConfigurationsFromProjectSettings.js +7 -2
- package/src/lib/utils/hooks/useSignEip7702Authorization/index.d.ts +1 -0
- package/src/lib/utils/hooks/useSignEip7702Authorization/useSignEip7702Authorization.cjs +162 -0
- package/src/lib/utils/hooks/useSignEip7702Authorization/useSignEip7702Authorization.d.ts +78 -0
- package/src/lib/utils/hooks/useSignEip7702Authorization/useSignEip7702Authorization.js +158 -0
- package/src/lib/utils/hooks/useStepUpAuthentication/index.d.ts +1 -1
- package/src/lib/utils/hooks/useStepUpAuthentication/useStepUpAuthentication.cjs +102 -23
- package/src/lib/utils/hooks/useStepUpAuthentication/useStepUpAuthentication.d.ts +35 -15
- package/src/lib/utils/hooks/useStepUpAuthentication/useStepUpAuthentication.js +103 -24
- package/src/lib/utils/hooks/useSyncDynamicWaas/useSyncDynamicWaas.cjs +3 -1
- package/src/lib/utils/hooks/useSyncDynamicWaas/useSyncDynamicWaas.js +3 -1
- package/src/lib/utils/hooks/useWalletConnectorNetwork/useWalletConnectorNetwork.cjs +3 -2
- package/src/lib/utils/hooks/useWalletConnectorNetwork/useWalletConnectorNetwork.js +3 -2
- package/src/lib/utils/hooks/useWalletPassword/useWalletPassword.cjs +24 -2
- package/src/lib/utils/hooks/useWalletPassword/useWalletPassword.js +24 -2
- package/src/lib/views/CollectUserDataView/UserDataFields/UserPhoneField/UserPhoneField.cjs +10 -6
- package/src/lib/views/CollectUserDataView/UserDataFields/UserPhoneField/UserPhoneField.js +11 -7
- package/src/lib/views/MfaDisplayBackupCodesView/MfaDisplayBackupCodesView.cjs +1 -1
- package/src/lib/views/MfaDisplayBackupCodesView/MfaDisplayBackupCodesView.js +1 -1
- package/src/lib/views/ResetPasswordForSettingsView/ResetPasswordForSettingsView.cjs +5 -21
- package/src/lib/views/ResetPasswordForSettingsView/ResetPasswordForSettingsView.js +5 -21
- package/src/lib/views/SendBalanceView/SendBalanceView.cjs +1 -0
- package/src/lib/views/SendBalanceView/SendBalanceView.js +1 -0
- package/src/lib/views/SetupPasswordForWalletCreationView/SetupPasswordForWalletCreationView.cjs +9 -1
- package/src/lib/views/SetupPasswordForWalletCreationView/SetupPasswordForWalletCreationView.js +9 -1
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.cjs +21 -1
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.js +21 -1
- package/src/lib/views/WalletList/data.cjs +1 -0
- package/src/lib/views/WalletList/data.d.ts +1 -1
- package/src/lib/views/WalletList/data.js +1 -0
- package/src/lib/widgets/DynamicWidget/views/ResetPasswordView/ResetPasswordView.cjs +26 -5
- package/src/lib/widgets/DynamicWidget/views/ResetPasswordView/ResetPasswordView.js +26 -5
- package/src/lib/widgets/DynamicWidget/views/SetupPasswordConfirmView/SetupPasswordConfirmView.cjs +3 -2
- package/src/lib/widgets/DynamicWidget/views/SetupPasswordConfirmView/SetupPasswordConfirmView.d.ts +2 -0
- package/src/lib/widgets/DynamicWidget/views/SetupPasswordConfirmView/SetupPasswordConfirmView.js +3 -2
- package/src/lib/widgets/DynamicWidget/views/SetupPasswordKnowledgeCheckView/SetupPasswordKnowledgeCheckView.cjs +2 -2
- package/src/lib/widgets/DynamicWidget/views/SetupPasswordKnowledgeCheckView/SetupPasswordKnowledgeCheckView.d.ts +2 -0
- package/src/lib/widgets/DynamicWidget/views/SetupPasswordKnowledgeCheckView/SetupPasswordKnowledgeCheckView.js +2 -2
- package/src/lib/widgets/DynamicWidget/views/SetupPasswordView/SetupPasswordView.cjs +30 -22
- package/src/lib/widgets/DynamicWidget/views/SetupPasswordView/SetupPasswordView.d.ts +2 -1
- package/src/lib/widgets/DynamicWidget/views/SetupPasswordView/SetupPasswordView.js +30 -22
|
@@ -10,6 +10,7 @@ const DEFAULT_NUMBER_OF_WALLETS_TO_SHOW = 10;
|
|
|
10
10
|
// https://www.iana.org/assignments/jwt/jwt.xhtml#claims
|
|
11
11
|
// https://github.com/jaredhanson/id-blockchain-claims-in-jwt/blob/main/draft.md
|
|
12
12
|
const ChainEnumToVerifiedCredentialName = {
|
|
13
|
+
ALEO: 'aleo',
|
|
13
14
|
ALGO: 'algorand',
|
|
14
15
|
BTC: 'bip122', // see: https://namespaces.chainagnostic.org/bip122/caip2
|
|
15
16
|
COSMOS: 'cosmos',
|
|
@@ -22,6 +23,7 @@ const ChainEnumToVerifiedCredentialName = {
|
|
|
22
23
|
TON: 'ton',
|
|
23
24
|
};
|
|
24
25
|
const VerifiedCredentialNameToChainEnum = {
|
|
26
|
+
aleo: sdkApiCore.ChainEnum.Aleo,
|
|
25
27
|
algorand: sdkApiCore.ChainEnum.Algo,
|
|
26
28
|
bip122: sdkApiCore.ChainEnum.Btc,
|
|
27
29
|
cosmos: sdkApiCore.ChainEnum.Cosmos,
|
|
@@ -6,6 +6,7 @@ const DEFAULT_NUMBER_OF_WALLETS_TO_SHOW = 10;
|
|
|
6
6
|
// https://www.iana.org/assignments/jwt/jwt.xhtml#claims
|
|
7
7
|
// https://github.com/jaredhanson/id-blockchain-claims-in-jwt/blob/main/draft.md
|
|
8
8
|
const ChainEnumToVerifiedCredentialName = {
|
|
9
|
+
ALEO: 'aleo',
|
|
9
10
|
ALGO: 'algorand',
|
|
10
11
|
BTC: 'bip122', // see: https://namespaces.chainagnostic.org/bip122/caip2
|
|
11
12
|
COSMOS: 'cosmos',
|
|
@@ -18,6 +19,7 @@ const ChainEnumToVerifiedCredentialName = {
|
|
|
18
19
|
TON: 'ton',
|
|
19
20
|
};
|
|
20
21
|
const VerifiedCredentialNameToChainEnum = {
|
|
22
|
+
aleo: ChainEnum.Aleo,
|
|
21
23
|
algorand: ChainEnum.Algo,
|
|
22
24
|
bip122: ChainEnum.Btc,
|
|
23
25
|
cosmos: ChainEnum.Cosmos,
|
|
@@ -65,6 +65,7 @@ export { useRefreshUser } from './useRefreshUser';
|
|
|
65
65
|
export { useWalletOptions } from './useWalletOptions';
|
|
66
66
|
export { useSyncMfaFlow } from './useSyncMfaFlow';
|
|
67
67
|
export * from './useSmartWallets';
|
|
68
|
+
export * from './useSignEip7702Authorization';
|
|
68
69
|
export { useEmbeddedWalletSessionKeys } from './useEmbeddedWalletSessionKeys';
|
|
69
70
|
export { useTelegramLogin } from './useTelegramLogin';
|
|
70
71
|
export { useEndUserWarning } from './useEndUserWarning';
|
|
@@ -108,4 +109,4 @@ export type { CheckWalletLockStateParams, UnlockWalletParams, UpdatePasswordPara
|
|
|
108
109
|
export { usePromptWalletUnlock } from './usePromptWalletUnlock';
|
|
109
110
|
export { useGetWalletPassword } from './useGetWalletPassword';
|
|
110
111
|
export { useStepUpAuthentication } from './useStepUpAuthentication';
|
|
111
|
-
export type { StepUpAuthenticationState, UseStepUpAuthenticationParams, UseStepUpAuthenticationReturn, VerifyOtpParams, VerifyWalletParams, } from './useStepUpAuthentication';
|
|
112
|
+
export type { IsStepUpRequiredParams, StepUpAuthenticationState, UseStepUpAuthenticationParams, UseStepUpAuthenticationReturn, VerifyOtpParams, VerifyPasskeyMfaParams, VerifyTotpMfaParams, VerifyWalletParams, } from './useStepUpAuthentication';
|
|
@@ -368,7 +368,7 @@ const useDynamicWaas = () => {
|
|
|
368
368
|
]);
|
|
369
369
|
// If no chain names are provided, filter out chains that already have a wallet
|
|
370
370
|
// and make a wallet for each enabled chain
|
|
371
|
-
const createWalletAccount = React.useCallback((requirementsOrChainNames, password, bitcoinConfig) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
371
|
+
const createWalletAccount = React.useCallback((requirementsOrChainNames, password, bitcoinConfig, options) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
372
372
|
if (isUpgrading.current) {
|
|
373
373
|
return;
|
|
374
374
|
}
|
|
@@ -471,7 +471,10 @@ const useDynamicWaas = () => {
|
|
|
471
471
|
};
|
|
472
472
|
updatePrimaryWalletIfNeeded(primaryWalletAccount, refreshedUser);
|
|
473
473
|
}
|
|
474
|
-
|
|
474
|
+
// close email otp pin modal; skipped in password setup flow (done screen handles close)
|
|
475
|
+
if (!(options === null || options === void 0 ? void 0 : options.skipCloseAuthFlow)) {
|
|
476
|
+
setShowAuthFlow(false, { performMultiWalletChecks: false });
|
|
477
|
+
}
|
|
475
478
|
return createdWalletAccounts;
|
|
476
479
|
}), [
|
|
477
480
|
getWaasWalletConnector,
|
|
@@ -542,7 +545,7 @@ const useDynamicWaas = () => {
|
|
|
542
545
|
});
|
|
543
546
|
yield refresh();
|
|
544
547
|
});
|
|
545
|
-
const upgradeToDynamicWaas = React.useCallback((_j) => _tslib.__awaiter(void 0, [_j], void 0, function* ({ privateKey, wallet, }) {
|
|
548
|
+
const upgradeToDynamicWaas = React.useCallback((_j) => _tslib.__awaiter(void 0, [_j], void 0, function* ({ privateKey, wallet, password, }) {
|
|
546
549
|
isUpgrading.current = true;
|
|
547
550
|
if (!primaryWallet) {
|
|
548
551
|
throw new utils.DynamicError('Primary wallet not found');
|
|
@@ -565,6 +568,7 @@ const useDynamicWaas = () => {
|
|
|
565
568
|
yield walletConnector.importPrivateKey({
|
|
566
569
|
chainName,
|
|
567
570
|
legacyWalletId: normalizedWalletId,
|
|
571
|
+
password,
|
|
568
572
|
privateKey,
|
|
569
573
|
publicAddressCheck: wallet.address,
|
|
570
574
|
});
|
|
@@ -35,6 +35,8 @@ export declare const useDynamicWaas: () => {
|
|
|
35
35
|
createWalletAccount: (requirementsOrChainNames: WalletCreationRequirement[] | ChainEnum[], password?: string, bitcoinConfig?: {
|
|
36
36
|
addressType?: string;
|
|
37
37
|
network?: string;
|
|
38
|
+
}, options?: {
|
|
39
|
+
skipCloseAuthFlow?: boolean;
|
|
38
40
|
}) => Promise<any[] | undefined>;
|
|
39
41
|
dynamicWaasIsEnabled: boolean;
|
|
40
42
|
getWaasWalletConnector: (chainName: string) => IDynamicWaasConnector | undefined;
|
|
@@ -52,8 +54,9 @@ export declare const useDynamicWaas: () => {
|
|
|
52
54
|
needsSettingsProcessing: boolean;
|
|
53
55
|
processSignOnWalletSettings: () => Promise<void>;
|
|
54
56
|
shouldInitializeWaas: boolean;
|
|
55
|
-
upgradeToDynamicWaas: ({ privateKey, wallet, }: {
|
|
57
|
+
upgradeToDynamicWaas: ({ privateKey, wallet, password, }: {
|
|
56
58
|
privateKey: string;
|
|
57
59
|
wallet: Wallet<WalletConnectorCore.WalletConnector>;
|
|
60
|
+
password?: string;
|
|
58
61
|
}) => Promise<void>;
|
|
59
62
|
};
|
|
@@ -364,7 +364,7 @@ const useDynamicWaas = () => {
|
|
|
364
364
|
]);
|
|
365
365
|
// If no chain names are provided, filter out chains that already have a wallet
|
|
366
366
|
// and make a wallet for each enabled chain
|
|
367
|
-
const createWalletAccount = useCallback((requirementsOrChainNames, password, bitcoinConfig) => __awaiter(void 0, void 0, void 0, function* () {
|
|
367
|
+
const createWalletAccount = useCallback((requirementsOrChainNames, password, bitcoinConfig, options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
368
368
|
if (isUpgrading.current) {
|
|
369
369
|
return;
|
|
370
370
|
}
|
|
@@ -467,7 +467,10 @@ const useDynamicWaas = () => {
|
|
|
467
467
|
};
|
|
468
468
|
updatePrimaryWalletIfNeeded(primaryWalletAccount, refreshedUser);
|
|
469
469
|
}
|
|
470
|
-
|
|
470
|
+
// close email otp pin modal; skipped in password setup flow (done screen handles close)
|
|
471
|
+
if (!(options === null || options === void 0 ? void 0 : options.skipCloseAuthFlow)) {
|
|
472
|
+
setShowAuthFlow(false, { performMultiWalletChecks: false });
|
|
473
|
+
}
|
|
471
474
|
return createdWalletAccounts;
|
|
472
475
|
}), [
|
|
473
476
|
getWaasWalletConnector,
|
|
@@ -538,7 +541,7 @@ const useDynamicWaas = () => {
|
|
|
538
541
|
});
|
|
539
542
|
yield refresh();
|
|
540
543
|
});
|
|
541
|
-
const upgradeToDynamicWaas = useCallback((_j) => __awaiter(void 0, [_j], void 0, function* ({ privateKey, wallet, }) {
|
|
544
|
+
const upgradeToDynamicWaas = useCallback((_j) => __awaiter(void 0, [_j], void 0, function* ({ privateKey, wallet, password, }) {
|
|
542
545
|
isUpgrading.current = true;
|
|
543
546
|
if (!primaryWallet) {
|
|
544
547
|
throw new DynamicError('Primary wallet not found');
|
|
@@ -561,6 +564,7 @@ const useDynamicWaas = () => {
|
|
|
561
564
|
yield walletConnector.importPrivateKey({
|
|
562
565
|
chainName,
|
|
563
566
|
legacyWalletId: normalizedWalletId,
|
|
567
|
+
password,
|
|
564
568
|
privateKey,
|
|
565
569
|
publicAddressCheck: wallet.address,
|
|
566
570
|
});
|
|
@@ -5,8 +5,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
|
|
6
6
|
var React = require('react');
|
|
7
7
|
|
|
8
|
-
const useNetworkConfigurationsFromProjectSettings = ({ projectSettings, cosmosNetworkOverrides, evmNetworksOverrides, solanaNetworksOverrides, tronNetworksOverrides, aptosNetworksOverrides, stellarNetworksOverrides, tonNetworksOverrides, bitcoinNetworksOverrides, }) => React.useMemo(() => {
|
|
9
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
8
|
+
const useNetworkConfigurationsFromProjectSettings = ({ projectSettings, aleoNetworksOverrides, cosmosNetworkOverrides, evmNetworksOverrides, solanaNetworksOverrides, tronNetworksOverrides, aptosNetworksOverrides, stellarNetworksOverrides, tonNetworksOverrides, bitcoinNetworksOverrides, }) => React.useMemo(() => {
|
|
9
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
10
10
|
const networks = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.networks;
|
|
11
11
|
if (!networks)
|
|
12
12
|
return {};
|
|
@@ -21,6 +21,7 @@ const useNetworkConfigurationsFromProjectSettings = ({ projectSettings, cosmosNe
|
|
|
21
21
|
const aptos = networks.find((configurations) => configurations.chainName === 'aptos');
|
|
22
22
|
const ton = networks.find((configurations) => configurations.chainName === 'ton');
|
|
23
23
|
const bitcoin = networks.find((configurations) => configurations.chainName === 'bitcoin');
|
|
24
|
+
const aleo = networks.find((configurations) => configurations.chainName === 'aleo');
|
|
24
25
|
let cosmosNetworks = (_a = cosmos === null || cosmos === void 0 ? void 0 : cosmos.networks) === null || _a === void 0 ? void 0 : _a.map((net) => createNetwork(net, Number.parseInt));
|
|
25
26
|
cosmosNetworks = overrideNetworks(cosmosNetworkOverrides, cosmosNetworks);
|
|
26
27
|
let evmNetworks = (_b = evm === null || evm === void 0 ? void 0 : evm.networks) === null || _b === void 0 ? void 0 : _b.map((net) => createNetwork(net, Number.parseInt));
|
|
@@ -48,7 +49,10 @@ const useNetworkConfigurationsFromProjectSettings = ({ projectSettings, cosmosNe
|
|
|
48
49
|
stellarNetworks = overrideNetworks(stellarNetworksOverrides, stellarNetworks);
|
|
49
50
|
let bitcoinNetworks = (_l = bitcoin === null || bitcoin === void 0 ? void 0 : bitcoin.networks) === null || _l === void 0 ? void 0 : _l.map((net) => createNetwork(net, Number.parseInt));
|
|
50
51
|
bitcoinNetworks = overrideNetworks(bitcoinNetworksOverrides, bitcoinNetworks);
|
|
52
|
+
let aleoNetworks = (_m = aleo === null || aleo === void 0 ? void 0 : aleo.networks) === null || _m === void 0 ? void 0 : _m.map((net) => createNetwork(net));
|
|
53
|
+
aleoNetworks = overrideNetworks(aleoNetworksOverrides, aleoNetworks);
|
|
51
54
|
const networkConfigurations = {
|
|
55
|
+
aleo: aleoNetworks,
|
|
52
56
|
aptos: aptosNetworks,
|
|
53
57
|
bitcoin: bitcoinNetworks,
|
|
54
58
|
cosmos: cosmosNetworks,
|
|
@@ -64,6 +68,7 @@ const useNetworkConfigurationsFromProjectSettings = ({ projectSettings, cosmosNe
|
|
|
64
68
|
return networkConfigurations;
|
|
65
69
|
}, [
|
|
66
70
|
projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.networks,
|
|
71
|
+
aleoNetworksOverrides,
|
|
67
72
|
cosmosNetworkOverrides,
|
|
68
73
|
evmNetworksOverrides,
|
|
69
74
|
solanaNetworksOverrides,
|
|
@@ -2,6 +2,7 @@ import type { ProjectSettings } from '@dynamic-labs/sdk-api-core';
|
|
|
2
2
|
import type { NetworksOverrides } from '../../../context/DynamicContext';
|
|
3
3
|
type UseNetworkConfigurationsFromProjectSettingsProps = {
|
|
4
4
|
projectSettings: ProjectSettings | undefined;
|
|
5
|
+
aleoNetworksOverrides?: NetworksOverrides;
|
|
5
6
|
evmNetworksOverrides?: NetworksOverrides;
|
|
6
7
|
cosmosNetworkOverrides?: NetworksOverrides;
|
|
7
8
|
solanaNetworksOverrides?: NetworksOverrides;
|
|
@@ -11,5 +12,5 @@ type UseNetworkConfigurationsFromProjectSettingsProps = {
|
|
|
11
12
|
tonNetworksOverrides?: NetworksOverrides;
|
|
12
13
|
bitcoinNetworksOverrides?: NetworksOverrides;
|
|
13
14
|
};
|
|
14
|
-
export declare const useNetworkConfigurationsFromProjectSettings: ({ projectSettings, cosmosNetworkOverrides, evmNetworksOverrides, solanaNetworksOverrides, tronNetworksOverrides, aptosNetworksOverrides, stellarNetworksOverrides, tonNetworksOverrides, bitcoinNetworksOverrides, }: UseNetworkConfigurationsFromProjectSettingsProps) => {};
|
|
15
|
+
export declare const useNetworkConfigurationsFromProjectSettings: ({ projectSettings, aleoNetworksOverrides, cosmosNetworkOverrides, evmNetworksOverrides, solanaNetworksOverrides, tronNetworksOverrides, aptosNetworksOverrides, stellarNetworksOverrides, tonNetworksOverrides, bitcoinNetworksOverrides, }: UseNetworkConfigurationsFromProjectSettingsProps) => {};
|
|
15
16
|
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
3
|
|
|
4
|
-
const useNetworkConfigurationsFromProjectSettings = ({ projectSettings, cosmosNetworkOverrides, evmNetworksOverrides, solanaNetworksOverrides, tronNetworksOverrides, aptosNetworksOverrides, stellarNetworksOverrides, tonNetworksOverrides, bitcoinNetworksOverrides, }) => useMemo(() => {
|
|
5
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
4
|
+
const useNetworkConfigurationsFromProjectSettings = ({ projectSettings, aleoNetworksOverrides, cosmosNetworkOverrides, evmNetworksOverrides, solanaNetworksOverrides, tronNetworksOverrides, aptosNetworksOverrides, stellarNetworksOverrides, tonNetworksOverrides, bitcoinNetworksOverrides, }) => useMemo(() => {
|
|
5
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
6
6
|
const networks = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.networks;
|
|
7
7
|
if (!networks)
|
|
8
8
|
return {};
|
|
@@ -17,6 +17,7 @@ const useNetworkConfigurationsFromProjectSettings = ({ projectSettings, cosmosNe
|
|
|
17
17
|
const aptos = networks.find((configurations) => configurations.chainName === 'aptos');
|
|
18
18
|
const ton = networks.find((configurations) => configurations.chainName === 'ton');
|
|
19
19
|
const bitcoin = networks.find((configurations) => configurations.chainName === 'bitcoin');
|
|
20
|
+
const aleo = networks.find((configurations) => configurations.chainName === 'aleo');
|
|
20
21
|
let cosmosNetworks = (_a = cosmos === null || cosmos === void 0 ? void 0 : cosmos.networks) === null || _a === void 0 ? void 0 : _a.map((net) => createNetwork(net, Number.parseInt));
|
|
21
22
|
cosmosNetworks = overrideNetworks(cosmosNetworkOverrides, cosmosNetworks);
|
|
22
23
|
let evmNetworks = (_b = evm === null || evm === void 0 ? void 0 : evm.networks) === null || _b === void 0 ? void 0 : _b.map((net) => createNetwork(net, Number.parseInt));
|
|
@@ -44,7 +45,10 @@ const useNetworkConfigurationsFromProjectSettings = ({ projectSettings, cosmosNe
|
|
|
44
45
|
stellarNetworks = overrideNetworks(stellarNetworksOverrides, stellarNetworks);
|
|
45
46
|
let bitcoinNetworks = (_l = bitcoin === null || bitcoin === void 0 ? void 0 : bitcoin.networks) === null || _l === void 0 ? void 0 : _l.map((net) => createNetwork(net, Number.parseInt));
|
|
46
47
|
bitcoinNetworks = overrideNetworks(bitcoinNetworksOverrides, bitcoinNetworks);
|
|
48
|
+
let aleoNetworks = (_m = aleo === null || aleo === void 0 ? void 0 : aleo.networks) === null || _m === void 0 ? void 0 : _m.map((net) => createNetwork(net));
|
|
49
|
+
aleoNetworks = overrideNetworks(aleoNetworksOverrides, aleoNetworks);
|
|
47
50
|
const networkConfigurations = {
|
|
51
|
+
aleo: aleoNetworks,
|
|
48
52
|
aptos: aptosNetworks,
|
|
49
53
|
bitcoin: bitcoinNetworks,
|
|
50
54
|
cosmos: cosmosNetworks,
|
|
@@ -60,6 +64,7 @@ const useNetworkConfigurationsFromProjectSettings = ({ projectSettings, cosmosNe
|
|
|
60
64
|
return networkConfigurations;
|
|
61
65
|
}, [
|
|
62
66
|
projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.networks,
|
|
67
|
+
aleoNetworksOverrides,
|
|
63
68
|
cosmosNetworkOverrides,
|
|
64
69
|
evmNetworksOverrides,
|
|
65
70
|
solanaNetworksOverrides,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useSignEip7702Authorization';
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var _tslib = require('../../../../../_virtual/_tslib.cjs');
|
|
7
|
+
var React = require('react');
|
|
8
|
+
var utils = require('@dynamic-labs/utils');
|
|
9
|
+
require('../../../context/DynamicContext/DynamicContext.cjs');
|
|
10
|
+
require('../../../store/state/loadingAndLifecycle/loadingAndLifecycle.cjs');
|
|
11
|
+
require('@dynamic-labs/iconic');
|
|
12
|
+
require('@dynamic-labs/wallet-connector-core');
|
|
13
|
+
require('react/jsx-runtime');
|
|
14
|
+
require('../../../context/ViewContext/ViewContext.cjs');
|
|
15
|
+
require('../../../shared/logger.cjs');
|
|
16
|
+
require('@dynamic-labs/wallet-book');
|
|
17
|
+
require('../../constants/colors.cjs');
|
|
18
|
+
require('../../constants/values.cjs');
|
|
19
|
+
require('@dynamic-labs/sdk-api-core');
|
|
20
|
+
require('../../../shared/consts/index.cjs');
|
|
21
|
+
require('../../../events/dynamicEvents.cjs');
|
|
22
|
+
require('../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
23
|
+
require('../../../context/ErrorContext/ErrorContext.cjs');
|
|
24
|
+
require('@dynamic-labs/multi-wallet');
|
|
25
|
+
require('react-international-phone');
|
|
26
|
+
require('../../../store/state/nonce/nonce.cjs');
|
|
27
|
+
require('@dynamic-labs-sdk/client/core');
|
|
28
|
+
require('../../../client/client.cjs');
|
|
29
|
+
require('@dynamic-labs-sdk/client');
|
|
30
|
+
require('../../../config/ApiEndpoint.cjs');
|
|
31
|
+
require('@dynamic-labs/locale');
|
|
32
|
+
require('../../../store/state/dynamicContextProps/dynamicContextProps.cjs');
|
|
33
|
+
require('../../../store/state/primaryWalletId/primaryWalletId.cjs');
|
|
34
|
+
require('../../../store/state/connectedWalletsInfo/connectedWalletsInfo.cjs');
|
|
35
|
+
require('../../functions/getWaasAddressTypeLabel/getWaasAddressTypeLabel.cjs');
|
|
36
|
+
require('../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
37
|
+
require('../../../context/AccountExistsContext/AccountExistsContext.cjs');
|
|
38
|
+
require('../../../context/UserWalletsContext/UserWalletsContext.cjs');
|
|
39
|
+
require('../../../store/state/authMode/authMode.cjs');
|
|
40
|
+
require('../../../context/VerificationContext/VerificationContext.cjs');
|
|
41
|
+
require('react-dom');
|
|
42
|
+
require('../../functions/compareChains/compareChains.cjs');
|
|
43
|
+
require('../../../views/Passkey/utils/findPrimaryEmbeddedChain/findPrimaryEmbeddedChain.cjs');
|
|
44
|
+
require('../../../context/ThemeContext/ThemeContext.cjs');
|
|
45
|
+
require('../useUserUpdateRequest/useUpdateUser/userFieldsSchema.cjs');
|
|
46
|
+
require('bs58');
|
|
47
|
+
require('@dynamic-labs/types');
|
|
48
|
+
require('../../../context/SocialRedirectContext/SocialRedirectContext.cjs');
|
|
49
|
+
require('../../../context/LoadingContext/LoadingContext.cjs');
|
|
50
|
+
require('../../../context/WalletContext/WalletContext.cjs');
|
|
51
|
+
require('../useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.cjs');
|
|
52
|
+
require('yup');
|
|
53
|
+
require('../../../context/MockContext/MockContext.cjs');
|
|
54
|
+
require('../../../views/CollectUserDataView/useFields.cjs');
|
|
55
|
+
require('../../../context/FieldsStateContext/FieldsStateContext.cjs');
|
|
56
|
+
require('../../../context/UserFieldEditorContext/UserFieldEditorContext.cjs');
|
|
57
|
+
require('@dynamic-labs/rpc-providers');
|
|
58
|
+
require('../../../store/state/walletOptions/walletOptions.cjs');
|
|
59
|
+
require('react-i18next');
|
|
60
|
+
require('../../../components/Accordion/components/AccordionItem/AccordionItem.cjs');
|
|
61
|
+
require('../../../components/Alert/Alert.cjs');
|
|
62
|
+
require('../../../components/ShadowDOM/ShadowDOM.cjs');
|
|
63
|
+
require('../../../components/IconButton/IconButton.cjs');
|
|
64
|
+
require('../../../components/InlineWidget/InlineWidget.cjs');
|
|
65
|
+
require('../../../components/Input/Input.cjs');
|
|
66
|
+
require('../../../components/IsBrowser/IsBrowser.cjs');
|
|
67
|
+
require('../../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
68
|
+
require('../../../components/OverlayCard/OverlayCard.cjs');
|
|
69
|
+
require('../../../components/Transition/ZoomTransition/ZoomTransition.cjs');
|
|
70
|
+
require('../../../components/Transition/SlideInUpTransition/SlideInUpTransition.cjs');
|
|
71
|
+
require('../../../components/Transition/OpacityTransition/OpacityTransition.cjs');
|
|
72
|
+
require('../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.cjs');
|
|
73
|
+
require('../../../components/Popper/Popper/Popper.cjs');
|
|
74
|
+
require('../../../components/Popper/PopperContext/PopperContext.cjs');
|
|
75
|
+
require('react-focus-lock');
|
|
76
|
+
require('qrcode');
|
|
77
|
+
require('formik');
|
|
78
|
+
require('../useSubdomainCheck/useSubdomainCheck.cjs');
|
|
79
|
+
require('../../../context/WalletGroupContext/WalletGroupContext.cjs');
|
|
80
|
+
require('../../../widgets/DynamicWidget/context/DynamicWidgetContext.cjs');
|
|
81
|
+
require('../useWalletBackup/useWalletBackup.cjs');
|
|
82
|
+
require('../useWalletBackup/types.cjs');
|
|
83
|
+
require('../useWalletBackup/cloudProviders.cjs');
|
|
84
|
+
require('../../../context/IpConfigurationContext/IpConfigurationContext.cjs');
|
|
85
|
+
require('../../../context/ConnectWithOtpContext/ConnectWithOtpContext.cjs');
|
|
86
|
+
require('../../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs');
|
|
87
|
+
require('@hcaptcha/react-hcaptcha');
|
|
88
|
+
require('../../../widgets/DynamicWidget/helpers/convertExchangeKeyAndProviderEnum.cjs');
|
|
89
|
+
require('../../../views/ExchangeWhitelistWarning/ExchangeWhitelistWarning.cjs');
|
|
90
|
+
require('../../../context/ErrorContext/hooks/useErrorText/useErrorText.cjs');
|
|
91
|
+
require('../../../context/FooterAnimationContext/index.cjs');
|
|
92
|
+
require('../../../views/MfaChooseDeviceView/useGetMfaOptions/useGetMfaOptions.cjs');
|
|
93
|
+
require('../../../context/PasskeyContext/PasskeyContext.cjs');
|
|
94
|
+
require('../../../context/OnrampContext/OnrampContext.cjs');
|
|
95
|
+
require('../../../store/state/sendBalances.cjs');
|
|
96
|
+
require('../../../store/state/connectorsInitializing/connectorsInitializing.cjs');
|
|
97
|
+
require('../../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.cjs');
|
|
98
|
+
require('../../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.cjs');
|
|
99
|
+
require('../../../views/TransactionConfirmationView/TransactionConfirmationView.cjs');
|
|
100
|
+
require('../../../widgets/DynamicWidget/components/PasskeyCard/PasskeyCard.cjs');
|
|
101
|
+
require('../../../widgets/DynamicWidget/views/CryptoComOnramp/CryptoComOnramp.cjs');
|
|
102
|
+
require('../../../../index.cjs');
|
|
103
|
+
require('../../../widgets/DynamicWidget/views/ReceiveWalletFunds/ReceiveWalletFunds.cjs');
|
|
104
|
+
require('../../../store/state/tokenBalances.cjs');
|
|
105
|
+
require('../../../store/state/multichainBalances.cjs');
|
|
106
|
+
require('../../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
|
|
107
|
+
var useInternalDynamicContext = require('../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.cjs');
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Hook for signing EIP-7702 authorizations for ZeroDev kernel delegation.
|
|
111
|
+
*
|
|
112
|
+
* This hook provides a way to sign EIP-7702 authorizations that enable
|
|
113
|
+
* single-use MFA flows where the authorization signing step is separated
|
|
114
|
+
* from the transaction execution step.
|
|
115
|
+
*
|
|
116
|
+
* The signed authorization can be passed to kernel account client creation
|
|
117
|
+
* functions like `createEcdsaKernelAccountClientWith7702`.
|
|
118
|
+
*
|
|
119
|
+
* @returns An object containing the `signEip7702Authorization` function
|
|
120
|
+
*
|
|
121
|
+
* @example
|
|
122
|
+
* ```tsx
|
|
123
|
+
* import { useSignEip7702Authorization } from '@dynamic-labs/sdk-react-core';
|
|
124
|
+
*
|
|
125
|
+
* function MyComponent() {
|
|
126
|
+
* const { signEip7702Authorization } = useSignEip7702Authorization();
|
|
127
|
+
*
|
|
128
|
+
* const handleSign = async () => {
|
|
129
|
+
* try {
|
|
130
|
+
* const auth = await signEip7702Authorization();
|
|
131
|
+
* console.log('Signed authorization:', auth);
|
|
132
|
+
* // Use auth with kernel client creation
|
|
133
|
+
* } catch (error) {
|
|
134
|
+
* console.error('Failed to sign authorization:', error);
|
|
135
|
+
* }
|
|
136
|
+
* };
|
|
137
|
+
*
|
|
138
|
+
* return <button onClick={handleSign}>Sign Authorization</button>;
|
|
139
|
+
* }
|
|
140
|
+
* ```
|
|
141
|
+
*/
|
|
142
|
+
const useSignEip7702Authorization = () => {
|
|
143
|
+
const { primaryWallet } = useInternalDynamicContext.useInternalDynamicContext();
|
|
144
|
+
const signEip7702Auth = React.useCallback((params) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
145
|
+
var _a;
|
|
146
|
+
const { wallet: providedWallet, chainId: providedChainId } = params !== null && params !== void 0 ? params : {};
|
|
147
|
+
// Use provided wallet or fallback to primary wallet
|
|
148
|
+
const wallet = providedWallet !== null && providedWallet !== void 0 ? providedWallet : primaryWallet;
|
|
149
|
+
if (!wallet) {
|
|
150
|
+
throw new utils.DynamicError('No wallet available. Please connect a wallet first.');
|
|
151
|
+
}
|
|
152
|
+
if (((_a = wallet.connector) === null || _a === void 0 ? void 0 : _a.key) !== 'zerodev') {
|
|
153
|
+
throw new utils.DynamicError('The wallet connector must be a ZeroDev connector to sign EIP-7702 authorizations.');
|
|
154
|
+
}
|
|
155
|
+
return wallet.connector.signEip7702PreAuth(providedChainId);
|
|
156
|
+
}), [primaryWallet]);
|
|
157
|
+
return {
|
|
158
|
+
signEip7702Authorization: signEip7702Auth,
|
|
159
|
+
};
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
exports.useSignEip7702Authorization = useSignEip7702Authorization;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { IZeroDevConnector, Wallet } from '@dynamic-labs/wallet-connector-core';
|
|
2
|
+
export type Eip7702Authorization = Awaited<ReturnType<IZeroDevConnector['signEip7702PreAuth']>>;
|
|
3
|
+
export type SignEip7702AuthorizationParams = {
|
|
4
|
+
/**
|
|
5
|
+
* The wallet to sign the EIP-7702 authorization with.
|
|
6
|
+
* If not provided, uses the primary wallet.
|
|
7
|
+
*/
|
|
8
|
+
wallet?: Wallet;
|
|
9
|
+
/**
|
|
10
|
+
* The chain ID to sign the authorization for.
|
|
11
|
+
* If not provided, uses the wallet's current network chain ID.
|
|
12
|
+
*/
|
|
13
|
+
chainId?: number;
|
|
14
|
+
};
|
|
15
|
+
export type UseSignEip7702AuthorizationReturn = {
|
|
16
|
+
/**
|
|
17
|
+
* Signs an EIP-7702 authorization for ZeroDev kernel delegation.
|
|
18
|
+
*
|
|
19
|
+
* This creates a signed authorization that allows a wallet to delegate
|
|
20
|
+
* its execution to the ZeroDev kernel contract. The signed authorization can then
|
|
21
|
+
* be passed to kernel account client creation functions.
|
|
22
|
+
*
|
|
23
|
+
* @param params - Optional parameters for signing the authorization
|
|
24
|
+
* @returns A promise that resolves to the signed EIP-7702 authorization
|
|
25
|
+
* @throws {DynamicError} If the wallet connector is not a ZeroDev connector
|
|
26
|
+
* @throws {DynamicError} If no wallet is available
|
|
27
|
+
* @throws {DynamicError} If the connector does not support EIP-7702 authorization
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```tsx
|
|
31
|
+
* const { signEip7702Authorization } = useSignEip7702Authorization();
|
|
32
|
+
*
|
|
33
|
+
* // Sign with primary wallet and current network
|
|
34
|
+
* const auth = await signEip7702Authorization();
|
|
35
|
+
*
|
|
36
|
+
* // Sign with specific wallet and chain ID
|
|
37
|
+
* const auth = await signEip7702Authorization({
|
|
38
|
+
* wallet: myWallet,
|
|
39
|
+
* chainId: 1, // Ethereum mainnet
|
|
40
|
+
* });
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
signEip7702Authorization: (params?: SignEip7702AuthorizationParams) => Promise<Eip7702Authorization>;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Hook for signing EIP-7702 authorizations for ZeroDev kernel delegation.
|
|
47
|
+
*
|
|
48
|
+
* This hook provides a way to sign EIP-7702 authorizations that enable
|
|
49
|
+
* single-use MFA flows where the authorization signing step is separated
|
|
50
|
+
* from the transaction execution step.
|
|
51
|
+
*
|
|
52
|
+
* The signed authorization can be passed to kernel account client creation
|
|
53
|
+
* functions like `createEcdsaKernelAccountClientWith7702`.
|
|
54
|
+
*
|
|
55
|
+
* @returns An object containing the `signEip7702Authorization` function
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```tsx
|
|
59
|
+
* import { useSignEip7702Authorization } from '@dynamic-labs/sdk-react-core';
|
|
60
|
+
*
|
|
61
|
+
* function MyComponent() {
|
|
62
|
+
* const { signEip7702Authorization } = useSignEip7702Authorization();
|
|
63
|
+
*
|
|
64
|
+
* const handleSign = async () => {
|
|
65
|
+
* try {
|
|
66
|
+
* const auth = await signEip7702Authorization();
|
|
67
|
+
* console.log('Signed authorization:', auth);
|
|
68
|
+
* // Use auth with kernel client creation
|
|
69
|
+
* } catch (error) {
|
|
70
|
+
* console.error('Failed to sign authorization:', error);
|
|
71
|
+
* }
|
|
72
|
+
* };
|
|
73
|
+
*
|
|
74
|
+
* return <button onClick={handleSign}>Sign Authorization</button>;
|
|
75
|
+
* }
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
export declare const useSignEip7702Authorization: () => UseSignEip7702AuthorizationReturn;
|