@dynamic-labs/sdk-react-core 0.18.100-viem.17 → 0.18.100-viem.19
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 +19 -0
- package/package.cjs +2 -2
- package/package.js +2 -2
- package/package.json +9 -9
- package/src/index.cjs +1 -2
- package/src/index.d.ts +1 -1
- package/src/index.js +1 -1
- package/src/lib/components/SignMessagePreview/SignMessagePreview.cjs +27 -0
- package/src/lib/components/SignMessagePreview/SignMessagePreview.d.ts +6 -0
- package/src/lib/components/SignMessagePreview/SignMessagePreview.js +23 -0
- package/src/lib/components/SignMessagePreview/SignMessagePreview.types.d.ts +8 -0
- package/src/lib/components/SignMessagePreview/components/SignTypedDataPreview/SignTypedDataPreview.cjs +44 -0
- package/src/lib/components/SignMessagePreview/components/SignTypedDataPreview/SignTypedDataPreview.d.ts +8 -0
- package/src/lib/components/SignMessagePreview/components/SignTypedDataPreview/SignTypedDataPreview.js +40 -0
- package/src/lib/components/SignMessagePreview/components/SignTypedDataPreview/index.d.ts +1 -0
- package/src/lib/components/SignMessagePreview/components/index.d.ts +1 -0
- package/src/lib/components/SignMessagePreview/index.d.ts +1 -0
- package/src/lib/components/SignMessagePreview/utils/index.d.ts +1 -0
- package/src/lib/components/SignMessagePreview/utils/isSignTypedData/index.d.ts +1 -0
- package/src/lib/components/SignMessagePreview/utils/isSignTypedData/isSignTypedData.cjs +17 -0
- package/src/lib/components/SignMessagePreview/utils/isSignTypedData/isSignTypedData.d.ts +2 -0
- package/src/lib/components/SignMessagePreview/utils/isSignTypedData/isSignTypedData.js +13 -0
- package/src/lib/components/index.d.ts +1 -0
- package/src/lib/data/api.cjs +4 -2
- package/src/lib/data/api.d.ts +3 -2
- package/src/lib/data/api.js +4 -2
- package/src/lib/modals/SignMessageConfirmationModal/SignMessageConfirmationModal.cjs +2 -1
- package/src/lib/modals/SignMessageConfirmationModal/SignMessageConfirmationModal.js +2 -1
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.cjs +4 -1
- package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.js +4 -1
- package/src/lib/utils/hooks/useWallets/useWallets.cjs +15 -26
- package/src/lib/utils/hooks/useWallets/useWallets.js +16 -27
- package/src/lib/views/LoginWithEmailView/components/SocialSignIn/SocialSignIn.cjs +1 -1
- package/src/lib/views/LoginWithEmailView/components/SocialSignIn/SocialSignIn.js +1 -1
- package/src/lib/views/WalletList/data.cjs +2 -14
- package/src/lib/views/WalletList/data.d.ts +4 -2
- package/src/lib/views/WalletList/data.js +2 -13
- package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.cjs +7 -10
- package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.d.ts +1 -0
- package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.js +8 -11
- package/src/lib/widgets/DynamicWidget/hooks/index.d.ts +1 -0
- package/src/lib/widgets/DynamicWidget/hooks/useViewController/index.d.ts +1 -0
- package/src/lib/widgets/DynamicWidget/hooks/useViewController/useViewController.cjs +17 -0
- package/src/lib/widgets/DynamicWidget/hooks/useViewController/useViewController.d.ts +6 -0
- package/src/lib/widgets/DynamicWidget/hooks/useViewController/useViewController.js +13 -0
- package/src/lib/widgets/DynamicWidget/views/SendBalanceWidgetView/SendBalanceWidgetView.cjs +2 -3
- package/src/lib/widgets/DynamicWidget/views/SendBalanceWidgetView/SendBalanceWidgetView.js +2 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,23 @@
|
|
|
1
1
|
|
|
2
|
+
### [0.18.100-viem.19](https://github.com/dynamic-labs/DynamicAuth/compare/v0.18.100-viem.18...v0.18.100-viem.19) (2023-09-22)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* pass the network param on wallet transfers ([#3307](https://github.com/dynamic-labs/DynamicAuth/issues/3307)) ([#3385](https://github.com/dynamic-labs/DynamicAuth/issues/3385)) ([d003423](https://github.com/dynamic-labs/DynamicAuth/commit/d00342377fe1cd9605f37e54edb647378edd45d5))
|
|
8
|
+
|
|
9
|
+
### [0.18.100-viem.18](https://github.com/dynamic-labs/DynamicAuth/compare/v0.18.100-viem.17...v0.18.100-viem.18) (2023-09-20)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
* show default wallet icon when no image is available ([#3291](https://github.com/dynamic-labs/DynamicAuth/issues/3291)) ([b541d00](https://github.com/dynamic-labs/DynamicAuth/commit/b541d002a0f6ff2e409034341e6e2191d6d3ac7f))
|
|
15
|
+
* display user profile when closing send balance ([#3333](https://github.com/dynamic-labs/DynamicAuth/issues/3333)) ([#3337](https://github.com/dynamic-labs/DynamicAuth/issues/3337)) ([5b3e665](https://github.com/dynamic-labs/DynamicAuth/commit/5b3e665a6ebfc0b46b84c787634d2e27bc4a9270))
|
|
16
|
+
* display sign typed data message for confirmation ([#3328](https://github.com/dynamic-labs/DynamicAuth/issues/3328)) ([2b93473](https://github.com/dynamic-labs/DynamicAuth/commit/2b93473024e277072be32a17c5513168b85d13f9))
|
|
17
|
+
* remove async from getWeb3Provider method in Magic connector ([#3281](https://github.com/dynamic-labs/DynamicAuth/issues/3281)) ([1d949c1](https://github.com/dynamic-labs/DynamicAuth/commit/1d949c18df8d5453f057f61b0c54ac16de1fbb76))
|
|
18
|
+
* fixes unlinking oauth account from multi wallet panel ([#3344](https://github.com/dynamic-labs/DynamicAuth/issues/3344)) ([87d08d6](https://github.com/dynamic-labs/DynamicAuth/commit/87d08d667f7bb82fcbadcf651a99c08acfdabf1e))
|
|
19
|
+
* prevent wallet connect v2 from redirect user to last known wallet after logout ([#3354](https://github.com/dynamic-labs/DynamicAuth/issues/3354)) ([dd39b13](https://github.com/dynamic-labs/DynamicAuth/commit/dd39b136af95667d1bf81586034eee5dc9c385db))
|
|
20
|
+
|
|
2
21
|
### [0.18.100-viem.17](https://github.com/dynamic-labs/DynamicAuth/compare/v0.18.100-viem.16...v0.18.100-viem.17) (2023-09-11)
|
|
3
22
|
|
|
4
23
|
|
package/package.cjs
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var version = "0.18.100-viem.
|
|
5
|
+
var version = "0.18.100-viem.19";
|
|
6
6
|
var dependencies = {
|
|
7
7
|
"react-focus-lock": "2.9.2",
|
|
8
|
-
"@dynamic-labs/iconic": "0.1.
|
|
8
|
+
"@dynamic-labs/iconic": "0.1.30",
|
|
9
9
|
"@dynamic-labs/sdk-api": "0.0.270",
|
|
10
10
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
|
11
11
|
"country-list": "2.3.0",
|
package/package.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var version = "0.18.100-viem.
|
|
1
|
+
var version = "0.18.100-viem.19";
|
|
2
2
|
var dependencies = {
|
|
3
3
|
"react-focus-lock": "2.9.2",
|
|
4
|
-
"@dynamic-labs/iconic": "0.1.
|
|
4
|
+
"@dynamic-labs/iconic": "0.1.30",
|
|
5
5
|
"@dynamic-labs/sdk-api": "0.0.270",
|
|
6
6
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
|
7
7
|
"country-list": "2.3.0",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/sdk-react-core",
|
|
3
|
-
"version": "0.18.100-viem.
|
|
3
|
+
"version": "0.18.100-viem.19",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/dynamic-labs/DynamicAuth.git",
|
|
@@ -8,20 +8,20 @@
|
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"react-focus-lock": "2.9.2",
|
|
11
|
-
"@dynamic-labs/iconic": "0.1.
|
|
11
|
+
"@dynamic-labs/iconic": "0.1.30",
|
|
12
12
|
"@dynamic-labs/sdk-api": "0.0.270",
|
|
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
|
-
"@dynamic-labs/logger": "0.18.100-viem.
|
|
19
|
-
"@dynamic-labs/multi-wallet": "0.18.100-viem.
|
|
20
|
-
"@dynamic-labs/rpc-providers": "0.18.100-viem.
|
|
21
|
-
"@dynamic-labs/types": "0.18.100-viem.
|
|
22
|
-
"@dynamic-labs/utils": "0.18.100-viem.
|
|
23
|
-
"@dynamic-labs/wallet-book": "0.18.100-viem.
|
|
24
|
-
"@dynamic-labs/wallet-connector-core": "0.18.100-viem.
|
|
18
|
+
"@dynamic-labs/logger": "0.18.100-viem.19",
|
|
19
|
+
"@dynamic-labs/multi-wallet": "0.18.100-viem.19",
|
|
20
|
+
"@dynamic-labs/rpc-providers": "0.18.100-viem.19",
|
|
21
|
+
"@dynamic-labs/types": "0.18.100-viem.19",
|
|
22
|
+
"@dynamic-labs/utils": "0.18.100-viem.19",
|
|
23
|
+
"@dynamic-labs/wallet-book": "0.18.100-viem.19",
|
|
24
|
+
"@dynamic-labs/wallet-connector-core": "0.18.100-viem.19",
|
|
25
25
|
"eventemitter3": "5.0.1"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
package/src/index.cjs
CHANGED
|
@@ -136,8 +136,7 @@ var SendBalanceContext = require('./lib/context/SendBalanceContext/SendBalanceCo
|
|
|
136
136
|
|
|
137
137
|
|
|
138
138
|
exports.VERSION = version.VERSION;
|
|
139
|
-
exports.
|
|
140
|
-
exports.getNotInstalledWallets = data.getNotInstalledWallets;
|
|
139
|
+
exports.getWallets = data.getWallets;
|
|
141
140
|
exports.getAuthToken = getAuthToken.getAuthToken;
|
|
142
141
|
exports.DynamicContext = DynamicContext.DynamicContext;
|
|
143
142
|
exports.DynamicContextProvider = DynamicContext.DynamicContextProvider;
|
package/src/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import './polyfills';
|
|
2
2
|
export { VERSION } from './version';
|
|
3
|
-
export {
|
|
3
|
+
export { getWallets } from './lib/views/WalletList/data';
|
|
4
4
|
export { getAuthToken } from './lib/utils/functions/getAuthToken';
|
|
5
5
|
export { DynamicContextProvider, DynamicContext, } from './lib/context/DynamicContext';
|
|
6
6
|
export type { DynamicContextProps } from './lib/context/DynamicContext';
|
package/src/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import './polyfills.js';
|
|
2
2
|
export { VERSION } from './version.js';
|
|
3
|
-
export {
|
|
3
|
+
export { getWallets } from './lib/views/WalletList/data.js';
|
|
4
4
|
export { getAuthToken } from './lib/utils/functions/getAuthToken/getAuthToken.js';
|
|
5
5
|
export { DynamicContext, DynamicContextProvider } from './lib/context/DynamicContext/DynamicContext.js';
|
|
6
6
|
export { useDynamicContext } from './lib/context/DynamicContext/useDynamicContext.js';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
var React = require('react');
|
|
7
|
+
var Typography = require('../Typography/Typography.cjs');
|
|
8
|
+
var isSignTypedData = require('./utils/isSignTypedData/isSignTypedData.cjs');
|
|
9
|
+
var SignTypedDataPreview = require('./components/SignTypedDataPreview/SignTypedDataPreview.cjs');
|
|
10
|
+
|
|
11
|
+
const SignMessagePreview = ({ message, }) => {
|
|
12
|
+
const signTypedData = React.useMemo(() => {
|
|
13
|
+
try {
|
|
14
|
+
const json = JSON.parse(message);
|
|
15
|
+
return isSignTypedData.isSignTypedData(json) ? json : undefined;
|
|
16
|
+
}
|
|
17
|
+
catch (e) {
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
}, [message]);
|
|
21
|
+
if (signTypedData) {
|
|
22
|
+
return (jsxRuntime.jsx(SignTypedDataPreview.SignTypedDataPreview, { currentType: signTypedData.primaryType, types: signTypedData.types, showTypeName: true, data: signTypedData.message }));
|
|
23
|
+
}
|
|
24
|
+
return (jsxRuntime.jsx(Typography.Typography, { color: 'primary', variant: 'body_normal', children: jsxRuntime.jsx("span", { style: { whiteSpace: 'pre-line' }, dangerouslySetInnerHTML: { __html: message } }) }));
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
exports.SignMessagePreview = SignMessagePreview;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import { Typography } from '../Typography/Typography.js';
|
|
4
|
+
import { isSignTypedData } from './utils/isSignTypedData/isSignTypedData.js';
|
|
5
|
+
import { SignTypedDataPreview } from './components/SignTypedDataPreview/SignTypedDataPreview.js';
|
|
6
|
+
|
|
7
|
+
const SignMessagePreview = ({ message, }) => {
|
|
8
|
+
const signTypedData = useMemo(() => {
|
|
9
|
+
try {
|
|
10
|
+
const json = JSON.parse(message);
|
|
11
|
+
return isSignTypedData(json) ? json : undefined;
|
|
12
|
+
}
|
|
13
|
+
catch (e) {
|
|
14
|
+
return undefined;
|
|
15
|
+
}
|
|
16
|
+
}, [message]);
|
|
17
|
+
if (signTypedData) {
|
|
18
|
+
return (jsx(SignTypedDataPreview, { currentType: signTypedData.primaryType, types: signTypedData.types, showTypeName: true, data: signTypedData.message }));
|
|
19
|
+
}
|
|
20
|
+
return (jsx(Typography, { color: 'primary', variant: 'body_normal', children: jsx("span", { style: { whiteSpace: 'pre-line' }, dangerouslySetInnerHTML: { __html: message } }) }));
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export { SignMessagePreview };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
var Typography = require('../../../Typography/Typography.cjs');
|
|
7
|
+
var capitalize = require('../../../../shared/utils/functions/capitalize/capitalize.cjs');
|
|
8
|
+
require('@dynamic-labs/sdk-api');
|
|
9
|
+
require('../../../../shared/logger.cjs');
|
|
10
|
+
require('@dynamic-labs/iconic');
|
|
11
|
+
require('@dynamic-labs/wallet-connector-core');
|
|
12
|
+
require('../../../../context/ViewContext/ViewContext.cjs');
|
|
13
|
+
require('react');
|
|
14
|
+
require('@dynamic-labs/wallet-book');
|
|
15
|
+
var shortenWalletAddress = require('../../../../shared/utils/functions/shortenWalletAddress/shortenWalletAddress.cjs');
|
|
16
|
+
require('@dynamic-labs/utils');
|
|
17
|
+
require('../../../../utils/constants/colors.cjs');
|
|
18
|
+
require('../../../../shared/utils/classes/storage/localStorage.cjs');
|
|
19
|
+
require('viem');
|
|
20
|
+
require('../../../../shared/consts/index.cjs');
|
|
21
|
+
|
|
22
|
+
const TypeTitle = ({ children }) => (jsxRuntime.jsx(Typography.Typography, { color: 'secondary', weight: 'medium', children: children }));
|
|
23
|
+
const AttributeName = TypeTitle;
|
|
24
|
+
const AttributeValue = ({ children, title, }) => (jsxRuntime.jsx(Typography.Typography, { as: 'span', weight: 'regular', color: 'primary', title: title, children: children }));
|
|
25
|
+
const SignTypedDataPreview = ({ currentType, types, showTypeName = false, data }) => {
|
|
26
|
+
const fields = types[currentType].map((field) => {
|
|
27
|
+
const { type } = field;
|
|
28
|
+
const isKnownType = type in types;
|
|
29
|
+
if (isKnownType) {
|
|
30
|
+
return (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(TypeTitle, { children: capitalize.capitalize(field.name) }), jsxRuntime.jsx("div", { className: 'sign-typed-data-preview--type-container', children: jsxRuntime.jsx(SignTypedDataPreview, { currentType: type, types: types, data: data === null || data === void 0 ? void 0 : data[field.name] }) })] }, field.name));
|
|
31
|
+
}
|
|
32
|
+
const fieldData = data === null || data === void 0 ? void 0 : data[field.name];
|
|
33
|
+
const fieldType = field.type;
|
|
34
|
+
return (jsxRuntime.jsxs("div", { className: 'sign-typed-data-preview--attribute-row', children: [jsxRuntime.jsxs(AttributeName, { children: [capitalize.capitalize(field.name), ": "] }), jsxRuntime.jsx(AttributeValue, { title: fieldData, children: fieldType === 'address'
|
|
35
|
+
? shortenWalletAddress.shortenWalletAddress(fieldData, 4, 4)
|
|
36
|
+
: fieldData })] }, field.name));
|
|
37
|
+
});
|
|
38
|
+
if (showTypeName) {
|
|
39
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(TypeTitle, { children: currentType }), jsxRuntime.jsx("div", { className: 'sign-typed-data-preview--type-container', children: fields })] }));
|
|
40
|
+
}
|
|
41
|
+
return jsxRuntime.jsx("div", { className: 'sign-typed-data-preview--fields-list', children: fields });
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
exports.SignTypedDataPreview = SignTypedDataPreview;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import { Typography } from '../../../Typography/Typography.js';
|
|
3
|
+
import { capitalize } from '../../../../shared/utils/functions/capitalize/capitalize.js';
|
|
4
|
+
import '@dynamic-labs/sdk-api';
|
|
5
|
+
import '../../../../shared/logger.js';
|
|
6
|
+
import '@dynamic-labs/iconic';
|
|
7
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
8
|
+
import '../../../../context/ViewContext/ViewContext.js';
|
|
9
|
+
import 'react';
|
|
10
|
+
import '@dynamic-labs/wallet-book';
|
|
11
|
+
import { shortenWalletAddress } from '../../../../shared/utils/functions/shortenWalletAddress/shortenWalletAddress.js';
|
|
12
|
+
import '@dynamic-labs/utils';
|
|
13
|
+
import '../../../../utils/constants/colors.js';
|
|
14
|
+
import '../../../../shared/utils/classes/storage/localStorage.js';
|
|
15
|
+
import 'viem';
|
|
16
|
+
import '../../../../shared/consts/index.js';
|
|
17
|
+
|
|
18
|
+
const TypeTitle = ({ children }) => (jsx(Typography, { color: 'secondary', weight: 'medium', children: children }));
|
|
19
|
+
const AttributeName = TypeTitle;
|
|
20
|
+
const AttributeValue = ({ children, title, }) => (jsx(Typography, { as: 'span', weight: 'regular', color: 'primary', title: title, children: children }));
|
|
21
|
+
const SignTypedDataPreview = ({ currentType, types, showTypeName = false, data }) => {
|
|
22
|
+
const fields = types[currentType].map((field) => {
|
|
23
|
+
const { type } = field;
|
|
24
|
+
const isKnownType = type in types;
|
|
25
|
+
if (isKnownType) {
|
|
26
|
+
return (jsxs("div", { children: [jsx(TypeTitle, { children: capitalize(field.name) }), jsx("div", { className: 'sign-typed-data-preview--type-container', children: jsx(SignTypedDataPreview, { currentType: type, types: types, data: data === null || data === void 0 ? void 0 : data[field.name] }) })] }, field.name));
|
|
27
|
+
}
|
|
28
|
+
const fieldData = data === null || data === void 0 ? void 0 : data[field.name];
|
|
29
|
+
const fieldType = field.type;
|
|
30
|
+
return (jsxs("div", { className: 'sign-typed-data-preview--attribute-row', children: [jsxs(AttributeName, { children: [capitalize(field.name), ": "] }), jsx(AttributeValue, { title: fieldData, children: fieldType === 'address'
|
|
31
|
+
? shortenWalletAddress(fieldData, 4, 4)
|
|
32
|
+
: fieldData })] }, field.name));
|
|
33
|
+
});
|
|
34
|
+
if (showTypeName) {
|
|
35
|
+
return (jsxs(Fragment, { children: [jsx(TypeTitle, { children: currentType }), jsx("div", { className: 'sign-typed-data-preview--type-container', children: fields })] }));
|
|
36
|
+
}
|
|
37
|
+
return jsx("div", { className: 'sign-typed-data-preview--fields-list', children: fields });
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export { SignTypedDataPreview };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SignTypedDataPreview } from './SignTypedDataPreview';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './SignTypedDataPreview';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SignMessagePreview } from './SignMessagePreview';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './isSignTypedData';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { isSignTypedData } from './isSignTypedData';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const isSignTypedData = (data) => {
|
|
6
|
+
if (typeof data !== 'object' || data === null) {
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
const { types, message, primaryType } = data;
|
|
10
|
+
return (typeof types === 'object' &&
|
|
11
|
+
types !== null &&
|
|
12
|
+
typeof message === 'object' &&
|
|
13
|
+
message !== null &&
|
|
14
|
+
typeof primaryType === 'string');
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
exports.isSignTypedData = isSignTypedData;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const isSignTypedData = (data) => {
|
|
2
|
+
if (typeof data !== 'object' || data === null) {
|
|
3
|
+
return false;
|
|
4
|
+
}
|
|
5
|
+
const { types, message, primaryType } = data;
|
|
6
|
+
return (typeof types === 'object' &&
|
|
7
|
+
types !== null &&
|
|
8
|
+
typeof message === 'object' &&
|
|
9
|
+
message !== null &&
|
|
10
|
+
typeof primaryType === 'string');
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export { isSignTypedData };
|
package/src/lib/data/api.cjs
CHANGED
|
@@ -188,11 +188,12 @@ const unlinkWallet = ({ environmentId, primaryWalletId, walletId, }, userJwt) =>
|
|
|
188
188
|
return undefined;
|
|
189
189
|
}
|
|
190
190
|
});
|
|
191
|
-
const transferWallet = (environmentId, { messageToSign, signedMessage, publicWalletAddress, chain, walletName, walletProvider, skipEmptyAccountCheck = false, }, userJwt) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
191
|
+
const transferWallet = (environmentId, { network, messageToSign, signedMessage, publicWalletAddress, chain, walletName, walletProvider, skipEmptyAccountCheck = false, }, userJwt) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
192
192
|
// We should find a better way to do this than force type casting
|
|
193
193
|
const verifyRequest = {
|
|
194
194
|
chain,
|
|
195
195
|
messageToSign,
|
|
196
|
+
network,
|
|
196
197
|
publicWalletAddress,
|
|
197
198
|
signedMessage,
|
|
198
199
|
skipEmptyAccountCheck,
|
|
@@ -372,11 +373,12 @@ const verifyOAuth = (environmentId, providerType, { code, codeVerifier, state },
|
|
|
372
373
|
return undefined;
|
|
373
374
|
}
|
|
374
375
|
});
|
|
375
|
-
const unlinkOAuth = ({ environmentId, verifiedCrentialId, }, userJwt) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
376
|
+
const unlinkOAuth = ({ environmentId, primaryWalletId, verifiedCrentialId, }, userJwt) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
376
377
|
try {
|
|
377
378
|
const { jwt } = yield sdkApi(userJwt).verifyUnlink({
|
|
378
379
|
environmentId,
|
|
379
380
|
verifyUnlinkRequest: {
|
|
381
|
+
primaryWalletId,
|
|
380
382
|
verifiedCrentialId,
|
|
381
383
|
},
|
|
382
384
|
});
|
package/src/lib/data/api.d.ts
CHANGED
|
@@ -34,7 +34,7 @@ export declare const unlinkWallet: ({ environmentId, primaryWalletId, walletId,
|
|
|
34
34
|
primaryWalletId: string | undefined;
|
|
35
35
|
walletId: string;
|
|
36
36
|
}, userJwt: string) => Promise<string | undefined>;
|
|
37
|
-
export declare const transferWallet: (environmentId: string, { messageToSign, signedMessage, publicWalletAddress, chain, walletName, walletProvider, skipEmptyAccountCheck, }: VerifyWallet, userJwt: string) => Promise<string | undefined>;
|
|
37
|
+
export declare const transferWallet: (environmentId: string, { network, messageToSign, signedMessage, publicWalletAddress, chain, walletName, walletProvider, skipEmptyAccountCheck, }: VerifyWallet, userJwt: string) => Promise<string | undefined>;
|
|
38
38
|
export declare const mapChainToChainEnum: (chain: string) => ChainEnum;
|
|
39
39
|
export declare const mapProviderToProviderEnum: (provider: string) => WalletProviderEnum;
|
|
40
40
|
export declare const mapAuthModeTypeToEnum: (authMode: string) => AuthModeEnum;
|
|
@@ -52,8 +52,9 @@ export declare const fetchProjectSettings: (environmentId: string) => Promise<Pr
|
|
|
52
52
|
export declare const updateUserProfileFields: (jwt: string | undefined, environmentId: string, fields: UserFields) => Promise<UpdateSelfResponse>;
|
|
53
53
|
export declare const getOauthLoginUrl: (environmentId: string, providerType: ProviderEnum, userJwt: string) => Promise<string | undefined>;
|
|
54
54
|
export declare const verifyOAuth: (environmentId: string, providerType: ProviderEnum, { code, codeVerifier, state }: OauthRequest, userJwt: string) => Promise<string | undefined>;
|
|
55
|
-
export declare const unlinkOAuth: ({ environmentId, verifiedCrentialId, }: {
|
|
55
|
+
export declare const unlinkOAuth: ({ environmentId, primaryWalletId, verifiedCrentialId, }: {
|
|
56
56
|
environmentId: string;
|
|
57
|
+
primaryWalletId: string | undefined;
|
|
57
58
|
verifiedCrentialId: string;
|
|
58
59
|
}, userJwt: string) => Promise<string | undefined>;
|
|
59
60
|
export declare const getOnrampProviders: ({ chain, environmentId, networkId, token, walletAddress, }: {
|
package/src/lib/data/api.js
CHANGED
|
@@ -184,11 +184,12 @@ const unlinkWallet = ({ environmentId, primaryWalletId, walletId, }, userJwt) =>
|
|
|
184
184
|
return undefined;
|
|
185
185
|
}
|
|
186
186
|
});
|
|
187
|
-
const transferWallet = (environmentId, { messageToSign, signedMessage, publicWalletAddress, chain, walletName, walletProvider, skipEmptyAccountCheck = false, }, userJwt) => __awaiter(void 0, void 0, void 0, function* () {
|
|
187
|
+
const transferWallet = (environmentId, { network, messageToSign, signedMessage, publicWalletAddress, chain, walletName, walletProvider, skipEmptyAccountCheck = false, }, userJwt) => __awaiter(void 0, void 0, void 0, function* () {
|
|
188
188
|
// We should find a better way to do this than force type casting
|
|
189
189
|
const verifyRequest = {
|
|
190
190
|
chain,
|
|
191
191
|
messageToSign,
|
|
192
|
+
network,
|
|
192
193
|
publicWalletAddress,
|
|
193
194
|
signedMessage,
|
|
194
195
|
skipEmptyAccountCheck,
|
|
@@ -368,11 +369,12 @@ const verifyOAuth = (environmentId, providerType, { code, codeVerifier, state },
|
|
|
368
369
|
return undefined;
|
|
369
370
|
}
|
|
370
371
|
});
|
|
371
|
-
const unlinkOAuth = ({ environmentId, verifiedCrentialId, }, userJwt) => __awaiter(void 0, void 0, void 0, function* () {
|
|
372
|
+
const unlinkOAuth = ({ environmentId, primaryWalletId, verifiedCrentialId, }, userJwt) => __awaiter(void 0, void 0, void 0, function* () {
|
|
372
373
|
try {
|
|
373
374
|
const { jwt } = yield sdkApi(userJwt).verifyUnlink({
|
|
374
375
|
environmentId,
|
|
375
376
|
verifyUnlinkRequest: {
|
|
377
|
+
primaryWalletId,
|
|
376
378
|
verifiedCrentialId,
|
|
377
379
|
},
|
|
378
380
|
});
|
|
@@ -57,6 +57,7 @@ var Modal = require('../../components/Modal/Modal.cjs');
|
|
|
57
57
|
var ModalCard = require('../../components/ModalCard/ModalCard.cjs');
|
|
58
58
|
require('../../components/InlineWidget/InlineWidget.cjs');
|
|
59
59
|
require('../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
60
|
+
var SignMessagePreview = require('../../components/SignMessagePreview/SignMessagePreview.cjs');
|
|
60
61
|
|
|
61
62
|
const SignMessageConfirmationModal = ({ appLogoUrl, appName, appOrigin, message, handler, onReject, onSignMessage, }) => {
|
|
62
63
|
usePreventPageScroll.usePreventPageScroll(true);
|
|
@@ -81,7 +82,7 @@ const SignMessageConfirmationModal = ({ appLogoUrl, appName, appOrigin, message,
|
|
|
81
82
|
const closeButton = (jsxRuntime.jsx(IconButton.IconButton, { type: 'button', onClick: handleOnReject, "data-testid": 'close', disabled: isLoading, children: jsxRuntime.jsx(close.ReactComponent, {}) }));
|
|
82
83
|
return (jsxRuntime.jsx(Portal.Portal, { handleClose: handleOnReject, isShown: show, zIndex: index.authModalZIndex, withBackdrop: true, elementId: 'dynamic-sign-message', transitionEvents: {
|
|
83
84
|
onUnmount: handleOnModalUnmount,
|
|
84
|
-
}, children: jsxRuntime.jsx(Modal.Modal, { children: jsxRuntime.jsxs(ModalCard.ModalCard, { children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { trailing: closeButton, alignContent: 'bottom', children: jsxRuntime.jsx(IconWithSpinner.IconWithSpinner, { Icon: (props) => (jsxRuntime.jsx(Icon.Icon, { color: 'brand-primary', children: jsxRuntime.jsx(signCircle.ReactComponent, Object.assign({}, props)) })), iconSize: 64, isSpinning: true }) }), jsxRuntime.jsxs("div", { className: 'sign-message-confirmation__body', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'title', color: 'primary', className: 'sign-message-confirmation__title', children: "Requesting Signature" }), jsxRuntime.jsx(AnimatePresence.AnimatePresence, { animationComponent: jsxRuntime.jsx(VerticalDrawerTransition.VerticalDrawerTransition, {}), children: signMessageError && (jsxRuntime.jsx("div", { className: 'sign-message-confirmation__error', children: jsxRuntime.jsx(ErrorContainer.ErrorContainer, { children: signMessageError.reason || 'Something went wrong' }) })) }), jsxRuntime.jsxs("div", { className: 'sign-message-confirmation__message-container', children: [jsxRuntime.jsx(AppOriginTile.AppOriginTile, { appLogoUrl: appLogoUrl, appName: appName, appOrigin: appOrigin }), jsxRuntime.jsx("div", { className: 'sign-message-confirmation__message', children: jsxRuntime.jsx(
|
|
85
|
+
}, children: jsxRuntime.jsx(Modal.Modal, { children: jsxRuntime.jsxs(ModalCard.ModalCard, { children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { trailing: closeButton, alignContent: 'bottom', children: jsxRuntime.jsx(IconWithSpinner.IconWithSpinner, { Icon: (props) => (jsxRuntime.jsx(Icon.Icon, { color: 'brand-primary', children: jsxRuntime.jsx(signCircle.ReactComponent, Object.assign({}, props)) })), iconSize: 64, isSpinning: true }) }), jsxRuntime.jsxs("div", { className: 'sign-message-confirmation__body', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'title', color: 'primary', className: 'sign-message-confirmation__title', children: "Requesting Signature" }), jsxRuntime.jsx(AnimatePresence.AnimatePresence, { animationComponent: jsxRuntime.jsx(VerticalDrawerTransition.VerticalDrawerTransition, {}), children: signMessageError && (jsxRuntime.jsx("div", { className: 'sign-message-confirmation__error', children: jsxRuntime.jsx(ErrorContainer.ErrorContainer, { children: signMessageError.reason || 'Something went wrong' }) })) }), jsxRuntime.jsxs("div", { className: 'sign-message-confirmation__message-container', children: [jsxRuntime.jsx(AppOriginTile.AppOriginTile, { appLogoUrl: appLogoUrl, appName: appName, appOrigin: appOrigin }), jsxRuntime.jsx("div", { className: 'sign-message-confirmation__message', children: jsxRuntime.jsx(SignMessagePreview.SignMessagePreview, { message: message.toString() }) })] }), jsxRuntime.jsxs("div", { className: 'sign-message-confirmation__actions', children: [jsxRuntime.jsx(Button.Button, { buttonVariant: 'secondary', onClick: handleOnReject, expanded: true, buttonPadding: 'large', disabled: isLoading, buttonRounded: 'default', children: "Cancel" }), jsxRuntime.jsx(Button.Button, { buttonVariant: 'primary', buttonPadding: 'large', onClick: () => confirm(), expanded: true, buttonRounded: 'default', loading: isLoading, children: "Sign" })] }), jsxRuntime.jsx(PoweredByDynamic.PoweredByDynamic, {})] })] }) }) }));
|
|
85
86
|
};
|
|
86
87
|
|
|
87
88
|
exports.SignMessageConfirmationModal = SignMessageConfirmationModal;
|
|
@@ -53,6 +53,7 @@ import { Modal } from '../../components/Modal/Modal.js';
|
|
|
53
53
|
import { ModalCard } from '../../components/ModalCard/ModalCard.js';
|
|
54
54
|
import '../../components/InlineWidget/InlineWidget.js';
|
|
55
55
|
import '../../components/MenuList/Dropdown/Dropdown.js';
|
|
56
|
+
import { SignMessagePreview } from '../../components/SignMessagePreview/SignMessagePreview.js';
|
|
56
57
|
|
|
57
58
|
const SignMessageConfirmationModal = ({ appLogoUrl, appName, appOrigin, message, handler, onReject, onSignMessage, }) => {
|
|
58
59
|
usePreventPageScroll(true);
|
|
@@ -77,7 +78,7 @@ const SignMessageConfirmationModal = ({ appLogoUrl, appName, appOrigin, message,
|
|
|
77
78
|
const closeButton = (jsx(IconButton, { type: 'button', onClick: handleOnReject, "data-testid": 'close', disabled: isLoading, children: jsx(SvgClose, {}) }));
|
|
78
79
|
return (jsx(Portal, { handleClose: handleOnReject, isShown: show, zIndex: authModalZIndex, withBackdrop: true, elementId: 'dynamic-sign-message', transitionEvents: {
|
|
79
80
|
onUnmount: handleOnModalUnmount,
|
|
80
|
-
}, children: jsx(Modal, { children: jsxs(ModalCard, { children: [jsx(ModalHeader, { trailing: closeButton, alignContent: 'bottom', children: jsx(IconWithSpinner, { Icon: (props) => (jsx(Icon, { color: 'brand-primary', children: jsx(SvgSignCircle, Object.assign({}, props)) })), iconSize: 64, isSpinning: true }) }), jsxs("div", { className: 'sign-message-confirmation__body', children: [jsx(Typography, { variant: 'title', color: 'primary', className: 'sign-message-confirmation__title', children: "Requesting Signature" }), jsx(AnimatePresence, { animationComponent: jsx(VerticalDrawerTransition, {}), children: signMessageError && (jsx("div", { className: 'sign-message-confirmation__error', children: jsx(ErrorContainer, { children: signMessageError.reason || 'Something went wrong' }) })) }), jsxs("div", { className: 'sign-message-confirmation__message-container', children: [jsx(AppOriginTile, { appLogoUrl: appLogoUrl, appName: appName, appOrigin: appOrigin }), jsx("div", { className: 'sign-message-confirmation__message', children: jsx(
|
|
81
|
+
}, children: jsx(Modal, { children: jsxs(ModalCard, { children: [jsx(ModalHeader, { trailing: closeButton, alignContent: 'bottom', children: jsx(IconWithSpinner, { Icon: (props) => (jsx(Icon, { color: 'brand-primary', children: jsx(SvgSignCircle, Object.assign({}, props)) })), iconSize: 64, isSpinning: true }) }), jsxs("div", { className: 'sign-message-confirmation__body', children: [jsx(Typography, { variant: 'title', color: 'primary', className: 'sign-message-confirmation__title', children: "Requesting Signature" }), jsx(AnimatePresence, { animationComponent: jsx(VerticalDrawerTransition, {}), children: signMessageError && (jsx("div", { className: 'sign-message-confirmation__error', children: jsx(ErrorContainer, { children: signMessageError.reason || 'Something went wrong' }) })) }), jsxs("div", { className: 'sign-message-confirmation__message-container', children: [jsx(AppOriginTile, { appLogoUrl: appLogoUrl, appName: appName, appOrigin: appOrigin }), jsx("div", { className: 'sign-message-confirmation__message', children: jsx(SignMessagePreview, { message: message.toString() }) })] }), jsxs("div", { className: 'sign-message-confirmation__actions', children: [jsx(Button, { buttonVariant: 'secondary', onClick: handleOnReject, expanded: true, buttonPadding: 'large', disabled: isLoading, buttonRounded: 'default', children: "Cancel" }), jsx(Button, { buttonVariant: 'primary', buttonPadding: 'large', onClick: () => confirm(), expanded: true, buttonRounded: 'default', loading: isLoading, children: "Sign" })] }), jsx(PoweredByDynamic, {})] })] }) }) }));
|
|
81
82
|
};
|
|
82
83
|
|
|
83
84
|
export { SignMessageConfirmationModal };
|