@dynamic-labs/sdk-react-core 0.18.100-viem.27 → 0.18.100-viem.28
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 +9 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +8 -8
- package/src/lib/components/SignMessagePreview/SignMessagePreview.cjs +1 -1
- package/src/lib/components/SignMessagePreview/SignMessagePreview.js +1 -1
- package/src/lib/views/SendBalanceView/SendBalanceView.cjs +19 -3
- package/src/lib/views/SendBalanceView/SendBalanceView.js +19 -3
- package/src/lib/views/SendBalanceView/components/TransactionStage/TransactionStage.cjs +3 -9
- package/src/lib/views/SendBalanceView/components/TransactionStage/TransactionStage.d.ts +2 -0
- package/src/lib/views/SendBalanceView/components/TransactionStage/TransactionStage.js +4 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
|
|
2
|
+
### [0.18.100-viem.28](https://github.com/dynamic-labs/DynamicAuth/compare/v0.18.100-viem.27...v0.18.100-viem.28) (2023-10-30)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* better handling of Coinbase wallet disconnect + upgrade to 3.7.2 ([#3691](https://github.com/dynamic-labs/DynamicAuth/issues/3691)) ([2385af8](https://github.com/dynamic-labs/DynamicAuth/commit/2385af8e960c3c3a23d2ce3379c50668a88b0478))
|
|
8
|
+
* Fix send balance in multiple chains ([#3767](https://github.com/dynamic-labs/DynamicAuth/issues/3767)) ([724d650](https://github.com/dynamic-labs/DynamicAuth/commit/724d650965a4e8cc864a1eeb787646399fce3814))
|
|
9
|
+
* safely render message to sign ([#3655](https://github.com/dynamic-labs/DynamicAuth/issues/3655)) ([#3661](https://github.com/dynamic-labs/DynamicAuth/issues/3661)) ([8ddc30a](https://github.com/dynamic-labs/DynamicAuth/commit/8ddc30a9b43e5ef47fedcaa58e9b20a9528b8cc6))
|
|
10
|
+
|
|
2
11
|
### [0.18.100-viem.27](https://github.com/dynamic-labs/DynamicAuth/compare/v0.18.100-viem.26...v0.18.100-viem.27) (2023-10-19)
|
|
3
12
|
|
|
4
13
|
|
package/package.cjs
CHANGED
package/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/sdk-react-core",
|
|
3
|
-
"version": "0.18.100-viem.
|
|
3
|
+
"version": "0.18.100-viem.28",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/dynamic-labs/DynamicAuth.git",
|
|
@@ -15,13 +15,13 @@
|
|
|
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.28",
|
|
19
|
+
"@dynamic-labs/multi-wallet": "0.18.100-viem.28",
|
|
20
|
+
"@dynamic-labs/rpc-providers": "0.18.100-viem.28",
|
|
21
|
+
"@dynamic-labs/types": "0.18.100-viem.28",
|
|
22
|
+
"@dynamic-labs/utils": "0.18.100-viem.28",
|
|
23
|
+
"@dynamic-labs/wallet-book": "0.18.100-viem.28",
|
|
24
|
+
"@dynamic-labs/wallet-connector-core": "0.18.100-viem.28",
|
|
25
25
|
"eventemitter3": "5.0.1"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
@@ -21,7 +21,7 @@ const SignMessagePreview = ({ message, }) => {
|
|
|
21
21
|
if (signTypedData) {
|
|
22
22
|
return (jsxRuntime.jsx(SignTypedDataPreview.SignTypedDataPreview, { currentType: signTypedData.primaryType, types: signTypedData.types, showTypeName: true, data: signTypedData.message }));
|
|
23
23
|
}
|
|
24
|
-
return (jsxRuntime.jsx(Typography.Typography, { color: 'primary', variant: 'body_normal', children: jsxRuntime.jsx("span", { style: { whiteSpace: 'pre-line' },
|
|
24
|
+
return (jsxRuntime.jsx(Typography.Typography, { color: 'primary', variant: 'body_normal', children: jsxRuntime.jsx("span", { style: { whiteSpace: 'pre-line' }, children: message }) }));
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
exports.SignMessagePreview = SignMessagePreview;
|
|
@@ -17,7 +17,7 @@ const SignMessagePreview = ({ message, }) => {
|
|
|
17
17
|
if (signTypedData) {
|
|
18
18
|
return (jsx(SignTypedDataPreview, { currentType: signTypedData.primaryType, types: signTypedData.types, showTypeName: true, data: signTypedData.message }));
|
|
19
19
|
}
|
|
20
|
-
return (jsx(Typography, { color: 'primary', variant: 'body_normal', children: jsx("span", { style: { whiteSpace: 'pre-line' },
|
|
20
|
+
return (jsx(Typography, { color: 'primary', variant: 'body_normal', children: jsx("span", { style: { whiteSpace: 'pre-line' }, children: message }) }));
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
export { SignMessagePreview };
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var _tslib = require('../../../../_virtual/_tslib.cjs');
|
|
5
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
7
|
var React = require('react');
|
|
7
8
|
var viem = require('viem');
|
|
@@ -51,7 +52,7 @@ require('../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.cjs');
|
|
|
51
52
|
|
|
52
53
|
const SendBalanceView = ({ initialRecipientAddress = '', initialValue, onClickBack, onClickClose, onError, onSuccess, onDone, displayPoweredByDynamicFooter = false, }) => {
|
|
53
54
|
const [stage, setStage] = React.useState('form');
|
|
54
|
-
const { primaryWallet, network } = useInternalDynamicContext.useInternalDynamicContext();
|
|
55
|
+
const { primaryWallet, network, walletUiUtils } = useInternalDynamicContext.useInternalDynamicContext();
|
|
55
56
|
const [value, setValue] = React.useState(initialValue !== null && initialValue !== void 0 ? initialValue : null);
|
|
56
57
|
const [recipientAddress, setRecipientAddress] = React.useState(initialRecipientAddress);
|
|
57
58
|
const transactionRef = React.useRef(null);
|
|
@@ -86,10 +87,25 @@ const SendBalanceView = ({ initialRecipientAddress = '', initialValue, onClickBa
|
|
|
86
87
|
const transaction = {
|
|
87
88
|
from: primaryWallet.address,
|
|
88
89
|
to: recipientAddress,
|
|
89
|
-
type: 'eip2930',
|
|
90
90
|
value,
|
|
91
91
|
};
|
|
92
|
-
return (jsxRuntime.jsx(TransactionStage.TransactionStage, { walletConnector: walletConnector, provider: provider, transaction: transaction, title: 'Confirm transaction', onClickBack: () => setStage('form'), onError: onError, displayPoweredByDynamicFooter: displayPoweredByDynamicFooter,
|
|
92
|
+
return (jsxRuntime.jsx(TransactionStage.TransactionStage, { walletConnector: walletConnector, provider: provider, transaction: transaction, title: 'Confirm transaction', onClickBack: () => setStage('form'), onError: onError, displayPoweredByDynamicFooter: displayPoweredByDynamicFooter, mutation: ({ to, value, gasPrice, nonce }) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
93
|
+
walletUiUtils.disabledConfirmationOnce();
|
|
94
|
+
const signer = yield walletConnector.getSigner();
|
|
95
|
+
const sentTransaction = yield signer.sendTransaction({
|
|
96
|
+
account: signer.account || primaryWallet.address,
|
|
97
|
+
/**
|
|
98
|
+
* chain is set to null because viem already have the correct chain from the wallet connector
|
|
99
|
+
* docs: https://viem.sh/docs/actions/wallet/sendTransaction.html#chain-optional
|
|
100
|
+
*/
|
|
101
|
+
chain: null,
|
|
102
|
+
gasPrice,
|
|
103
|
+
nonce,
|
|
104
|
+
to,
|
|
105
|
+
value,
|
|
106
|
+
});
|
|
107
|
+
return sentTransaction;
|
|
108
|
+
}), onSuccess: (transaction) => {
|
|
93
109
|
transactionRef.current = transaction;
|
|
94
110
|
setStage('success');
|
|
95
111
|
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(transactionRef.current);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { __awaiter } from '../../../../_virtual/_tslib.js';
|
|
1
2
|
import { jsx } from 'react/jsx-runtime';
|
|
2
3
|
import { useState, useRef } from 'react';
|
|
3
4
|
import { parseEther } from 'viem';
|
|
@@ -47,7 +48,7 @@ import '../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.js';
|
|
|
47
48
|
|
|
48
49
|
const SendBalanceView = ({ initialRecipientAddress = '', initialValue, onClickBack, onClickClose, onError, onSuccess, onDone, displayPoweredByDynamicFooter = false, }) => {
|
|
49
50
|
const [stage, setStage] = useState('form');
|
|
50
|
-
const { primaryWallet, network } = useInternalDynamicContext();
|
|
51
|
+
const { primaryWallet, network, walletUiUtils } = useInternalDynamicContext();
|
|
51
52
|
const [value, setValue] = useState(initialValue !== null && initialValue !== void 0 ? initialValue : null);
|
|
52
53
|
const [recipientAddress, setRecipientAddress] = useState(initialRecipientAddress);
|
|
53
54
|
const transactionRef = useRef(null);
|
|
@@ -82,10 +83,25 @@ const SendBalanceView = ({ initialRecipientAddress = '', initialValue, onClickBa
|
|
|
82
83
|
const transaction = {
|
|
83
84
|
from: primaryWallet.address,
|
|
84
85
|
to: recipientAddress,
|
|
85
|
-
type: 'eip2930',
|
|
86
86
|
value,
|
|
87
87
|
};
|
|
88
|
-
return (jsx(TransactionStage, { walletConnector: walletConnector, provider: provider, transaction: transaction, title: 'Confirm transaction', onClickBack: () => setStage('form'), onError: onError, displayPoweredByDynamicFooter: displayPoweredByDynamicFooter,
|
|
88
|
+
return (jsx(TransactionStage, { walletConnector: walletConnector, provider: provider, transaction: transaction, title: 'Confirm transaction', onClickBack: () => setStage('form'), onError: onError, displayPoweredByDynamicFooter: displayPoweredByDynamicFooter, mutation: ({ to, value, gasPrice, nonce }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
89
|
+
walletUiUtils.disabledConfirmationOnce();
|
|
90
|
+
const signer = yield walletConnector.getSigner();
|
|
91
|
+
const sentTransaction = yield signer.sendTransaction({
|
|
92
|
+
account: signer.account || primaryWallet.address,
|
|
93
|
+
/**
|
|
94
|
+
* chain is set to null because viem already have the correct chain from the wallet connector
|
|
95
|
+
* docs: https://viem.sh/docs/actions/wallet/sendTransaction.html#chain-optional
|
|
96
|
+
*/
|
|
97
|
+
chain: null,
|
|
98
|
+
gasPrice,
|
|
99
|
+
nonce,
|
|
100
|
+
to,
|
|
101
|
+
value,
|
|
102
|
+
});
|
|
103
|
+
return sentTransaction;
|
|
104
|
+
}), onSuccess: (transaction) => {
|
|
89
105
|
transactionRef.current = transaction;
|
|
90
106
|
setStage('success');
|
|
91
107
|
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(transactionRef.current);
|
|
@@ -22,7 +22,7 @@ var isMagicConnector = require('../../../../utils/functions/isMagicConnector/isM
|
|
|
22
22
|
var sendTransactionWithAutoNonce = require('../../../../utils/functions/sendTransactionWithAutoNonce/sendTransactionWithAutoNonce.cjs');
|
|
23
23
|
require('@dynamic-labs/rpc-providers');
|
|
24
24
|
require('../../../../utils/hooks/useWallets/utils/verifyMagicIsSetup/verifyMagicIsSetup.cjs');
|
|
25
|
-
|
|
25
|
+
require('../../../../context/DynamicContext/DynamicContext.cjs');
|
|
26
26
|
require('../../../../context/ErrorContext/ErrorContext.cjs');
|
|
27
27
|
require('../../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
28
28
|
require('../../../../context/AccountExistsContext/AccountExistsContext.cjs');
|
|
@@ -48,20 +48,14 @@ require('../../../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.cjs')
|
|
|
48
48
|
var useTransactionWithGasPrice = require('../../../../utils/hooks/useTransactionWithGasPrice/useTransactionWithGasPrice.cjs');
|
|
49
49
|
|
|
50
50
|
const TransactionStage = (_a) => {
|
|
51
|
-
var { transaction, provider, walletConnector } = _a, rest = _tslib.__rest(_a, ["transaction", "provider", "walletConnector"]);
|
|
52
|
-
const { walletUiUtils } = useInternalDynamicContext.useInternalDynamicContext();
|
|
51
|
+
var { transaction, provider, walletConnector, mutation } = _a, rest = _tslib.__rest(_a, ["transaction", "provider", "walletConnector", "mutation"]);
|
|
53
52
|
const transactionWithGasPrice = useTransactionWithGasPrice.useTransactionWithGasPrice({
|
|
54
53
|
enabled: isMagicConnector.isMagicConnector(walletConnector),
|
|
55
54
|
increasePercentage: 5,
|
|
56
55
|
provider,
|
|
57
56
|
transaction,
|
|
58
57
|
});
|
|
59
|
-
return (jsxRuntime.jsx(TransactionConfirmationView.TransactionConfirmationView, Object.assign({ provider: provider, transaction: transactionWithGasPrice, mutation: () => sendTransactionWithAutoNonce.sendTransactionWithAutoNonce(walletConnector, transactionWithGasPrice,
|
|
60
|
-
walletUiUtils.disabledConfirmationOnce();
|
|
61
|
-
const signer = yield walletConnector.getSigner();
|
|
62
|
-
const sentTransaction = yield signer.sendTransaction(Object.assign(Object.assign({}, transaction), { account: transaction.from, chain: null }));
|
|
63
|
-
return sentTransaction;
|
|
64
|
-
})) }, rest)));
|
|
58
|
+
return (jsxRuntime.jsx(TransactionConfirmationView.TransactionConfirmationView, Object.assign({ provider: provider, transaction: transactionWithGasPrice, mutation: () => sendTransactionWithAutoNonce.sendTransactionWithAutoNonce(walletConnector, transactionWithGasPrice, mutation) }, rest)));
|
|
65
59
|
};
|
|
66
60
|
|
|
67
61
|
exports.TransactionStage = TransactionStage;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
+
import { Hex, TransactionRequest } from 'viem';
|
|
2
3
|
import { WalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
3
4
|
import { TransactionConfirmationViewProps } from '../../../TransactionConfirmationView';
|
|
4
5
|
type TransactionStageProps = Omit<TransactionConfirmationViewProps, 'mutation'> & {
|
|
5
6
|
walletConnector: WalletConnector;
|
|
7
|
+
mutation: (transaction: TransactionRequest) => Promise<Hex>;
|
|
6
8
|
};
|
|
7
9
|
export declare const TransactionStage: FC<TransactionStageProps>;
|
|
8
10
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __rest
|
|
1
|
+
import { __rest } from '../../../../../../_virtual/_tslib.js';
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
3
|
import 'react';
|
|
4
4
|
import '@dynamic-labs/utils';
|
|
@@ -18,7 +18,7 @@ import { isMagicConnector } from '../../../../utils/functions/isMagicConnector/i
|
|
|
18
18
|
import { sendTransactionWithAutoNonce } from '../../../../utils/functions/sendTransactionWithAutoNonce/sendTransactionWithAutoNonce.js';
|
|
19
19
|
import '@dynamic-labs/rpc-providers';
|
|
20
20
|
import '../../../../utils/hooks/useWallets/utils/verifyMagicIsSetup/verifyMagicIsSetup.js';
|
|
21
|
-
import
|
|
21
|
+
import '../../../../context/DynamicContext/DynamicContext.js';
|
|
22
22
|
import '../../../../context/ErrorContext/ErrorContext.js';
|
|
23
23
|
import '../../../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
24
24
|
import '../../../../context/AccountExistsContext/AccountExistsContext.js';
|
|
@@ -44,20 +44,14 @@ import '../../../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.js';
|
|
|
44
44
|
import { useTransactionWithGasPrice } from '../../../../utils/hooks/useTransactionWithGasPrice/useTransactionWithGasPrice.js';
|
|
45
45
|
|
|
46
46
|
const TransactionStage = (_a) => {
|
|
47
|
-
var { transaction, provider, walletConnector } = _a, rest = __rest(_a, ["transaction", "provider", "walletConnector"]);
|
|
48
|
-
const { walletUiUtils } = useInternalDynamicContext();
|
|
47
|
+
var { transaction, provider, walletConnector, mutation } = _a, rest = __rest(_a, ["transaction", "provider", "walletConnector", "mutation"]);
|
|
49
48
|
const transactionWithGasPrice = useTransactionWithGasPrice({
|
|
50
49
|
enabled: isMagicConnector(walletConnector),
|
|
51
50
|
increasePercentage: 5,
|
|
52
51
|
provider,
|
|
53
52
|
transaction,
|
|
54
53
|
});
|
|
55
|
-
return (jsx(TransactionConfirmationView, Object.assign({ provider: provider, transaction: transactionWithGasPrice, mutation: () => sendTransactionWithAutoNonce(walletConnector, transactionWithGasPrice,
|
|
56
|
-
walletUiUtils.disabledConfirmationOnce();
|
|
57
|
-
const signer = yield walletConnector.getSigner();
|
|
58
|
-
const sentTransaction = yield signer.sendTransaction(Object.assign(Object.assign({}, transaction), { account: transaction.from, chain: null }));
|
|
59
|
-
return sentTransaction;
|
|
60
|
-
})) }, rest)));
|
|
54
|
+
return (jsx(TransactionConfirmationView, Object.assign({ provider: provider, transaction: transactionWithGasPrice, mutation: () => sendTransactionWithAutoNonce(walletConnector, transactionWithGasPrice, mutation) }, rest)));
|
|
61
55
|
};
|
|
62
56
|
|
|
63
57
|
export { TransactionStage };
|