@dynamic-labs/sdk-react-core 0.18.0-RC.4 → 0.18.0-RC.6
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 +9 -9
- package/src/index.cjs +2 -0
- package/src/index.js +1 -0
- package/src/lib/shared/assets/index.d.ts +1 -0
- package/src/lib/shared/assets/key.cjs +53 -0
- package/src/lib/shared/assets/key.js +29 -0
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletInformation.cjs +11 -2
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletInformation.js +11 -2
- package/src/lib/widgets/DynamicWidget/components/Wallet/Wallet.cjs +10 -1
- package/src/lib/widgets/DynamicWidget/components/Wallet/Wallet.js +11 -2
- package/src/lib/widgets/DynamicWidget/helpers/helpers.cjs +18 -1
- package/src/lib/widgets/DynamicWidget/helpers/helpers.d.ts +3 -0
- package/src/lib/widgets/DynamicWidget/helpers/helpers.js +18 -2
- package/src/polyfills.cjs +1 -2
- package/src/polyfills.js +1 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,24 @@
|
|
|
1
1
|
|
|
2
|
+
## [0.18.0-RC.6](https://github.com/dynamic-labs/DynamicAuth/compare/v0.18.0-RC.5...v0.18.0-RC.6) (2023-06-20)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* add export keys option for magic wallets ([#2377](https://github.com/dynamic-labs/DynamicAuth/issues/2377)) ([6b40f53](https://github.com/dynamic-labs/DynamicAuth/commit/6b40f538f207691b54fe2f245ed6018c467b83fe))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* add polyfill for css layers ([#2386](https://github.com/dynamic-labs/DynamicAuth/issues/2386)) ([3d489f5](https://github.com/dynamic-labs/DynamicAuth/commit/3d489f59d676864134a94d031697e0f83fc0d742))
|
|
13
|
+
|
|
14
|
+
## [0.18.0-RC.5](https://github.com/dynamic-labs/DynamicAuth/compare/v0.18.0-RC.4...v0.18.0-RC.5) (2023-06-20)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* remove process variable declaration ([#2389](https://github.com/dynamic-labs/DynamicAuth/issues/2389)) ([3c05121](https://github.com/dynamic-labs/DynamicAuth/commit/3c05121473850444f2c8393fa6e98e10d58870bc))
|
|
20
|
+
* wallet book singleton class to initalize when walletBook is undefined ([#2392](https://github.com/dynamic-labs/DynamicAuth/issues/2392)) ([7e07137](https://github.com/dynamic-labs/DynamicAuth/commit/7e0713712321439ee48e0c9ec88fef8c9aecd9cf))
|
|
21
|
+
|
|
2
22
|
## [0.18.0-RC.4](https://github.com/dynamic-labs/DynamicAuth/compare/v0.18.0-RC.3...v0.18.0-RC.4) (2023-06-20)
|
|
3
23
|
|
|
4
24
|
|
package/package.cjs
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var version = "0.18.0-RC.
|
|
5
|
+
var version = "0.18.0-RC.6";
|
|
6
6
|
var dependencies = {
|
|
7
7
|
"react-focus-lock": "2.9.2",
|
|
8
8
|
"@dynamic-labs/iconic": "0.1.23",
|
|
9
|
-
"@dynamic-labs/sdk-api": "0.0.
|
|
9
|
+
"@dynamic-labs/sdk-api": "0.0.222",
|
|
10
10
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
|
11
11
|
"country-list": "2.3.0",
|
|
12
12
|
yup: "0.32.11",
|
package/package.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var version = "0.18.0-RC.
|
|
1
|
+
var version = "0.18.0-RC.6";
|
|
2
2
|
var dependencies = {
|
|
3
3
|
"react-focus-lock": "2.9.2",
|
|
4
4
|
"@dynamic-labs/iconic": "0.1.23",
|
|
5
|
-
"@dynamic-labs/sdk-api": "0.0.
|
|
5
|
+
"@dynamic-labs/sdk-api": "0.0.222",
|
|
6
6
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
|
7
7
|
"country-list": "2.3.0",
|
|
8
8
|
yup: "0.32.11",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/sdk-react-core",
|
|
3
|
-
"version": "0.18.0-RC.
|
|
3
|
+
"version": "0.18.0-RC.6",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/dynamic-labs/DynamicAuth.git",
|
|
@@ -9,20 +9,20 @@
|
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"react-focus-lock": "2.9.2",
|
|
11
11
|
"@dynamic-labs/iconic": "0.1.23",
|
|
12
|
-
"@dynamic-labs/sdk-api": "0.0.
|
|
12
|
+
"@dynamic-labs/sdk-api": "0.0.222",
|
|
13
13
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
|
14
14
|
"country-list": "2.3.0",
|
|
15
15
|
"yup": "0.32.11",
|
|
16
16
|
"formik": "2.2.9",
|
|
17
17
|
"qrcode": "1.5.1",
|
|
18
18
|
"ethers": "5.7.2",
|
|
19
|
-
"@dynamic-labs/logger": "0.18.0-RC.
|
|
20
|
-
"@dynamic-labs/multi-wallet": "0.18.0-RC.
|
|
21
|
-
"@dynamic-labs/rpc-providers": "0.18.0-RC.
|
|
22
|
-
"@dynamic-labs/types": "0.18.0-RC.
|
|
23
|
-
"@dynamic-labs/utils": "0.18.0-RC.
|
|
24
|
-
"@dynamic-labs/wallet-book": "0.18.0-RC.
|
|
25
|
-
"@dynamic-labs/wallet-connector-core": "0.18.0-RC.
|
|
19
|
+
"@dynamic-labs/logger": "0.18.0-RC.6",
|
|
20
|
+
"@dynamic-labs/multi-wallet": "0.18.0-RC.6",
|
|
21
|
+
"@dynamic-labs/rpc-providers": "0.18.0-RC.6",
|
|
22
|
+
"@dynamic-labs/types": "0.18.0-RC.6",
|
|
23
|
+
"@dynamic-labs/utils": "0.18.0-RC.6",
|
|
24
|
+
"@dynamic-labs/wallet-book": "0.18.0-RC.6",
|
|
25
|
+
"@dynamic-labs/wallet-connector-core": "0.18.0-RC.6"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"semver": "7.3.8"
|
package/src/index.cjs
CHANGED
|
@@ -60,6 +60,7 @@ var footerInfoIcon = require('./lib/shared/assets/footer-info-icon.cjs');
|
|
|
60
60
|
var footerEyeIcon = require('./lib/shared/assets/footer-eye-icon.cjs');
|
|
61
61
|
var footerGasIcon = require('./lib/shared/assets/footer-gas-icon.cjs');
|
|
62
62
|
var footerKeyIcon = require('./lib/shared/assets/footer-key-icon.cjs');
|
|
63
|
+
var key = require('./lib/shared/assets/key.cjs');
|
|
63
64
|
var puzzle = require('./lib/shared/assets/puzzle.cjs');
|
|
64
65
|
var link = require('./lib/shared/assets/link.cjs');
|
|
65
66
|
var externalLink = require('./lib/shared/assets/externalLink.cjs');
|
|
@@ -181,6 +182,7 @@ exports.InfoIcon = footerInfoIcon.ReactComponent;
|
|
|
181
182
|
exports.EyeIcon = footerEyeIcon.ReactComponent;
|
|
182
183
|
exports.GasIcon = footerGasIcon.ReactComponent;
|
|
183
184
|
exports.KeyIcon = footerKeyIcon.ReactComponent;
|
|
185
|
+
exports.KeyOutlineIcon = key.ReactComponent;
|
|
184
186
|
exports.PuzzleIcon = puzzle.ReactComponent;
|
|
185
187
|
exports.LinkIcon = link.ReactComponent;
|
|
186
188
|
exports.ExternalLinkIcon = externalLink.ReactComponent;
|
package/src/index.js
CHANGED
|
@@ -56,6 +56,7 @@ export { ReactComponent as InfoIcon } from './lib/shared/assets/footer-info-icon
|
|
|
56
56
|
export { ReactComponent as EyeIcon } from './lib/shared/assets/footer-eye-icon.js';
|
|
57
57
|
export { ReactComponent as GasIcon } from './lib/shared/assets/footer-gas-icon.js';
|
|
58
58
|
export { ReactComponent as KeyIcon } from './lib/shared/assets/footer-key-icon.js';
|
|
59
|
+
export { ReactComponent as KeyOutlineIcon } from './lib/shared/assets/key.js';
|
|
59
60
|
export { ReactComponent as PuzzleIcon } from './lib/shared/assets/puzzle.js';
|
|
60
61
|
export { ReactComponent as LinkIcon } from './lib/shared/assets/link.js';
|
|
61
62
|
export { ReactComponent as ExternalLinkIcon } from './lib/shared/assets/externalLink.js';
|
|
@@ -21,6 +21,7 @@ export { ReactComponent as InfoIcon } from './footer-info-icon.svg';
|
|
|
21
21
|
export { ReactComponent as EyeIcon } from './footer-eye-icon.svg';
|
|
22
22
|
export { ReactComponent as GasIcon } from './footer-gas-icon.svg';
|
|
23
23
|
export { ReactComponent as KeyIcon } from './footer-key-icon.svg';
|
|
24
|
+
export { ReactComponent as KeyOutlineIcon } from './key.svg';
|
|
24
25
|
export { ReactComponent as PuzzleIcon } from './puzzle.svg';
|
|
25
26
|
export { ReactComponent as LinkIcon } from './link.svg';
|
|
26
27
|
export { ReactComponent as ExternalLinkIcon } from './externalLink.svg';
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var React = require('react');
|
|
6
|
+
|
|
7
|
+
function _interopNamespace(e) {
|
|
8
|
+
if (e && e.__esModule) return e;
|
|
9
|
+
var n = Object.create(null);
|
|
10
|
+
if (e) {
|
|
11
|
+
Object.keys(e).forEach(function (k) {
|
|
12
|
+
if (k !== 'default') {
|
|
13
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
14
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function () { return e[k]; }
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
n["default"] = e;
|
|
22
|
+
return Object.freeze(n);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
26
|
+
|
|
27
|
+
var _path;
|
|
28
|
+
var _excluded = ["title", "titleId"];
|
|
29
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
30
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
31
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
32
|
+
var SvgKey = function SvgKey(_ref) {
|
|
33
|
+
var title = _ref.title,
|
|
34
|
+
titleId = _ref.titleId,
|
|
35
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
36
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends({
|
|
37
|
+
width: 18,
|
|
38
|
+
height: 18,
|
|
39
|
+
viewBox: "0 0 18 18",
|
|
40
|
+
fill: "none",
|
|
41
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
42
|
+
"aria-labelledby": titleId
|
|
43
|
+
}, props), title ? /*#__PURE__*/React__namespace.createElement("title", {
|
|
44
|
+
id: titleId
|
|
45
|
+
}, title) : null, _path || (_path = /*#__PURE__*/React__namespace.createElement("path", {
|
|
46
|
+
fillRule: "evenodd",
|
|
47
|
+
clipRule: "evenodd",
|
|
48
|
+
d: "M11.25 3a3.751 3.751 0 0 0-3.59 4.84.743.743 0 0 1-.187.746L3 13.062V15h1.5v-.75a.75.75 0 0 1 .75-.75H6v-.75a.75.75 0 0 1 .75-.75h1.188l1.476-1.473a.743.743 0 0 1 .746-.187A3.751 3.751 0 1 0 11.25 3ZM6 15v.75a.75.75 0 0 1-.75.75H3A1.5 1.5 0 0 1 1.5 15v-1.938c0-.398.156-.78.438-1.062l4.171-4.172A5.251 5.251 0 0 1 11.25 1.5a5.251 5.251 0 0 1 5.251 5.25 5.251 5.251 0 0 1-6.328 5.14l-1.39 1.391a.75.75 0 0 1-.532.219H7.5v.75a.75.75 0 0 1-.75.75Zm4.5-9.75a.75.75 0 0 1 .75-.75 2.25 2.25 0 0 1 2.25 2.25.75.75 0 0 1-1.5 0 .75.75 0 0 0-.75-.75.75.75 0 0 1-.75-.75Zm0 0",
|
|
49
|
+
fill: "currentColor"
|
|
50
|
+
})));
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
exports.ReactComponent = SvgKey;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
var _path;
|
|
4
|
+
var _excluded = ["title", "titleId"];
|
|
5
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
6
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
7
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
8
|
+
var SvgKey = function SvgKey(_ref) {
|
|
9
|
+
var title = _ref.title,
|
|
10
|
+
titleId = _ref.titleId,
|
|
11
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
12
|
+
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
13
|
+
width: 18,
|
|
14
|
+
height: 18,
|
|
15
|
+
viewBox: "0 0 18 18",
|
|
16
|
+
fill: "none",
|
|
17
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
18
|
+
"aria-labelledby": titleId
|
|
19
|
+
}, props), title ? /*#__PURE__*/React.createElement("title", {
|
|
20
|
+
id: titleId
|
|
21
|
+
}, title) : null, _path || (_path = /*#__PURE__*/React.createElement("path", {
|
|
22
|
+
fillRule: "evenodd",
|
|
23
|
+
clipRule: "evenodd",
|
|
24
|
+
d: "M11.25 3a3.751 3.751 0 0 0-3.59 4.84.743.743 0 0 1-.187.746L3 13.062V15h1.5v-.75a.75.75 0 0 1 .75-.75H6v-.75a.75.75 0 0 1 .75-.75h1.188l1.476-1.473a.743.743 0 0 1 .746-.187A3.751 3.751 0 1 0 11.25 3ZM6 15v.75a.75.75 0 0 1-.75.75H3A1.5 1.5 0 0 1 1.5 15v-1.938c0-.398.156-.78.438-1.062l4.171-4.172A5.251 5.251 0 0 1 11.25 1.5a5.251 5.251 0 0 1 5.251 5.25 5.251 5.251 0 0 1-6.328 5.14l-1.39 1.391a.75.75 0 0 1-.532.219H7.5v.75a.75.75 0 0 1-.75.75Zm4.5-9.75a.75.75 0 0 1 .75-.75 2.25 2.25 0 0 1 2.25 2.25.75.75 0 0 1-1.5 0 .75.75 0 0 0-.75-.75.75.75 0 0 1-.75-.75Zm0 0",
|
|
25
|
+
fill: "currentColor"
|
|
26
|
+
})));
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export { SvgKey as ReactComponent };
|
package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletInformation.cjs
CHANGED
|
@@ -7,7 +7,7 @@ var React = require('react');
|
|
|
7
7
|
var utils = require('@dynamic-labs/utils');
|
|
8
8
|
var Typography = require('../../../../components/Typography/Typography.cjs');
|
|
9
9
|
require('@dynamic-labs/sdk-api');
|
|
10
|
-
require('../../../../shared/logger.cjs');
|
|
10
|
+
var logger = require('../../../../shared/logger.cjs');
|
|
11
11
|
require('@dynamic-labs/iconic');
|
|
12
12
|
require('@dynamic-labs/wallet-connector-core');
|
|
13
13
|
require('../../../../context/ViewContext/ViewContext.cjs');
|
|
@@ -47,13 +47,15 @@ var NetworkPicker = require('../../../../components/NetworkPicker/NetworkPicker.
|
|
|
47
47
|
var useFetchNameService = require('../../hooks/useFetchNameService/useFetchNameService.cjs');
|
|
48
48
|
var DotsMenu = require('../DotsMenu/DotsMenu.cjs');
|
|
49
49
|
var AuthProviderIcon = require('../../../../components/AuthProviderIcon/AuthProviderIcon.cjs');
|
|
50
|
+
var helpers = require('../../helpers/helpers.cjs');
|
|
50
51
|
|
|
51
52
|
const ICON_SIZE = 28;
|
|
52
53
|
const ActiveWalletInformation = () => {
|
|
53
54
|
const [isNetworkPickerOpen, setIsNetworkPickerOpen] = React.useState(false);
|
|
54
|
-
const { primaryWallet, authToken, network, handleLogOut } = useInternalDynamicContext.useInternalDynamicContext();
|
|
55
|
+
const { primaryWallet, authToken, network, handleLogOut, projectSettings } = useInternalDynamicContext.useInternalDynamicContext();
|
|
55
56
|
const address = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.address;
|
|
56
57
|
const nameService = useFetchNameService.useFetchNameService(address);
|
|
58
|
+
const exportKeysOption = helpers.getExportKeysOption(primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector, projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers);
|
|
57
59
|
const options = [
|
|
58
60
|
{
|
|
59
61
|
Icon: null,
|
|
@@ -67,6 +69,13 @@ const ActiveWalletInformation = () => {
|
|
|
67
69
|
hide: !address,
|
|
68
70
|
text: 'Copy wallet address',
|
|
69
71
|
},
|
|
72
|
+
{
|
|
73
|
+
Icon: null,
|
|
74
|
+
callback: exportKeysOption ||
|
|
75
|
+
(() => logger.logger.info('No option to export private keys')),
|
|
76
|
+
hide: !exportKeysOption,
|
|
77
|
+
text: 'Export private keys',
|
|
78
|
+
},
|
|
70
79
|
{
|
|
71
80
|
Icon: null,
|
|
72
81
|
callback: () => handleLogOut(),
|
package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletInformation.js
CHANGED
|
@@ -3,7 +3,7 @@ import { useState } from 'react';
|
|
|
3
3
|
import { isMobile } from '@dynamic-labs/utils';
|
|
4
4
|
import { Typography } from '../../../../components/Typography/Typography.js';
|
|
5
5
|
import '@dynamic-labs/sdk-api';
|
|
6
|
-
import '../../../../shared/logger.js';
|
|
6
|
+
import { logger } from '../../../../shared/logger.js';
|
|
7
7
|
import '@dynamic-labs/iconic';
|
|
8
8
|
import '@dynamic-labs/wallet-connector-core';
|
|
9
9
|
import '../../../../context/ViewContext/ViewContext.js';
|
|
@@ -43,13 +43,15 @@ import { NetworkPicker } from '../../../../components/NetworkPicker/NetworkPicke
|
|
|
43
43
|
import { useFetchNameService } from '../../hooks/useFetchNameService/useFetchNameService.js';
|
|
44
44
|
import { DotsMenu } from '../DotsMenu/DotsMenu.js';
|
|
45
45
|
import { AuthProviderIcon } from '../../../../components/AuthProviderIcon/AuthProviderIcon.js';
|
|
46
|
+
import { getExportKeysOption } from '../../helpers/helpers.js';
|
|
46
47
|
|
|
47
48
|
const ICON_SIZE = 28;
|
|
48
49
|
const ActiveWalletInformation = () => {
|
|
49
50
|
const [isNetworkPickerOpen, setIsNetworkPickerOpen] = useState(false);
|
|
50
|
-
const { primaryWallet, authToken, network, handleLogOut } = useInternalDynamicContext();
|
|
51
|
+
const { primaryWallet, authToken, network, handleLogOut, projectSettings } = useInternalDynamicContext();
|
|
51
52
|
const address = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.address;
|
|
52
53
|
const nameService = useFetchNameService(address);
|
|
54
|
+
const exportKeysOption = getExportKeysOption(primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector, projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers);
|
|
53
55
|
const options = [
|
|
54
56
|
{
|
|
55
57
|
Icon: null,
|
|
@@ -63,6 +65,13 @@ const ActiveWalletInformation = () => {
|
|
|
63
65
|
hide: !address,
|
|
64
66
|
text: 'Copy wallet address',
|
|
65
67
|
},
|
|
68
|
+
{
|
|
69
|
+
Icon: null,
|
|
70
|
+
callback: exportKeysOption ||
|
|
71
|
+
(() => logger.info('No option to export private keys')),
|
|
72
|
+
hide: !exportKeysOption,
|
|
73
|
+
text: 'Export private keys',
|
|
74
|
+
},
|
|
66
75
|
{
|
|
67
76
|
Icon: null,
|
|
68
77
|
callback: () => handleLogOut(),
|
|
@@ -10,6 +10,7 @@ require('../../../../context/ViewContext/ViewContext.cjs');
|
|
|
10
10
|
require('react');
|
|
11
11
|
var copy = require('../../../../shared/assets/copy.cjs');
|
|
12
12
|
var unlink = require('../../../../shared/assets/unlink.cjs');
|
|
13
|
+
var key = require('../../../../shared/assets/key.cjs');
|
|
13
14
|
var switchHorizontal = require('../../../../shared/assets/switch-horizontal.cjs');
|
|
14
15
|
require('@dynamic-labs/sdk-api');
|
|
15
16
|
require('../../../../shared/logger.cjs');
|
|
@@ -52,7 +53,7 @@ var AuthProviderIcon = require('../../../../components/AuthProviderIcon/AuthProv
|
|
|
52
53
|
const Wallet = ({ wallet, ens }) => {
|
|
53
54
|
var _a;
|
|
54
55
|
const { id: walletId, connector, address } = wallet;
|
|
55
|
-
const { computeConnectedStateForWallets, setPrimaryWallet, setSelectedWalletConnector, setShowWidgetStatePopup, setSelectedWalletWithAction, authToken, primaryWallet, user, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
56
|
+
const { computeConnectedStateForWallets, setPrimaryWallet, setSelectedWalletConnector, setShowWidgetStatePopup, setSelectedWalletWithAction, authToken, primaryWallet, user, projectSettings, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
56
57
|
const email = (_a = user === null || user === void 0 ? void 0 : user.verifiedCredentials.find((verifiedCredential) => verifiedCredential.format === 'email')) === null || _a === void 0 ? void 0 : _a.email;
|
|
57
58
|
const iconSize = 20;
|
|
58
59
|
const options = [
|
|
@@ -81,6 +82,14 @@ const Wallet = ({ wallet, ens }) => {
|
|
|
81
82
|
text: 'Unlink from my account',
|
|
82
83
|
});
|
|
83
84
|
}
|
|
85
|
+
const exportKeysOption = helpers.getExportKeysOption(connector, projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers);
|
|
86
|
+
if (exportKeysOption) {
|
|
87
|
+
options.push({
|
|
88
|
+
Icon: jsxRuntime.jsx(key.ReactComponent, {}),
|
|
89
|
+
callback: exportKeysOption,
|
|
90
|
+
text: 'Export private keys',
|
|
91
|
+
});
|
|
92
|
+
}
|
|
84
93
|
const onSelectWalletClick = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
85
94
|
if ((primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.chain) === 'flow' &&
|
|
86
95
|
connector.connectedChain === 'FLOW') {
|
|
@@ -6,6 +6,7 @@ import '../../../../context/ViewContext/ViewContext.js';
|
|
|
6
6
|
import 'react';
|
|
7
7
|
import { ReactComponent as SvgCopy } from '../../../../shared/assets/copy.js';
|
|
8
8
|
import { ReactComponent as SvgUnlink } from '../../../../shared/assets/unlink.js';
|
|
9
|
+
import { ReactComponent as SvgKey } from '../../../../shared/assets/key.js';
|
|
9
10
|
import { ReactComponent as SvgSwitchHorizontal } from '../../../../shared/assets/switch-horizontal.js';
|
|
10
11
|
import '@dynamic-labs/sdk-api';
|
|
11
12
|
import '../../../../shared/logger.js';
|
|
@@ -33,7 +34,7 @@ import '../../../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
|
33
34
|
import '../../../../components/IconButton/IconButton.js';
|
|
34
35
|
import '../../../../components/Alert/Alert.js';
|
|
35
36
|
import '../../../../context/WalletGroupContext/WalletGroupContext.js';
|
|
36
|
-
import { copyToClipboard } from '../../helpers/helpers.js';
|
|
37
|
+
import { copyToClipboard, getExportKeysOption } from '../../helpers/helpers.js';
|
|
37
38
|
import '../../../DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
|
|
38
39
|
import '../../../../context/MockContext/MockContext.js';
|
|
39
40
|
import '../../../../context/CaptchaContext/CaptchaContext.js';
|
|
@@ -48,7 +49,7 @@ import { AuthProviderIcon } from '../../../../components/AuthProviderIcon/AuthPr
|
|
|
48
49
|
const Wallet = ({ wallet, ens }) => {
|
|
49
50
|
var _a;
|
|
50
51
|
const { id: walletId, connector, address } = wallet;
|
|
51
|
-
const { computeConnectedStateForWallets, setPrimaryWallet, setSelectedWalletConnector, setShowWidgetStatePopup, setSelectedWalletWithAction, authToken, primaryWallet, user, } = useInternalDynamicContext();
|
|
52
|
+
const { computeConnectedStateForWallets, setPrimaryWallet, setSelectedWalletConnector, setShowWidgetStatePopup, setSelectedWalletWithAction, authToken, primaryWallet, user, projectSettings, } = useInternalDynamicContext();
|
|
52
53
|
const email = (_a = user === null || user === void 0 ? void 0 : user.verifiedCredentials.find((verifiedCredential) => verifiedCredential.format === 'email')) === null || _a === void 0 ? void 0 : _a.email;
|
|
53
54
|
const iconSize = 20;
|
|
54
55
|
const options = [
|
|
@@ -77,6 +78,14 @@ const Wallet = ({ wallet, ens }) => {
|
|
|
77
78
|
text: 'Unlink from my account',
|
|
78
79
|
});
|
|
79
80
|
}
|
|
81
|
+
const exportKeysOption = getExportKeysOption(connector, projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers);
|
|
82
|
+
if (exportKeysOption) {
|
|
83
|
+
options.push({
|
|
84
|
+
Icon: jsx(SvgKey, {}),
|
|
85
|
+
callback: exportKeysOption,
|
|
86
|
+
text: 'Export private keys',
|
|
87
|
+
});
|
|
88
|
+
}
|
|
80
89
|
const onSelectWalletClick = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
81
90
|
if ((primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.chain) === 'flow' &&
|
|
82
91
|
connector.connectedChain === 'FLOW') {
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var sdkApi = require('@dynamic-labs/sdk-api');
|
|
6
|
+
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
7
|
+
|
|
5
8
|
const replaceAll = (text, char, replace) => {
|
|
6
9
|
const re = new RegExp(char, 'g');
|
|
7
10
|
return text.replace(re, replace);
|
|
@@ -32,9 +35,23 @@ const roundBalance = (balanceString) => {
|
|
|
32
35
|
return '0.0';
|
|
33
36
|
return String(roundedBalance);
|
|
34
37
|
};
|
|
35
|
-
const capitalize = (text) => text.charAt(0).toUpperCase() + text.slice(1);
|
|
38
|
+
const capitalize = (text) => text.charAt(0).toUpperCase() + text.slice(1);
|
|
39
|
+
const getExportKeysOption = (connector, providerSettings) => {
|
|
40
|
+
var _a;
|
|
41
|
+
if (!connector || !(providerSettings === null || providerSettings === void 0 ? void 0 : providerSettings.length) || !walletConnectorCore.isMagicConnector(connector)) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const keyExportUrl = (_a = providerSettings.find((provider) => provider.provider === sdkApi.ProviderEnum.MagicLink)) === null || _a === void 0 ? void 0 : _a.keyExportUrl;
|
|
45
|
+
if (!keyExportUrl) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
return () => {
|
|
49
|
+
window.open(keyExportUrl, '_blank');
|
|
50
|
+
};
|
|
51
|
+
};
|
|
36
52
|
|
|
37
53
|
exports.capitalize = capitalize;
|
|
38
54
|
exports.copyToClipboard = copyToClipboard;
|
|
55
|
+
exports.getExportKeysOption = getExportKeysOption;
|
|
39
56
|
exports.replaceAll = replaceAll;
|
|
40
57
|
exports.roundBalance = roundBalance;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import { Provider } from '@dynamic-labs/sdk-api';
|
|
2
|
+
import { WalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
1
3
|
export declare const replaceAll: (text: string, char: string, replace: string) => string;
|
|
2
4
|
export declare const copyToClipboard: (textToCopy: string) => void;
|
|
3
5
|
export declare const disconnect: () => void;
|
|
4
6
|
export declare const roundBalance: (balanceString: string) => string;
|
|
5
7
|
export declare const capitalize: (text: string) => string;
|
|
8
|
+
export declare const getExportKeysOption: (connector?: WalletConnector, providerSettings?: Provider[]) => (() => void) | undefined;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { ProviderEnum } from '@dynamic-labs/sdk-api';
|
|
2
|
+
import { isMagicConnector } from '@dynamic-labs/wallet-connector-core';
|
|
3
|
+
|
|
1
4
|
const replaceAll = (text, char, replace) => {
|
|
2
5
|
const re = new RegExp(char, 'g');
|
|
3
6
|
return text.replace(re, replace);
|
|
@@ -28,6 +31,19 @@ const roundBalance = (balanceString) => {
|
|
|
28
31
|
return '0.0';
|
|
29
32
|
return String(roundedBalance);
|
|
30
33
|
};
|
|
31
|
-
const capitalize = (text) => text.charAt(0).toUpperCase() + text.slice(1);
|
|
34
|
+
const capitalize = (text) => text.charAt(0).toUpperCase() + text.slice(1);
|
|
35
|
+
const getExportKeysOption = (connector, providerSettings) => {
|
|
36
|
+
var _a;
|
|
37
|
+
if (!connector || !(providerSettings === null || providerSettings === void 0 ? void 0 : providerSettings.length) || !isMagicConnector(connector)) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
const keyExportUrl = (_a = providerSettings.find((provider) => provider.provider === ProviderEnum.MagicLink)) === null || _a === void 0 ? void 0 : _a.keyExportUrl;
|
|
41
|
+
if (!keyExportUrl) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
return () => {
|
|
45
|
+
window.open(keyExportUrl, '_blank');
|
|
46
|
+
};
|
|
47
|
+
};
|
|
32
48
|
|
|
33
|
-
export { capitalize, copyToClipboard, replaceAll, roundBalance };
|
|
49
|
+
export { capitalize, copyToClipboard, getExportKeysOption, replaceAll, roundBalance };
|
package/src/polyfills.cjs
CHANGED
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
var process$1 = require('./shim/process.cjs');
|
|
4
4
|
|
|
5
|
-
let process;
|
|
6
5
|
if (typeof window !== 'undefined') {
|
|
7
6
|
window.global = globalThis;
|
|
8
|
-
if (!window.process &&
|
|
7
|
+
if (!window.process && typeof process === 'undefined') {
|
|
9
8
|
Object.assign(window, { process: process$1.process });
|
|
10
9
|
}
|
|
11
10
|
}
|
package/src/polyfills.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { process as process$1 } from './shim/process.js';
|
|
2
2
|
|
|
3
|
-
let process;
|
|
4
3
|
if (typeof window !== 'undefined') {
|
|
5
4
|
window.global = globalThis;
|
|
6
|
-
if (!window.process &&
|
|
5
|
+
if (!window.process && typeof process === 'undefined') {
|
|
7
6
|
Object.assign(window, { process: process$1 });
|
|
8
7
|
}
|
|
9
8
|
}
|