@dynamic-labs/sdk-react-core 5.4.0 → 5.5.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 +27 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +13 -13
- package/src/lib/components/TransactionCard/TransactionCard.cjs +21 -13
- package/src/lib/components/TransactionCard/TransactionCard.d.ts +2 -0
- package/src/lib/components/TransactionCard/TransactionCard.js +21 -13
- package/src/lib/components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.cjs +1 -1
- package/src/lib/components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.js +1 -1
- package/src/lib/utils/functions/getEmbeddedBitcoinAddressForNetwork/getEmbeddedBitcoinAddressForNetwork.cjs +42 -0
- package/src/lib/utils/functions/getEmbeddedBitcoinAddressForNetwork/getEmbeddedBitcoinAddressForNetwork.d.ts +20 -0
- package/src/lib/utils/functions/getEmbeddedBitcoinAddressForNetwork/getEmbeddedBitcoinAddressForNetwork.js +38 -0
- package/src/lib/utils/functions/getEmbeddedBitcoinAddressForNetwork/index.d.ts +1 -0
- package/src/lib/utils/functions/index.d.ts +2 -0
- package/src/lib/utils/functions/isEvmClientGasSponsorshipEnabled/index.d.ts +1 -0
- package/src/lib/utils/functions/isEvmClientGasSponsorshipEnabled/isEvmClientGasSponsorshipEnabled.cjs +24 -0
- package/src/lib/utils/functions/isEvmClientGasSponsorshipEnabled/isEvmClientGasSponsorshipEnabled.d.ts +7 -0
- package/src/lib/utils/functions/isEvmClientGasSponsorshipEnabled/isEvmClientGasSponsorshipEnabled.js +20 -0
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.cjs +17 -1
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.d.ts +2 -1
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.js +17 -1
- package/src/lib/utils/hooks/useSetWalletConnectorFetchers/useSetWalletConnectorFetchers.cjs +5 -0
- package/src/lib/utils/hooks/useSetWalletConnectorFetchers/useSetWalletConnectorFetchers.js +5 -0
- package/src/lib/utils/hooks/useTokenBalances/utils.cjs +6 -2
- package/src/lib/utils/hooks/useTokenBalances/utils.js +6 -2
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.cjs +7 -1
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.js +7 -1
- package/src/lib/widgets/DynamicWidget/components/Wallet/Wallet.cjs +8 -3
- package/src/lib/widgets/DynamicWidget/components/Wallet/Wallet.js +8 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,31 @@
|
|
|
1
1
|
|
|
2
|
+
## [5.5.0](https://github.com/dynamic-labs/dynamic-auth/compare/v5.4.1...v5.5.0) (2026-08-31)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* **waas-evm:** route embedded EVM sends through gas sponsorship when enabled ([#12306](https://github.com/dynamic-labs/dynamic-auth/issues/12306)) ([6046ff3](https://github.com/dynamic-labs/dynamic-auth/commit/6046ff362d8de9402793bdaa7319fda645ff4c04))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* **bitcoin:** resolve the active BTC wallet and network correctly across the widget ([#12308](https://github.com/dynamic-labs/dynamic-auth/issues/12308)) ([13e9eae](https://github.com/dynamic-labs/dynamic-auth/commit/13e9eaec19b3925db507c878988cfd82da5a6de6))
|
|
13
|
+
* **btc:** unbreak BTC transaction confirmation, testnet balances and taproot testnet switching ([#12305](https://github.com/dynamic-labs/dynamic-auth/issues/12305)) ([5fd999c](https://github.com/dynamic-labs/dynamic-auth/commit/5fd999c4c819d3a74e967c0cfa77c5877a74906b))
|
|
14
|
+
* **react-native-extension:** stop leaking expo-secure-store into consumer autolinking ([#12296](https://github.com/dynamic-labs/dynamic-auth/issues/12296)) ([1e0396a](https://github.com/dynamic-labs/dynamic-auth/commit/1e0396ab00c79aa0b2f45b6d7b1d339c1dac1203)), closes [#12254](https://github.com/dynamic-labs/dynamic-auth/issues/12254)
|
|
15
|
+
* **screening:** wire connected-wallet screening into the Send Balance UI (DYNT-1663) ([#12303](https://github.com/dynamic-labs/dynamic-auth/issues/12303)) ([5d26ff3](https://github.com/dynamic-labs/dynamic-auth/commit/5d26ff375118302522c39bd2f1fa9e04f7378eaf))
|
|
16
|
+
|
|
17
|
+
### [5.4.1](https://github.com/dynamic-labs/dynamic-auth/compare/v5.4.0...v5.4.1) (2026-08-26)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* **webview-controller:** resolve which keychain key a session belongs to ([#12246](https://github.com/dynamic-labs/dynamic-auth/issues/12246)) ([3d110db](https://github.com/dynamic-labs/dynamic-auth/commit/3d110db831c6e9d82d07d86841f5c7733924b17e))
|
|
23
|
+
* **bitcoin:** forward the password through the BTC importPrivateKey override ([#12278](https://github.com/dynamic-labs/dynamic-auth/issues/12278)) ([21e1df3](https://github.com/dynamic-labs/dynamic-auth/commit/21e1df3e33e96e2efdb15ffa0fd29a441056202e))
|
|
24
|
+
* **react-native-extension:** recover 4.x expo-secure-store sessions on keychain miss ([#12254](https://github.com/dynamic-labs/dynamic-auth/issues/12254)) ([217e991](https://github.com/dynamic-labs/dynamic-auth/commit/217e991838f3073c12e2d2fab7a2e12830faad9e)), closes [#12092](https://github.com/dynamic-labs/dynamic-auth/issues/12092) [#12092](https://github.com/dynamic-labs/dynamic-auth/issues/12092) [#12092](https://github.com/dynamic-labs/dynamic-auth/issues/12092) [#12092](https://github.com/dynamic-labs/dynamic-auth/issues/12092) [#12242](https://github.com/dynamic-labs/dynamic-auth/issues/12242) [#12242](https://github.com/dynamic-labs/dynamic-auth/issues/12242)
|
|
25
|
+
* **transaction-card:** use walletConnector prop for network/fee instead of primaryWallet ([#12063](https://github.com/dynamic-labs/dynamic-auth/issues/12063)) ([81314d2](https://github.com/dynamic-labs/dynamic-auth/commit/81314d25fba4b20ab89631bc2d9ceeb9e2b6b2ac))
|
|
26
|
+
* **waas-svm:** instrument sponsorship retry attempts ([#12281](https://github.com/dynamic-labs/dynamic-auth/issues/12281)) ([7273a4b](https://github.com/dynamic-labs/dynamic-auth/commit/7273a4bc456cad512c0e9fbcd2abd66532a2f7df))
|
|
27
|
+
* **webview-controller:** recover 4.x secure-storage sessions and surface init failures ([#12242](https://github.com/dynamic-labs/dynamic-auth/issues/12242)) ([b51605c](https://github.com/dynamic-labs/dynamic-auth/commit/b51605cc9bdbb5d695173192c502a58d899bbbdd)), closes [#12094](https://github.com/dynamic-labs/dynamic-auth/issues/12094) [#12095](https://github.com/dynamic-labs/dynamic-auth/issues/12095) [#12098](https://github.com/dynamic-labs/dynamic-auth/issues/12098) [dynamic-labs/flutter-sdk#256](https://github.com/dynamic-labs/flutter-sdk/issues/256)
|
|
28
|
+
|
|
2
29
|
## [5.4.0](https://github.com/dynamic-labs/dynamic-auth/compare/v5.3.2...v5.4.0) (2026-08-25)
|
|
3
30
|
|
|
4
31
|
|
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": "5.
|
|
3
|
+
"version": "5.5.0",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@dynamic-labs/sdk-api-core": "0.12.0",
|
|
6
6
|
"@dynamic-labs-sdk/client": "1.29.0",
|
|
@@ -18,18 +18,18 @@
|
|
|
18
18
|
"react-i18next": "13.5.0",
|
|
19
19
|
"react-international-phone": "4.5.0",
|
|
20
20
|
"yup": "0.32.11",
|
|
21
|
-
"@dynamic-labs/assert-package-version": "5.
|
|
22
|
-
"@dynamic-labs/iconic": "5.
|
|
23
|
-
"@dynamic-labs/legacy-client": "5.
|
|
24
|
-
"@dynamic-labs/locale": "5.
|
|
25
|
-
"@dynamic-labs/logger": "5.
|
|
26
|
-
"@dynamic-labs/multi-wallet": "5.
|
|
27
|
-
"@dynamic-labs/rpc-providers": "5.
|
|
28
|
-
"@dynamic-labs/store": "5.
|
|
29
|
-
"@dynamic-labs/types": "5.
|
|
30
|
-
"@dynamic-labs/utils": "5.
|
|
31
|
-
"@dynamic-labs/wallet-book": "5.
|
|
32
|
-
"@dynamic-labs/wallet-connector-core": "5.
|
|
21
|
+
"@dynamic-labs/assert-package-version": "5.5.0",
|
|
22
|
+
"@dynamic-labs/iconic": "5.5.0",
|
|
23
|
+
"@dynamic-labs/legacy-client": "5.5.0",
|
|
24
|
+
"@dynamic-labs/locale": "5.5.0",
|
|
25
|
+
"@dynamic-labs/logger": "5.5.0",
|
|
26
|
+
"@dynamic-labs/multi-wallet": "5.5.0",
|
|
27
|
+
"@dynamic-labs/rpc-providers": "5.5.0",
|
|
28
|
+
"@dynamic-labs/store": "5.5.0",
|
|
29
|
+
"@dynamic-labs/types": "5.5.0",
|
|
30
|
+
"@dynamic-labs/utils": "5.5.0",
|
|
31
|
+
"@dynamic-labs/wallet-book": "5.5.0",
|
|
32
|
+
"@dynamic-labs/wallet-connector-core": "5.5.0",
|
|
33
33
|
"eventemitter3": "5.0.1"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
@@ -126,21 +126,22 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
126
126
|
|
|
127
127
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
128
128
|
|
|
129
|
-
const TransactionCard = ({ transaction, simulationResult, isGasSponsored, isAATransaction, recipient, }) => {
|
|
130
|
-
var _a, _b, _c, _d, _e, _f
|
|
129
|
+
const TransactionCard = ({ transaction, simulationResult, isGasSponsored, isAATransaction, recipient, walletConnector, }) => {
|
|
130
|
+
var _a, _b, _c, _d, _e, _f;
|
|
131
131
|
const { t } = reactI18next.useTranslation();
|
|
132
132
|
const { primaryWallet, projectSettings, overrides } = useInternalDynamicContext.useInternalDynamicContext();
|
|
133
133
|
const networkInfo = useNetworkConfigurationsFromProjectSettings.useNetworkConfigurationsFromProjectSettings({
|
|
134
134
|
evmNetworksOverrides: overrides === null || overrides === void 0 ? void 0 : overrides.evmNetworks,
|
|
135
135
|
projectSettings,
|
|
136
136
|
});
|
|
137
|
-
const
|
|
137
|
+
const activeConnector = walletConnector !== null && walletConnector !== void 0 ? walletConnector : primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector;
|
|
138
|
+
const { chain } = useFetchChain.useFetchChain(activeConnector);
|
|
138
139
|
const networkInfoEntry = networksAndChains.getNetworkInfoEntry({
|
|
139
|
-
chain:
|
|
140
|
+
chain: activeConnector === null || activeConnector === void 0 ? void 0 : activeConnector.connectedChain,
|
|
140
141
|
networkId: chain === null || chain === void 0 ? void 0 : chain.chainId,
|
|
141
142
|
networkInfo,
|
|
142
143
|
});
|
|
143
|
-
const { symbol: nativeCurrencySymbol, decimals: nativeCurrencyDecimals } = (
|
|
144
|
+
const { symbol: nativeCurrencySymbol, decimals: nativeCurrencyDecimals } = (_a = networkInfoEntry === null || networkInfoEntry === void 0 ? void 0 : networkInfoEntry.nativeCurrency) !== null && _a !== void 0 ? _a : {};
|
|
144
145
|
const blockaidOn = simulationResult === null || simulationResult === void 0 ? void 0 : simulationResult.showTotalFiat;
|
|
145
146
|
const feeInUsd = React.useMemo(() => {
|
|
146
147
|
var _a;
|
|
@@ -169,7 +170,14 @@ const TransactionCard = ({ transaction, simulationResult, isGasSponsored, isAATr
|
|
|
169
170
|
// for solana, the fee is included in the outgoing assets already
|
|
170
171
|
return (outgoingAssetsTotal +
|
|
171
172
|
(nativeCurrencySymbol === 'SOL' || isGasSponsored ? 0 : feeInUsd || 0));
|
|
172
|
-
}, [
|
|
173
|
+
}, [
|
|
174
|
+
simulationResult === null || simulationResult === void 0 ? void 0 : simulationResult.outAssets,
|
|
175
|
+
nativeCurrencySymbol,
|
|
176
|
+
feeInUsd,
|
|
177
|
+
blockaidOn,
|
|
178
|
+
isAATransaction,
|
|
179
|
+
isGasSponsored,
|
|
180
|
+
]);
|
|
173
181
|
const getTotalAmountInUsdDisplay = (totalAmountInUsd) => {
|
|
174
182
|
if (!totalAmountInUsd)
|
|
175
183
|
return undefined;
|
|
@@ -178,9 +186,9 @@ const TransactionCard = ({ transaction, simulationResult, isGasSponsored, isAATr
|
|
|
178
186
|
: `~$${totalAmountInUsd.toFixed(2)}`;
|
|
179
187
|
};
|
|
180
188
|
const renderAssetTransfer = (transfer, index, array) => {
|
|
181
|
-
var _a, _b
|
|
189
|
+
var _a, _b;
|
|
182
190
|
if (['NATIVE', 'SOL', 'ETH'].includes(transfer.asset.type) &&
|
|
183
|
-
(
|
|
191
|
+
(activeConnector === null || activeConnector === void 0 ? void 0 : activeConnector.connectedChain) === 'SOL' &&
|
|
184
192
|
transaction.fee.gas) {
|
|
185
193
|
transfer.amount = (Number(transfer.amount) -
|
|
186
194
|
Number(transaction.fee.gas) / Math.pow(10, 9)).toString();
|
|
@@ -200,10 +208,10 @@ const TransactionCard = ({ transaction, simulationResult, isGasSponsored, isAATr
|
|
|
200
208
|
}
|
|
201
209
|
return `$${usdPrice.toFixed(2)}`;
|
|
202
210
|
};
|
|
203
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: `transaction-card__${transfer.direction}`, children: jsxRuntime.jsxs("div", { className: 'transaction-card__info-container', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'secondary', children: transfer.direction === 'in' ? 'Receive' : 'Send' }), jsxRuntime.jsxs("div", { className: 'transaction-card__amount-symbol', children: [jsxRuntime.jsxs("div", { className: 'transaction-card__token-info', children: [jsxRuntime.jsxs("div", { className: 'transaction-card__token-row', children: [jsxRuntime.jsxs(Typography.Typography, { variant: 'body_normal', color: transfer.direction === 'in' ? 'green-1' : 'error-1', children: [transfer.direction === 'out' ? '-' : '+', getAmountDisplay()] }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'primary', children: (
|
|
204
|
-
(networkInfoEntry === null || networkInfoEntry === void 0 ? void 0 : networkInfoEntry.nativeCurrency.iconUrl), alt: (
|
|
211
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: `transaction-card__${transfer.direction}`, children: jsxRuntime.jsxs("div", { className: 'transaction-card__info-container', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'secondary', children: transfer.direction === 'in' ? 'Receive' : 'Send' }), jsxRuntime.jsxs("div", { className: 'transaction-card__amount-symbol', children: [jsxRuntime.jsxs("div", { className: 'transaction-card__token-info', children: [jsxRuntime.jsxs("div", { className: 'transaction-card__token-row', children: [jsxRuntime.jsxs(Typography.Typography, { variant: 'body_normal', color: transfer.direction === 'in' ? 'green-1' : 'error-1', children: [transfer.direction === 'out' ? '-' : '+', getAmountDisplay()] }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'primary', children: (_a = (transfer.asset.symbol || transfer.asset.name)) !== null && _a !== void 0 ? _a : nativeCurrencySymbol })] }), Number(transfer.usdPrice) > 0 && (jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: transfer.direction === 'in' ? 'green-1' : 'error-1', children: getUsdPriceDisplay() }))] }), jsxRuntime.jsx("div", { className: 'transaction-card__icon', children: jsxRuntime.jsx("div", { className: 'transaction-card__icon__container', children: jsxRuntime.jsx("img", { src: transfer.asset.logoUrl ||
|
|
212
|
+
(networkInfoEntry === null || networkInfoEntry === void 0 ? void 0 : networkInfoEntry.nativeCurrency.iconUrl), alt: (_b = transfer.asset.symbol) !== null && _b !== void 0 ? _b : nativeCurrencySymbol, width: 32, height: 32, className: 'transaction-card__icon__container__main' }) }) })] })] }) }), index < array.length - 1 && (jsxRuntime.jsx("div", { className: 'transaction-card__divider' }))] }));
|
|
205
213
|
};
|
|
206
|
-
const inAssets = ((
|
|
214
|
+
const inAssets = ((_b = simulationResult === null || simulationResult === void 0 ? void 0 : simulationResult.inAssets) === null || _b === void 0 ? void 0 : _b.flatMap((assetDiff) => {
|
|
207
215
|
var _a;
|
|
208
216
|
return ((_a = assetDiff.transferIn) === null || _a === void 0 ? void 0 : _a.map((inTransfer) => {
|
|
209
217
|
var _a, _b;
|
|
@@ -215,7 +223,7 @@ const TransactionCard = ({ transaction, simulationResult, isGasSponsored, isAATr
|
|
|
215
223
|
});
|
|
216
224
|
})) || [];
|
|
217
225
|
})) || [];
|
|
218
|
-
const outAssets = ((
|
|
226
|
+
const outAssets = ((_c = simulationResult === null || simulationResult === void 0 ? void 0 : simulationResult.outAssets) === null || _c === void 0 ? void 0 : _c.flatMap((assetDiff) => {
|
|
219
227
|
var _a;
|
|
220
228
|
return ((_a = assetDiff.transferOut) === null || _a === void 0 ? void 0 : _a.map((outTransfer) => {
|
|
221
229
|
var _a, _b;
|
|
@@ -250,7 +258,7 @@ const TransactionCard = ({ transaction, simulationResult, isGasSponsored, isAATr
|
|
|
250
258
|
return `-- ${nativeCurrencySymbol}`;
|
|
251
259
|
};
|
|
252
260
|
return (jsxRuntime.jsxs("div", { className: 'transaction-card-container', children: [allAssets.length > 0 && (jsxRuntime.jsx("div", { className: 'transaction-card', children: jsxRuntime.jsx("div", { className: 'transaction-card__assets-container', children: allAssets.map((asset, index, array) => (jsxRuntime.jsx(React__default["default"].Fragment, { children: renderAssetTransfer(asset, index, array) }, `asset-${index}`))) }) })), jsxRuntime.jsx("div", { className: 'transaction-card', children: jsxRuntime.jsxs("div", { className: 'transaction-card__details', children: [recipient && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: 'transaction-card__row', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'secondary', copykey: 'dyn_send_transaction.confirmation.data.recipient', children: t('dyn_send_transaction.confirmation.data.recipient') }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'primary', "data-testid": 'transaction-recipient', children: shortenWalletAddress.shortenWalletAddress(recipient) })] }), jsxRuntime.jsx("div", { className: 'transaction-card__divider' })] })), !recipient &&
|
|
253
|
-
(transaction.to || ((
|
|
261
|
+
(transaction.to || ((_d = simulationResult === null || simulationResult === void 0 ? void 0 : simulationResult.counterparties) === null || _d === void 0 ? void 0 : _d[0])) && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: 'transaction-card__row', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'secondary', copykey: 'dyn_send_transaction.confirmation.data.destination', children: t('dyn_send_transaction.confirmation.data.destination') }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'primary', "data-testid": 'transaction-destination', children: shortenWalletAddress.shortenWalletAddress((_e = transaction.to) !== null && _e !== void 0 ? _e : (_f = simulationResult === null || simulationResult === void 0 ? void 0 : simulationResult.counterparties) === null || _f === void 0 ? void 0 : _f[0]) })] }), jsxRuntime.jsx("div", { className: 'transaction-card__divider' })] })), jsxRuntime.jsxs("div", { className: 'transaction-card__row', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'secondary', copykey: 'dyn_send_transaction.confirmation.data.network', children: t('dyn_send_transaction.confirmation.data.network') }), jsxRuntime.jsxs("div", { className: 'transaction-card__network-info', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'primary', children: (networkInfoEntry === null || networkInfoEntry === void 0 ? void 0 : networkInfoEntry.name) || 'Ethereum' }), jsxRuntime.jsx("img", { src: networkInfoEntry === null || networkInfoEntry === void 0 ? void 0 : networkInfoEntry.iconUrls[0], alt: (networkInfoEntry === null || networkInfoEntry === void 0 ? void 0 : networkInfoEntry.name) || 'Network icon', width: 16, height: 16, className: 'transaction-card__network-icon' })] })] }), !isGasSponsored && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: 'transaction-card__divider' }), jsxRuntime.jsxs("div", { className: 'transaction-card__row', children: [jsxRuntime.jsxs("div", { className: 'transaction-card__label-with-tooltip', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'secondary', copykey: 'dyn_send_transaction.confirmation.data.gas_estimate', children: t('dyn_send_transaction.confirmation.data.gas_estimate') }), jsxRuntime.jsx(Tooltip.Tooltip, { content: 'Network fees are paid to process your transaction', className: 'transaction-confirmation', children: jsxRuntime.jsx(Icon.Icon, { size: 'small', className: 'fee-tooltip', children: jsxRuntime.jsx(tooltip.ReactComponent, {}) }) })] }), jsxRuntime.jsx("div", { className: 'transaction-card__value', children: jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'primary', "data-testid": 'transaction-estimated-gas-fee', children: getGasFeeDisplay() }) })] })] })), blockaidOn &&
|
|
254
262
|
totalAmountInUsd !== undefined &&
|
|
255
263
|
totalAmountInUsd > 0 &&
|
|
256
264
|
!(isAATransaction && !isGasSponsored) && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: 'transaction-card__divider' }), jsxRuntime.jsxs("div", { className: 'transaction-card__row', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'secondary', weight: 'bold', copykey: 'dyn_send_transaction.confirmation.data.total', children: t('dyn_send_transaction.confirmation.data.total') }), jsxRuntime.jsx("div", { className: 'transaction-card__total-amount', children: jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'primary', "data-testid": 'transaction-estimated-total', children: getTotalAmountInUsdDisplay(totalAmountInUsd) }) })] })] }))] }) })] }));
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { IUITransaction } from '@dynamic-labs/types';
|
|
3
3
|
import { SimulateTransactionResponse as SimulationResult } from '@dynamic-labs/sdk-api-core';
|
|
4
|
+
import { WalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
4
5
|
type TransactionCardProps = {
|
|
5
6
|
transaction: IUITransaction;
|
|
6
7
|
simulationResult: SimulationResult | undefined;
|
|
7
8
|
isGasSponsored: boolean;
|
|
8
9
|
isAATransaction: boolean;
|
|
9
10
|
recipient?: string;
|
|
11
|
+
walletConnector?: WalletConnector;
|
|
10
12
|
};
|
|
11
13
|
export declare const TransactionCard: React.FC<TransactionCardProps>;
|
|
12
14
|
export {};
|
|
@@ -118,21 +118,22 @@ import '@dynamic-labs/store';
|
|
|
118
118
|
import '../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
|
|
119
119
|
import '@dynamic-labs-sdk/client/waas';
|
|
120
120
|
|
|
121
|
-
const TransactionCard = ({ transaction, simulationResult, isGasSponsored, isAATransaction, recipient, }) => {
|
|
122
|
-
var _a, _b, _c, _d, _e, _f
|
|
121
|
+
const TransactionCard = ({ transaction, simulationResult, isGasSponsored, isAATransaction, recipient, walletConnector, }) => {
|
|
122
|
+
var _a, _b, _c, _d, _e, _f;
|
|
123
123
|
const { t } = useTranslation();
|
|
124
124
|
const { primaryWallet, projectSettings, overrides } = useInternalDynamicContext();
|
|
125
125
|
const networkInfo = useNetworkConfigurationsFromProjectSettings({
|
|
126
126
|
evmNetworksOverrides: overrides === null || overrides === void 0 ? void 0 : overrides.evmNetworks,
|
|
127
127
|
projectSettings,
|
|
128
128
|
});
|
|
129
|
-
const
|
|
129
|
+
const activeConnector = walletConnector !== null && walletConnector !== void 0 ? walletConnector : primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector;
|
|
130
|
+
const { chain } = useFetchChain(activeConnector);
|
|
130
131
|
const networkInfoEntry = getNetworkInfoEntry({
|
|
131
|
-
chain:
|
|
132
|
+
chain: activeConnector === null || activeConnector === void 0 ? void 0 : activeConnector.connectedChain,
|
|
132
133
|
networkId: chain === null || chain === void 0 ? void 0 : chain.chainId,
|
|
133
134
|
networkInfo,
|
|
134
135
|
});
|
|
135
|
-
const { symbol: nativeCurrencySymbol, decimals: nativeCurrencyDecimals } = (
|
|
136
|
+
const { symbol: nativeCurrencySymbol, decimals: nativeCurrencyDecimals } = (_a = networkInfoEntry === null || networkInfoEntry === void 0 ? void 0 : networkInfoEntry.nativeCurrency) !== null && _a !== void 0 ? _a : {};
|
|
136
137
|
const blockaidOn = simulationResult === null || simulationResult === void 0 ? void 0 : simulationResult.showTotalFiat;
|
|
137
138
|
const feeInUsd = useMemo(() => {
|
|
138
139
|
var _a;
|
|
@@ -161,7 +162,14 @@ const TransactionCard = ({ transaction, simulationResult, isGasSponsored, isAATr
|
|
|
161
162
|
// for solana, the fee is included in the outgoing assets already
|
|
162
163
|
return (outgoingAssetsTotal +
|
|
163
164
|
(nativeCurrencySymbol === 'SOL' || isGasSponsored ? 0 : feeInUsd || 0));
|
|
164
|
-
}, [
|
|
165
|
+
}, [
|
|
166
|
+
simulationResult === null || simulationResult === void 0 ? void 0 : simulationResult.outAssets,
|
|
167
|
+
nativeCurrencySymbol,
|
|
168
|
+
feeInUsd,
|
|
169
|
+
blockaidOn,
|
|
170
|
+
isAATransaction,
|
|
171
|
+
isGasSponsored,
|
|
172
|
+
]);
|
|
165
173
|
const getTotalAmountInUsdDisplay = (totalAmountInUsd) => {
|
|
166
174
|
if (!totalAmountInUsd)
|
|
167
175
|
return undefined;
|
|
@@ -170,9 +178,9 @@ const TransactionCard = ({ transaction, simulationResult, isGasSponsored, isAATr
|
|
|
170
178
|
: `~$${totalAmountInUsd.toFixed(2)}`;
|
|
171
179
|
};
|
|
172
180
|
const renderAssetTransfer = (transfer, index, array) => {
|
|
173
|
-
var _a, _b
|
|
181
|
+
var _a, _b;
|
|
174
182
|
if (['NATIVE', 'SOL', 'ETH'].includes(transfer.asset.type) &&
|
|
175
|
-
(
|
|
183
|
+
(activeConnector === null || activeConnector === void 0 ? void 0 : activeConnector.connectedChain) === 'SOL' &&
|
|
176
184
|
transaction.fee.gas) {
|
|
177
185
|
transfer.amount = (Number(transfer.amount) -
|
|
178
186
|
Number(transaction.fee.gas) / Math.pow(10, 9)).toString();
|
|
@@ -192,10 +200,10 @@ const TransactionCard = ({ transaction, simulationResult, isGasSponsored, isAATr
|
|
|
192
200
|
}
|
|
193
201
|
return `$${usdPrice.toFixed(2)}`;
|
|
194
202
|
};
|
|
195
|
-
return (jsxs(Fragment, { children: [jsx("div", { className: `transaction-card__${transfer.direction}`, children: jsxs("div", { className: 'transaction-card__info-container', children: [jsx(Typography, { variant: 'body_normal', color: 'secondary', children: transfer.direction === 'in' ? 'Receive' : 'Send' }), jsxs("div", { className: 'transaction-card__amount-symbol', children: [jsxs("div", { className: 'transaction-card__token-info', children: [jsxs("div", { className: 'transaction-card__token-row', children: [jsxs(Typography, { variant: 'body_normal', color: transfer.direction === 'in' ? 'green-1' : 'error-1', children: [transfer.direction === 'out' ? '-' : '+', getAmountDisplay()] }), jsx(Typography, { variant: 'body_normal', color: 'primary', children: (
|
|
196
|
-
(networkInfoEntry === null || networkInfoEntry === void 0 ? void 0 : networkInfoEntry.nativeCurrency.iconUrl), alt: (
|
|
203
|
+
return (jsxs(Fragment, { children: [jsx("div", { className: `transaction-card__${transfer.direction}`, children: jsxs("div", { className: 'transaction-card__info-container', children: [jsx(Typography, { variant: 'body_normal', color: 'secondary', children: transfer.direction === 'in' ? 'Receive' : 'Send' }), jsxs("div", { className: 'transaction-card__amount-symbol', children: [jsxs("div", { className: 'transaction-card__token-info', children: [jsxs("div", { className: 'transaction-card__token-row', children: [jsxs(Typography, { variant: 'body_normal', color: transfer.direction === 'in' ? 'green-1' : 'error-1', children: [transfer.direction === 'out' ? '-' : '+', getAmountDisplay()] }), jsx(Typography, { variant: 'body_normal', color: 'primary', children: (_a = (transfer.asset.symbol || transfer.asset.name)) !== null && _a !== void 0 ? _a : nativeCurrencySymbol })] }), Number(transfer.usdPrice) > 0 && (jsx(Typography, { variant: 'body_small', color: transfer.direction === 'in' ? 'green-1' : 'error-1', children: getUsdPriceDisplay() }))] }), jsx("div", { className: 'transaction-card__icon', children: jsx("div", { className: 'transaction-card__icon__container', children: jsx("img", { src: transfer.asset.logoUrl ||
|
|
204
|
+
(networkInfoEntry === null || networkInfoEntry === void 0 ? void 0 : networkInfoEntry.nativeCurrency.iconUrl), alt: (_b = transfer.asset.symbol) !== null && _b !== void 0 ? _b : nativeCurrencySymbol, width: 32, height: 32, className: 'transaction-card__icon__container__main' }) }) })] })] }) }), index < array.length - 1 && (jsx("div", { className: 'transaction-card__divider' }))] }));
|
|
197
205
|
};
|
|
198
|
-
const inAssets = ((
|
|
206
|
+
const inAssets = ((_b = simulationResult === null || simulationResult === void 0 ? void 0 : simulationResult.inAssets) === null || _b === void 0 ? void 0 : _b.flatMap((assetDiff) => {
|
|
199
207
|
var _a;
|
|
200
208
|
return ((_a = assetDiff.transferIn) === null || _a === void 0 ? void 0 : _a.map((inTransfer) => {
|
|
201
209
|
var _a, _b;
|
|
@@ -207,7 +215,7 @@ const TransactionCard = ({ transaction, simulationResult, isGasSponsored, isAATr
|
|
|
207
215
|
});
|
|
208
216
|
})) || [];
|
|
209
217
|
})) || [];
|
|
210
|
-
const outAssets = ((
|
|
218
|
+
const outAssets = ((_c = simulationResult === null || simulationResult === void 0 ? void 0 : simulationResult.outAssets) === null || _c === void 0 ? void 0 : _c.flatMap((assetDiff) => {
|
|
211
219
|
var _a;
|
|
212
220
|
return ((_a = assetDiff.transferOut) === null || _a === void 0 ? void 0 : _a.map((outTransfer) => {
|
|
213
221
|
var _a, _b;
|
|
@@ -242,7 +250,7 @@ const TransactionCard = ({ transaction, simulationResult, isGasSponsored, isAATr
|
|
|
242
250
|
return `-- ${nativeCurrencySymbol}`;
|
|
243
251
|
};
|
|
244
252
|
return (jsxs("div", { className: 'transaction-card-container', children: [allAssets.length > 0 && (jsx("div", { className: 'transaction-card', children: jsx("div", { className: 'transaction-card__assets-container', children: allAssets.map((asset, index, array) => (jsx(React__default.Fragment, { children: renderAssetTransfer(asset, index, array) }, `asset-${index}`))) }) })), jsx("div", { className: 'transaction-card', children: jsxs("div", { className: 'transaction-card__details', children: [recipient && (jsxs(Fragment, { children: [jsxs("div", { className: 'transaction-card__row', children: [jsx(Typography, { variant: 'body_normal', color: 'secondary', copykey: 'dyn_send_transaction.confirmation.data.recipient', children: t('dyn_send_transaction.confirmation.data.recipient') }), jsx(Typography, { variant: 'body_normal', color: 'primary', "data-testid": 'transaction-recipient', children: shortenWalletAddress(recipient) })] }), jsx("div", { className: 'transaction-card__divider' })] })), !recipient &&
|
|
245
|
-
(transaction.to || ((
|
|
253
|
+
(transaction.to || ((_d = simulationResult === null || simulationResult === void 0 ? void 0 : simulationResult.counterparties) === null || _d === void 0 ? void 0 : _d[0])) && (jsxs(Fragment, { children: [jsxs("div", { className: 'transaction-card__row', children: [jsx(Typography, { variant: 'body_normal', color: 'secondary', copykey: 'dyn_send_transaction.confirmation.data.destination', children: t('dyn_send_transaction.confirmation.data.destination') }), jsx(Typography, { variant: 'body_normal', color: 'primary', "data-testid": 'transaction-destination', children: shortenWalletAddress((_e = transaction.to) !== null && _e !== void 0 ? _e : (_f = simulationResult === null || simulationResult === void 0 ? void 0 : simulationResult.counterparties) === null || _f === void 0 ? void 0 : _f[0]) })] }), jsx("div", { className: 'transaction-card__divider' })] })), jsxs("div", { className: 'transaction-card__row', children: [jsx(Typography, { variant: 'body_normal', color: 'secondary', copykey: 'dyn_send_transaction.confirmation.data.network', children: t('dyn_send_transaction.confirmation.data.network') }), jsxs("div", { className: 'transaction-card__network-info', children: [jsx(Typography, { variant: 'body_normal', color: 'primary', children: (networkInfoEntry === null || networkInfoEntry === void 0 ? void 0 : networkInfoEntry.name) || 'Ethereum' }), jsx("img", { src: networkInfoEntry === null || networkInfoEntry === void 0 ? void 0 : networkInfoEntry.iconUrls[0], alt: (networkInfoEntry === null || networkInfoEntry === void 0 ? void 0 : networkInfoEntry.name) || 'Network icon', width: 16, height: 16, className: 'transaction-card__network-icon' })] })] }), !isGasSponsored && (jsxs(Fragment, { children: [jsx("div", { className: 'transaction-card__divider' }), jsxs("div", { className: 'transaction-card__row', children: [jsxs("div", { className: 'transaction-card__label-with-tooltip', children: [jsx(Typography, { variant: 'body_normal', color: 'secondary', copykey: 'dyn_send_transaction.confirmation.data.gas_estimate', children: t('dyn_send_transaction.confirmation.data.gas_estimate') }), jsx(Tooltip, { content: 'Network fees are paid to process your transaction', className: 'transaction-confirmation', children: jsx(Icon, { size: 'small', className: 'fee-tooltip', children: jsx(SvgTooltip, {}) }) })] }), jsx("div", { className: 'transaction-card__value', children: jsx(Typography, { variant: 'body_normal', color: 'primary', "data-testid": 'transaction-estimated-gas-fee', children: getGasFeeDisplay() }) })] })] })), blockaidOn &&
|
|
246
254
|
totalAmountInUsd !== undefined &&
|
|
247
255
|
totalAmountInUsd > 0 &&
|
|
248
256
|
!(isAATransaction && !isGasSponsored) && (jsxs(Fragment, { children: [jsx("div", { className: 'transaction-card__divider' }), jsxs("div", { className: 'transaction-card__row', children: [jsx(Typography, { variant: 'body_normal', color: 'secondary', weight: 'bold', copykey: 'dyn_send_transaction.confirmation.data.total', children: t('dyn_send_transaction.confirmation.data.total') }), jsx("div", { className: 'transaction-card__total-amount', children: jsx(Typography, { variant: 'body_normal', color: 'primary', "data-testid": 'transaction-estimated-total', children: getTotalAmountInUsdDisplay(totalAmountInUsd) }) })] })] }))] }) })] }));
|
package/src/lib/components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.cjs
CHANGED
|
@@ -155,7 +155,7 @@ const TransactionConfirmationPageLayout = ({ onClickClose, isLoading, onClickBac
|
|
|
155
155
|
const totalGasFiatValue = fiatUtils.getTotalFiatCost(currentToken, transaction, nativePrice, transactionValue);
|
|
156
156
|
return hideModal ? null : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { trailing: closeButton, leading: backButton, alignContent: 'bottom', children: jsxRuntime.jsx("div", { className: 'send-balance-page-layout__header-content', children: jsxRuntime.jsx(Typography.Typography, { variant: 'title', color: 'primary', copykey: 'dyn_send_transaction.data.confirmation_tx', children: t('dyn_send_transaction.data.confirmation_tx') }) }) }), !sendBalanceTransaction && (jsxRuntime.jsx("div", { className: 'transaction-confirmation__banner', children: jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'primary', copykey: 'dyn_send_transaction.data.banner', children: t('dyn_send_transaction.data.banner') }) })), jsxRuntime.jsx(PasskeyCreatedSuccessBanner.PasskeyCreatedSuccessBanner, {}), jsxRuntime.jsxs("div", { className: 'transaction-confirmation__body', children: [jsxRuntime.jsxs("div", { className: 'transaction-confirmation__content', children: [error && (jsxRuntime.jsx("div", { className: 'transaction-confirmation__error', children: jsxRuntime.jsx(ErrorContainer.ErrorContainer, { children: transactionLink && transactionSignature ? (jsxRuntime.jsx(reactI18next.Trans, { i18nKey: 'dyn_send_transaction.error_message.confirmation_timeout_with_link', components: {
|
|
157
157
|
link: (jsxRuntime.jsx(Typography.Typography, { as: 'a', href: transactionLink, target: '_blank', rel: 'noreferrer', className: 'transaction-confirmation__error-link', variant: 'body_small' })),
|
|
158
|
-
} })) : (error) }) })), !sendBalanceTransaction ? (jsxRuntime.jsx(TransactionCard.TransactionCard, { transaction: transaction, isGasSponsored: isGasSponsored, isAATransaction: (walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.key) === 'zerodev', simulationResult: simulationResult, recipient: recipient })) : (jsxRuntime.jsx(SendBalanceTransactionCard.SendBalanceTransactionCard, { transaction: transaction, currentToken: currentToken, currencySymbol: currencySymbol, valueRounded: (_a = utils.getValueRounded(Boolean(isNativeToken), transaction)) === null || _a === void 0 ? void 0 : _a.toString(), transactionValue: transactionValue, isGasSponsored: isGasSponsored, gasFiatValue: gasFiatValue || '0', totalGasFiatValue: totalGasFiatValue || '0', currency: currency === null || currency === void 0 ? void 0 : currency.symbol, total: total, t: t, onFeeUpdate: fetchTransactionFee })), children && (jsxRuntime.jsx("div", { className: 'transaction-confirmation__rows', children: children }))] }), jsxRuntime.jsx(AnimatePresence.AnimatePresence, { animationComponent: jsxRuntime.jsx(VerticalDrawerTransition.VerticalDrawerTransition, {}), children: alert && (jsxRuntime.jsx("div", { className: 'transaction-confirmation__warning', children: alert })) }), jsxRuntime.jsxs("div", { className: 'transaction-confirmation__actions', children: [(onClickBack || onClickClose) && (jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonVariant: 'primary', buttonPadding: 'medium', onClick: onClickBack || onClickClose, expanded: true, disabled: isLoading, copykey: 'dyn_send_transaction.confirmation.cancel_button', children: t('dyn_send_transaction.confirmation.cancel_button') })), jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonVariant: 'brand-primary', buttonPadding: 'medium', onClick: onClickSend, expanded: true, loading: isLoading, disabled: disableSendButton, copykey: 'dyn_send_transaction.confirmation.send', dataTestId: 'transaction-confirmation-send', children: t('dyn_send_transaction.confirmation.send') })] }), jsxRuntime.jsx(NeedHelpSection.NeedHelpSection, {}), displayPoweredByDynamicFooter && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: 'transaction-confirmation__divider' }), jsxRuntime.jsx(PoweredByDynamic.PoweredByDynamic, { classNameRoot: 'transaction-confirmation__footer' })] }))] })] }));
|
|
158
|
+
} })) : (error) }) })), !sendBalanceTransaction ? (jsxRuntime.jsx(TransactionCard.TransactionCard, { transaction: transaction, isGasSponsored: isGasSponsored, isAATransaction: (walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.key) === 'zerodev', simulationResult: simulationResult, recipient: recipient, walletConnector: walletConnector })) : (jsxRuntime.jsx(SendBalanceTransactionCard.SendBalanceTransactionCard, { transaction: transaction, currentToken: currentToken, currencySymbol: currencySymbol, valueRounded: (_a = utils.getValueRounded(Boolean(isNativeToken), transaction)) === null || _a === void 0 ? void 0 : _a.toString(), transactionValue: transactionValue, isGasSponsored: isGasSponsored, gasFiatValue: gasFiatValue || '0', totalGasFiatValue: totalGasFiatValue || '0', currency: currency === null || currency === void 0 ? void 0 : currency.symbol, total: total, t: t, onFeeUpdate: fetchTransactionFee })), children && (jsxRuntime.jsx("div", { className: 'transaction-confirmation__rows', children: children }))] }), jsxRuntime.jsx(AnimatePresence.AnimatePresence, { animationComponent: jsxRuntime.jsx(VerticalDrawerTransition.VerticalDrawerTransition, {}), children: alert && (jsxRuntime.jsx("div", { className: 'transaction-confirmation__warning', children: alert })) }), jsxRuntime.jsxs("div", { className: 'transaction-confirmation__actions', children: [(onClickBack || onClickClose) && (jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonVariant: 'primary', buttonPadding: 'medium', onClick: onClickBack || onClickClose, expanded: true, disabled: isLoading, copykey: 'dyn_send_transaction.confirmation.cancel_button', children: t('dyn_send_transaction.confirmation.cancel_button') })), jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonVariant: 'brand-primary', buttonPadding: 'medium', onClick: onClickSend, expanded: true, loading: isLoading, disabled: disableSendButton, copykey: 'dyn_send_transaction.confirmation.send', dataTestId: 'transaction-confirmation-send', children: t('dyn_send_transaction.confirmation.send') })] }), jsxRuntime.jsx(NeedHelpSection.NeedHelpSection, {}), displayPoweredByDynamicFooter && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: 'transaction-confirmation__divider' }), jsxRuntime.jsx(PoweredByDynamic.PoweredByDynamic, { classNameRoot: 'transaction-confirmation__footer' })] }))] })] }));
|
|
159
159
|
};
|
|
160
160
|
|
|
161
161
|
exports.TransactionConfirmationPageLayout = TransactionConfirmationPageLayout;
|
package/src/lib/components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.js
CHANGED
|
@@ -151,7 +151,7 @@ const TransactionConfirmationPageLayout = ({ onClickClose, isLoading, onClickBac
|
|
|
151
151
|
const totalGasFiatValue = getTotalFiatCost(currentToken, transaction, nativePrice, transactionValue);
|
|
152
152
|
return hideModal ? null : (jsxs(Fragment, { children: [jsx(ModalHeader, { trailing: closeButton, leading: backButton, alignContent: 'bottom', children: jsx("div", { className: 'send-balance-page-layout__header-content', children: jsx(Typography, { variant: 'title', color: 'primary', copykey: 'dyn_send_transaction.data.confirmation_tx', children: t('dyn_send_transaction.data.confirmation_tx') }) }) }), !sendBalanceTransaction && (jsx("div", { className: 'transaction-confirmation__banner', children: jsx(Typography, { variant: 'body_normal', color: 'primary', copykey: 'dyn_send_transaction.data.banner', children: t('dyn_send_transaction.data.banner') }) })), jsx(PasskeyCreatedSuccessBanner, {}), jsxs("div", { className: 'transaction-confirmation__body', children: [jsxs("div", { className: 'transaction-confirmation__content', children: [error && (jsx("div", { className: 'transaction-confirmation__error', children: jsx(ErrorContainer, { children: transactionLink && transactionSignature ? (jsx(Trans, { i18nKey: 'dyn_send_transaction.error_message.confirmation_timeout_with_link', components: {
|
|
153
153
|
link: (jsx(Typography, { as: 'a', href: transactionLink, target: '_blank', rel: 'noreferrer', className: 'transaction-confirmation__error-link', variant: 'body_small' })),
|
|
154
|
-
} })) : (error) }) })), !sendBalanceTransaction ? (jsx(TransactionCard, { transaction: transaction, isGasSponsored: isGasSponsored, isAATransaction: (walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.key) === 'zerodev', simulationResult: simulationResult, recipient: recipient })) : (jsx(SendBalanceTransactionCard, { transaction: transaction, currentToken: currentToken, currencySymbol: currencySymbol, valueRounded: (_a = getValueRounded(Boolean(isNativeToken), transaction)) === null || _a === void 0 ? void 0 : _a.toString(), transactionValue: transactionValue, isGasSponsored: isGasSponsored, gasFiatValue: gasFiatValue || '0', totalGasFiatValue: totalGasFiatValue || '0', currency: currency === null || currency === void 0 ? void 0 : currency.symbol, total: total, t: t, onFeeUpdate: fetchTransactionFee })), children && (jsx("div", { className: 'transaction-confirmation__rows', children: children }))] }), jsx(AnimatePresence, { animationComponent: jsx(VerticalDrawerTransition, {}), children: alert && (jsx("div", { className: 'transaction-confirmation__warning', children: alert })) }), jsxs("div", { className: 'transaction-confirmation__actions', children: [(onClickBack || onClickClose) && (jsx(TypographyButton, { buttonVariant: 'primary', buttonPadding: 'medium', onClick: onClickBack || onClickClose, expanded: true, disabled: isLoading, copykey: 'dyn_send_transaction.confirmation.cancel_button', children: t('dyn_send_transaction.confirmation.cancel_button') })), jsx(TypographyButton, { buttonVariant: 'brand-primary', buttonPadding: 'medium', onClick: onClickSend, expanded: true, loading: isLoading, disabled: disableSendButton, copykey: 'dyn_send_transaction.confirmation.send', dataTestId: 'transaction-confirmation-send', children: t('dyn_send_transaction.confirmation.send') })] }), jsx(NeedHelpSection, {}), displayPoweredByDynamicFooter && (jsxs(Fragment, { children: [jsx("div", { className: 'transaction-confirmation__divider' }), jsx(PoweredByDynamic, { classNameRoot: 'transaction-confirmation__footer' })] }))] })] }));
|
|
154
|
+
} })) : (error) }) })), !sendBalanceTransaction ? (jsx(TransactionCard, { transaction: transaction, isGasSponsored: isGasSponsored, isAATransaction: (walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.key) === 'zerodev', simulationResult: simulationResult, recipient: recipient, walletConnector: walletConnector })) : (jsx(SendBalanceTransactionCard, { transaction: transaction, currentToken: currentToken, currencySymbol: currencySymbol, valueRounded: (_a = getValueRounded(Boolean(isNativeToken), transaction)) === null || _a === void 0 ? void 0 : _a.toString(), transactionValue: transactionValue, isGasSponsored: isGasSponsored, gasFiatValue: gasFiatValue || '0', totalGasFiatValue: totalGasFiatValue || '0', currency: currency === null || currency === void 0 ? void 0 : currency.symbol, total: total, t: t, onFeeUpdate: fetchTransactionFee })), children && (jsx("div", { className: 'transaction-confirmation__rows', children: children }))] }), jsx(AnimatePresence, { animationComponent: jsx(VerticalDrawerTransition, {}), children: alert && (jsx("div", { className: 'transaction-confirmation__warning', children: alert })) }), jsxs("div", { className: 'transaction-confirmation__actions', children: [(onClickBack || onClickClose) && (jsx(TypographyButton, { buttonVariant: 'primary', buttonPadding: 'medium', onClick: onClickBack || onClickClose, expanded: true, disabled: isLoading, copykey: 'dyn_send_transaction.confirmation.cancel_button', children: t('dyn_send_transaction.confirmation.cancel_button') })), jsx(TypographyButton, { buttonVariant: 'brand-primary', buttonPadding: 'medium', onClick: onClickSend, expanded: true, loading: isLoading, disabled: disableSendButton, copykey: 'dyn_send_transaction.confirmation.send', dataTestId: 'transaction-confirmation-send', children: t('dyn_send_transaction.confirmation.send') })] }), jsx(NeedHelpSection, {}), displayPoweredByDynamicFooter && (jsxs(Fragment, { children: [jsx("div", { className: 'transaction-confirmation__divider' }), jsx(PoweredByDynamic, { classNameRoot: 'transaction-confirmation__footer' })] }))] })] }));
|
|
155
155
|
};
|
|
156
156
|
|
|
157
157
|
export { TransactionConfirmationPageLayout };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
const BITCOIN_TESTNET_NETWORK_ID = 2;
|
|
7
|
+
/**
|
|
8
|
+
* Resolves a specific embedded Bitcoin wallet's address for the network that
|
|
9
|
+
* is currently selected.
|
|
10
|
+
*
|
|
11
|
+
* The connector's active address only ever describes the active wallet, so
|
|
12
|
+
* wallet lists must resolve each entry themselves — otherwise every wallet
|
|
13
|
+
* except the active one renders its static primary (mainnet) address while a
|
|
14
|
+
* testnet network is selected, and copying it hands out a mainnet address.
|
|
15
|
+
*
|
|
16
|
+
* Taproot wallets carry `ordinals` rows rather than `payment` ones, so the
|
|
17
|
+
* preferred type is a preference and not a requirement.
|
|
18
|
+
*
|
|
19
|
+
* @param wallet - The wallet to resolve, with its address and connector
|
|
20
|
+
* @returns the address for the selected network, or undefined when it cannot be resolved
|
|
21
|
+
*/
|
|
22
|
+
const getEmbeddedBitcoinAddressForNetwork = (wallet) => {
|
|
23
|
+
var _a, _b, _c, _d;
|
|
24
|
+
const connector = wallet === null || wallet === void 0 ? void 0 : wallet.connector;
|
|
25
|
+
if (!(wallet === null || wallet === void 0 ? void 0 : wallet.address) ||
|
|
26
|
+
!connector ||
|
|
27
|
+
connector.connectedChain !== 'BTC' ||
|
|
28
|
+
!connector.isEmbeddedWallet) {
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
const { activeNetworkId, verifiedCredentials } = connector;
|
|
32
|
+
const network = activeNetworkId === BITCOIN_TESTNET_NETWORK_ID ? 'testnet' : 'mainnet';
|
|
33
|
+
const owningCredential = verifiedCredentials === null || verifiedCredentials === void 0 ? void 0 : verifiedCredentials.find((credential) => {
|
|
34
|
+
var _a;
|
|
35
|
+
return credential.address === wallet.address ||
|
|
36
|
+
((_a = credential.walletAdditionalAddresses) === null || _a === void 0 ? void 0 : _a.some((tagged) => tagged.address === wallet.address));
|
|
37
|
+
});
|
|
38
|
+
const forNetwork = (_a = owningCredential === null || owningCredential === void 0 ? void 0 : owningCredential.walletAdditionalAddresses) === null || _a === void 0 ? void 0 : _a.filter((tagged) => tagged.network === network);
|
|
39
|
+
return ((_c = (_b = forNetwork === null || forNetwork === void 0 ? void 0 : forNetwork.find((tagged) => tagged.type === 'payment')) === null || _b === void 0 ? void 0 : _b.address) !== null && _c !== void 0 ? _c : (_d = forNetwork === null || forNetwork === void 0 ? void 0 : forNetwork.find((tagged) => tagged.type === 'ordinals')) === null || _d === void 0 ? void 0 : _d.address);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
exports.getEmbeddedBitcoinAddressForNetwork = getEmbeddedBitcoinAddressForNetwork;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { WalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
2
|
+
/**
|
|
3
|
+
* Resolves a specific embedded Bitcoin wallet's address for the network that
|
|
4
|
+
* is currently selected.
|
|
5
|
+
*
|
|
6
|
+
* The connector's active address only ever describes the active wallet, so
|
|
7
|
+
* wallet lists must resolve each entry themselves — otherwise every wallet
|
|
8
|
+
* except the active one renders its static primary (mainnet) address while a
|
|
9
|
+
* testnet network is selected, and copying it hands out a mainnet address.
|
|
10
|
+
*
|
|
11
|
+
* Taproot wallets carry `ordinals` rows rather than `payment` ones, so the
|
|
12
|
+
* preferred type is a preference and not a requirement.
|
|
13
|
+
*
|
|
14
|
+
* @param wallet - The wallet to resolve, with its address and connector
|
|
15
|
+
* @returns the address for the selected network, or undefined when it cannot be resolved
|
|
16
|
+
*/
|
|
17
|
+
export declare const getEmbeddedBitcoinAddressForNetwork: (wallet?: {
|
|
18
|
+
address?: string;
|
|
19
|
+
connector?: WalletConnector;
|
|
20
|
+
}) => string | undefined;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
const BITCOIN_TESTNET_NETWORK_ID = 2;
|
|
3
|
+
/**
|
|
4
|
+
* Resolves a specific embedded Bitcoin wallet's address for the network that
|
|
5
|
+
* is currently selected.
|
|
6
|
+
*
|
|
7
|
+
* The connector's active address only ever describes the active wallet, so
|
|
8
|
+
* wallet lists must resolve each entry themselves — otherwise every wallet
|
|
9
|
+
* except the active one renders its static primary (mainnet) address while a
|
|
10
|
+
* testnet network is selected, and copying it hands out a mainnet address.
|
|
11
|
+
*
|
|
12
|
+
* Taproot wallets carry `ordinals` rows rather than `payment` ones, so the
|
|
13
|
+
* preferred type is a preference and not a requirement.
|
|
14
|
+
*
|
|
15
|
+
* @param wallet - The wallet to resolve, with its address and connector
|
|
16
|
+
* @returns the address for the selected network, or undefined when it cannot be resolved
|
|
17
|
+
*/
|
|
18
|
+
const getEmbeddedBitcoinAddressForNetwork = (wallet) => {
|
|
19
|
+
var _a, _b, _c, _d;
|
|
20
|
+
const connector = wallet === null || wallet === void 0 ? void 0 : wallet.connector;
|
|
21
|
+
if (!(wallet === null || wallet === void 0 ? void 0 : wallet.address) ||
|
|
22
|
+
!connector ||
|
|
23
|
+
connector.connectedChain !== 'BTC' ||
|
|
24
|
+
!connector.isEmbeddedWallet) {
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
const { activeNetworkId, verifiedCredentials } = connector;
|
|
28
|
+
const network = activeNetworkId === BITCOIN_TESTNET_NETWORK_ID ? 'testnet' : 'mainnet';
|
|
29
|
+
const owningCredential = verifiedCredentials === null || verifiedCredentials === void 0 ? void 0 : verifiedCredentials.find((credential) => {
|
|
30
|
+
var _a;
|
|
31
|
+
return credential.address === wallet.address ||
|
|
32
|
+
((_a = credential.walletAdditionalAddresses) === null || _a === void 0 ? void 0 : _a.some((tagged) => tagged.address === wallet.address));
|
|
33
|
+
});
|
|
34
|
+
const forNetwork = (_a = owningCredential === null || owningCredential === void 0 ? void 0 : owningCredential.walletAdditionalAddresses) === null || _a === void 0 ? void 0 : _a.filter((tagged) => tagged.network === network);
|
|
35
|
+
return ((_c = (_b = forNetwork === null || forNetwork === void 0 ? void 0 : forNetwork.find((tagged) => tagged.type === 'payment')) === null || _b === void 0 ? void 0 : _b.address) !== null && _c !== void 0 ? _c : (_d = forNetwork === null || forNetwork === void 0 ? void 0 : forNetwork.find((tagged) => tagged.type === 'ordinals')) === null || _d === void 0 ? void 0 : _d.address);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export { getEmbeddedBitcoinAddressForNetwork };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './getEmbeddedBitcoinAddressForNetwork';
|
|
@@ -54,6 +54,7 @@ export * from './shouldManuallyReconnectOnRefresh';
|
|
|
54
54
|
export * from './stringifyURIQuery';
|
|
55
55
|
export * from './getEnabledEmbeddedWalletsAuthenticators';
|
|
56
56
|
export * from './getEmbeddedBitcoinActiveAddress';
|
|
57
|
+
export * from './getEmbeddedBitcoinAddressForNetwork';
|
|
57
58
|
export * from './getWalletAdditionalAddressByType';
|
|
58
59
|
export * from './isHardwareWalletEnabled';
|
|
59
60
|
export * from './getEnabledEmbeddedWalletProviders';
|
|
@@ -78,3 +79,4 @@ export * from './isZKSyncEnabled';
|
|
|
78
79
|
export * from './usingV3Wallets';
|
|
79
80
|
export * from './isPasskeyProviderEnabled';
|
|
80
81
|
export * from './getWaasAddressTypeLabel';
|
|
82
|
+
export * from './isEvmClientGasSponsorshipEnabled';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './isEvmClientGasSponsorshipEnabled';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var sdkApiCore = require('@dynamic-labs/sdk-api-core');
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Whether EVM gas sponsorship can be relayed from the client for this project.
|
|
10
|
+
* The serverOnly relay mode rejects client submissions, so the SDK must keep
|
|
11
|
+
* using regular transactions in that case.
|
|
12
|
+
*/
|
|
13
|
+
const isEvmClientGasSponsorshipEnabled = (projectSettings) => {
|
|
14
|
+
var _a;
|
|
15
|
+
const embeddedWallets = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _a === void 0 ? void 0 : _a.embeddedWallets;
|
|
16
|
+
if (!(embeddedWallets === null || embeddedWallets === void 0 ? void 0 : embeddedWallets.evmGasSponsorshipEnabled)) {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
const isServerOnlyRelayMode = embeddedWallets.evmGasSponsorshipRelayMode ===
|
|
20
|
+
sdkApiCore.ProjectSettingsSdkEmbeddedWalletsEvmGasSponsorshipRelayModeEnum.ServerOnly;
|
|
21
|
+
return !isServerOnlyRelayMode;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
exports.isEvmClientGasSponsorshipEnabled = isEvmClientGasSponsorshipEnabled;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ProjectSettings } from '@dynamic-labs/sdk-api-core';
|
|
2
|
+
/**
|
|
3
|
+
* Whether EVM gas sponsorship can be relayed from the client for this project.
|
|
4
|
+
* The serverOnly relay mode rejects client submissions, so the SDK must keep
|
|
5
|
+
* using regular transactions in that case.
|
|
6
|
+
*/
|
|
7
|
+
export declare const isEvmClientGasSponsorshipEnabled: (projectSettings: ProjectSettings | undefined) => boolean;
|
package/src/lib/utils/functions/isEvmClientGasSponsorshipEnabled/isEvmClientGasSponsorshipEnabled.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { ProjectSettingsSdkEmbeddedWalletsEvmGasSponsorshipRelayModeEnum } from '@dynamic-labs/sdk-api-core';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Whether EVM gas sponsorship can be relayed from the client for this project.
|
|
6
|
+
* The serverOnly relay mode rejects client submissions, so the SDK must keep
|
|
7
|
+
* using regular transactions in that case.
|
|
8
|
+
*/
|
|
9
|
+
const isEvmClientGasSponsorshipEnabled = (projectSettings) => {
|
|
10
|
+
var _a;
|
|
11
|
+
const embeddedWallets = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _a === void 0 ? void 0 : _a.embeddedWallets;
|
|
12
|
+
if (!(embeddedWallets === null || embeddedWallets === void 0 ? void 0 : embeddedWallets.evmGasSponsorshipEnabled)) {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
const isServerOnlyRelayMode = embeddedWallets.evmGasSponsorshipRelayMode ===
|
|
16
|
+
ProjectSettingsSdkEmbeddedWalletsEvmGasSponsorshipRelayModeEnum.ServerOnly;
|
|
17
|
+
return !isServerOnlyRelayMode;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export { isEvmClientGasSponsorshipEnabled };
|
|
@@ -31,6 +31,7 @@ require('../../../store/state/connectedWalletsInfo/connectedWalletsInfo.cjs');
|
|
|
31
31
|
var dynamicContextProps = require('../../../store/state/dynamicContextProps/dynamicContextProps.cjs');
|
|
32
32
|
require('../../../store/state/primaryWalletId/primaryWalletId.cjs');
|
|
33
33
|
require('../../functions/getWaasAddressTypeLabel/getWaasAddressTypeLabel.cjs');
|
|
34
|
+
var isEvmClientGasSponsorshipEnabled = require('../../functions/isEvmClientGasSponsorshipEnabled/isEvmClientGasSponsorshipEnabled.cjs');
|
|
34
35
|
var convertSdkUserToUserProfile = require('../../../client/extension/user/convertSdkUserToUserProfile/convertSdkUserToUserProfile.cjs');
|
|
35
36
|
var useUser = require('../../../client/extension/user/useUser/useUser.cjs');
|
|
36
37
|
var useProjectSettings = require('../../../client/extension/projectSettings/useProjectSettings/useProjectSettings.cjs');
|
|
@@ -41,6 +42,7 @@ var getSessionPublicKey = require('../../../client/extension/functions/getSessio
|
|
|
41
42
|
require('../../../context/DynamicContext/useDynamicContext/useDynamicContext.cjs');
|
|
42
43
|
var useInternalDynamicContext = require('../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.cjs');
|
|
43
44
|
var UserWalletsContext = require('../../../context/UserWalletsContext/UserWalletsContext.cjs');
|
|
45
|
+
var api = require('../../../data/api/api.cjs');
|
|
44
46
|
var walletOptions = require('../../../store/state/walletOptions/walletOptions.cjs');
|
|
45
47
|
var compareChains = require('../../functions/compareChains/compareChains.cjs');
|
|
46
48
|
var getNewVerifiedCredentialsFromDiff = require('../../functions/getNewVerifiedCredentialsFromDiff/getNewVerifiedCredentialsFromDiff.cjs');
|
|
@@ -54,7 +56,7 @@ var normalizeWaasChainName = require('./normalizeWaasChainName.cjs');
|
|
|
54
56
|
var normalizeWalletRequirements = require('./normalizeWalletRequirements.cjs');
|
|
55
57
|
|
|
56
58
|
const dynamicWaasKey = 'dynamicwaas';
|
|
57
|
-
const configWaasWalletConnector = ({ walletConnector, environmentId, apiBaseUrl, relayUrl, baseClientKeysharesRelayApiUrl, authMode = 'header', getSignedSessionId, getSessionPublicKey, getMfaToken, getWalletPassword, getSvmGasSponsorshipEnabled = () => false, getElevatedAccessToken, onUnauthorized, }) => {
|
|
59
|
+
const configWaasWalletConnector = ({ walletConnector, environmentId, apiBaseUrl, relayUrl, baseClientKeysharesRelayApiUrl, authMode = 'header', getSignedSessionId, getSessionPublicKey, getMfaToken, getWalletPassword, getSvmGasSponsorshipEnabled = () => false, getEvmGasSponsorshipEnabled = () => false, getElevatedAccessToken, onUnauthorized, }) => {
|
|
58
60
|
var _a, _b;
|
|
59
61
|
walletConnector.setEnvironmentId(environmentId);
|
|
60
62
|
walletConnector.setBaseApiUrl((_a = (apiBaseUrl || apiUrl.DEFAULT_WAAS_API_URL)) === null || _a === void 0 ? void 0 : _a.replace('/api/v0', ''));
|
|
@@ -93,6 +95,16 @@ const configWaasWalletConnector = ({ walletConnector, environmentId, apiBaseUrl,
|
|
|
93
95
|
if (isSolConnector && supportsSponsorshipSetting) {
|
|
94
96
|
walletConnector.setSvmGasSponsorshipEnabled(getSvmGasSponsorshipEnabled);
|
|
95
97
|
}
|
|
98
|
+
// Sync EVM gas sponsorship setting for EVM connectors, so the send flow can
|
|
99
|
+
// relay sponsored transactions instead of charging the wallet's native balance
|
|
100
|
+
const isEvmConnector = walletConnector.connectedChain === 'EVM';
|
|
101
|
+
const supportsEvmSponsorshipConfig = 'setEvmGasSponsorshipConfig' in walletConnector;
|
|
102
|
+
if (isEvmConnector && supportsEvmSponsorshipConfig) {
|
|
103
|
+
walletConnector.setEvmGasSponsorshipConfig({
|
|
104
|
+
getEnabled: getEvmGasSponsorshipEnabled,
|
|
105
|
+
getSdkApi: () => api.sdkApi(),
|
|
106
|
+
});
|
|
107
|
+
}
|
|
96
108
|
return walletConnector;
|
|
97
109
|
};
|
|
98
110
|
const useDynamicWaas = () => {
|
|
@@ -119,6 +131,9 @@ const useDynamicWaas = () => {
|
|
|
119
131
|
const svmGasSponsorshipEnabled = (_e = embeddedWalletSettings === null || embeddedWalletSettings === void 0 ? void 0 : embeddedWalletSettings.svmGasSponsorshipEnabled) !== null && _e !== void 0 ? _e : false;
|
|
120
132
|
const svmGasSponsorshipEnabledRef = React.useRef(svmGasSponsorshipEnabled);
|
|
121
133
|
svmGasSponsorshipEnabledRef.current = svmGasSponsorshipEnabled;
|
|
134
|
+
const evmGasSponsorshipEnabled = isEvmClientGasSponsorshipEnabled.isEvmClientGasSponsorshipEnabled(projectSettings);
|
|
135
|
+
const evmGasSponsorshipEnabledRef = React.useRef(evmGasSponsorshipEnabled);
|
|
136
|
+
evmGasSponsorshipEnabledRef.current = evmGasSponsorshipEnabled;
|
|
122
137
|
const authToken = getMinAuthToken.getMinAuthToken();
|
|
123
138
|
const getMfaToken = useGetMfaToken.useGetMfaToken();
|
|
124
139
|
const getWalletPassword = useGetWalletPassword.useGetWalletPassword();
|
|
@@ -155,6 +170,7 @@ const useDynamicWaas = () => {
|
|
|
155
170
|
baseClientKeysharesRelayApiUrl,
|
|
156
171
|
environmentId,
|
|
157
172
|
getElevatedAccessToken,
|
|
173
|
+
getEvmGasSponsorshipEnabled: () => evmGasSponsorshipEnabledRef.current,
|
|
158
174
|
getMfaToken,
|
|
159
175
|
getSessionPublicKey: getSessionPublicKey.getSessionPublicKey,
|
|
160
176
|
getSignedSessionId: generateChainingSignature.generateChainingSignature,
|
|
@@ -12,7 +12,7 @@ export type WalletCreationRequirement = {
|
|
|
12
12
|
network?: string;
|
|
13
13
|
};
|
|
14
14
|
};
|
|
15
|
-
export declare const configWaasWalletConnector: ({ walletConnector, environmentId, apiBaseUrl, relayUrl, baseClientKeysharesRelayApiUrl, authMode, getSignedSessionId, getSessionPublicKey, getMfaToken, getWalletPassword, getSvmGasSponsorshipEnabled, getElevatedAccessToken, onUnauthorized, }: {
|
|
15
|
+
export declare const configWaasWalletConnector: ({ walletConnector, environmentId, apiBaseUrl, relayUrl, baseClientKeysharesRelayApiUrl, authMode, getSignedSessionId, getSessionPublicKey, getMfaToken, getWalletPassword, getSvmGasSponsorshipEnabled, getEvmGasSponsorshipEnabled, getElevatedAccessToken, onUnauthorized, }: {
|
|
16
16
|
walletConnector: IDynamicWaasConnector;
|
|
17
17
|
environmentId: string;
|
|
18
18
|
apiBaseUrl: string;
|
|
@@ -26,6 +26,7 @@ export declare const configWaasWalletConnector: ({ walletConnector, environmentI
|
|
|
26
26
|
}) => Promise<string | undefined>;
|
|
27
27
|
getWalletPassword?: GetWalletPasswordFn;
|
|
28
28
|
getSvmGasSponsorshipEnabled?: () => boolean;
|
|
29
|
+
getEvmGasSponsorshipEnabled?: () => boolean;
|
|
29
30
|
getElevatedAccessToken?: (params: {
|
|
30
31
|
scope: TokenScope;
|
|
31
32
|
}) => Promise<string | undefined>;
|
|
@@ -27,6 +27,7 @@ import '../../../store/state/connectedWalletsInfo/connectedWalletsInfo.js';
|
|
|
27
27
|
import { useApiBaseUrl, useEnvironmentId } from '../../../store/state/dynamicContextProps/dynamicContextProps.js';
|
|
28
28
|
import '../../../store/state/primaryWalletId/primaryWalletId.js';
|
|
29
29
|
import '../../functions/getWaasAddressTypeLabel/getWaasAddressTypeLabel.js';
|
|
30
|
+
import { isEvmClientGasSponsorshipEnabled } from '../../functions/isEvmClientGasSponsorshipEnabled/isEvmClientGasSponsorshipEnabled.js';
|
|
30
31
|
import { convertSdkUserToUserProfile } from '../../../client/extension/user/convertSdkUserToUserProfile/convertSdkUserToUserProfile.js';
|
|
31
32
|
import { useUser } from '../../../client/extension/user/useUser/useUser.js';
|
|
32
33
|
import { useProjectSettings } from '../../../client/extension/projectSettings/useProjectSettings/useProjectSettings.js';
|
|
@@ -37,6 +38,7 @@ import { getSessionPublicKey } from '../../../client/extension/functions/getSess
|
|
|
37
38
|
import '../../../context/DynamicContext/useDynamicContext/useDynamicContext.js';
|
|
38
39
|
import { useInternalDynamicContext } from '../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.js';
|
|
39
40
|
import { useInternalUserWallets } from '../../../context/UserWalletsContext/UserWalletsContext.js';
|
|
41
|
+
import { sdkApi } from '../../../data/api/api.js';
|
|
40
42
|
import { useWalletConnectorOptions } from '../../../store/state/walletOptions/walletOptions.js';
|
|
41
43
|
import { compareChains } from '../../functions/compareChains/compareChains.js';
|
|
42
44
|
import { getNewVerifiedCredentialsFromDiff } from '../../functions/getNewVerifiedCredentialsFromDiff/getNewVerifiedCredentialsFromDiff.js';
|
|
@@ -50,7 +52,7 @@ import { normalizeWaasChainName } from './normalizeWaasChainName.js';
|
|
|
50
52
|
import { normalizeWalletRequirements } from './normalizeWalletRequirements.js';
|
|
51
53
|
|
|
52
54
|
const dynamicWaasKey = 'dynamicwaas';
|
|
53
|
-
const configWaasWalletConnector = ({ walletConnector, environmentId, apiBaseUrl, relayUrl, baseClientKeysharesRelayApiUrl, authMode = 'header', getSignedSessionId, getSessionPublicKey, getMfaToken, getWalletPassword, getSvmGasSponsorshipEnabled = () => false, getElevatedAccessToken, onUnauthorized, }) => {
|
|
55
|
+
const configWaasWalletConnector = ({ walletConnector, environmentId, apiBaseUrl, relayUrl, baseClientKeysharesRelayApiUrl, authMode = 'header', getSignedSessionId, getSessionPublicKey, getMfaToken, getWalletPassword, getSvmGasSponsorshipEnabled = () => false, getEvmGasSponsorshipEnabled = () => false, getElevatedAccessToken, onUnauthorized, }) => {
|
|
54
56
|
var _a, _b;
|
|
55
57
|
walletConnector.setEnvironmentId(environmentId);
|
|
56
58
|
walletConnector.setBaseApiUrl((_a = (apiBaseUrl || DEFAULT_WAAS_API_URL)) === null || _a === void 0 ? void 0 : _a.replace('/api/v0', ''));
|
|
@@ -89,6 +91,16 @@ const configWaasWalletConnector = ({ walletConnector, environmentId, apiBaseUrl,
|
|
|
89
91
|
if (isSolConnector && supportsSponsorshipSetting) {
|
|
90
92
|
walletConnector.setSvmGasSponsorshipEnabled(getSvmGasSponsorshipEnabled);
|
|
91
93
|
}
|
|
94
|
+
// Sync EVM gas sponsorship setting for EVM connectors, so the send flow can
|
|
95
|
+
// relay sponsored transactions instead of charging the wallet's native balance
|
|
96
|
+
const isEvmConnector = walletConnector.connectedChain === 'EVM';
|
|
97
|
+
const supportsEvmSponsorshipConfig = 'setEvmGasSponsorshipConfig' in walletConnector;
|
|
98
|
+
if (isEvmConnector && supportsEvmSponsorshipConfig) {
|
|
99
|
+
walletConnector.setEvmGasSponsorshipConfig({
|
|
100
|
+
getEnabled: getEvmGasSponsorshipEnabled,
|
|
101
|
+
getSdkApi: () => sdkApi(),
|
|
102
|
+
});
|
|
103
|
+
}
|
|
92
104
|
return walletConnector;
|
|
93
105
|
};
|
|
94
106
|
const useDynamicWaas = () => {
|
|
@@ -115,6 +127,9 @@ const useDynamicWaas = () => {
|
|
|
115
127
|
const svmGasSponsorshipEnabled = (_e = embeddedWalletSettings === null || embeddedWalletSettings === void 0 ? void 0 : embeddedWalletSettings.svmGasSponsorshipEnabled) !== null && _e !== void 0 ? _e : false;
|
|
116
128
|
const svmGasSponsorshipEnabledRef = useRef(svmGasSponsorshipEnabled);
|
|
117
129
|
svmGasSponsorshipEnabledRef.current = svmGasSponsorshipEnabled;
|
|
130
|
+
const evmGasSponsorshipEnabled = isEvmClientGasSponsorshipEnabled(projectSettings);
|
|
131
|
+
const evmGasSponsorshipEnabledRef = useRef(evmGasSponsorshipEnabled);
|
|
132
|
+
evmGasSponsorshipEnabledRef.current = evmGasSponsorshipEnabled;
|
|
118
133
|
const authToken = getMinAuthToken();
|
|
119
134
|
const getMfaToken = useGetMfaToken();
|
|
120
135
|
const getWalletPassword = useGetWalletPassword();
|
|
@@ -151,6 +166,7 @@ const useDynamicWaas = () => {
|
|
|
151
166
|
baseClientKeysharesRelayApiUrl,
|
|
152
167
|
environmentId,
|
|
153
168
|
getElevatedAccessToken,
|
|
169
|
+
getEvmGasSponsorshipEnabled: () => evmGasSponsorshipEnabledRef.current,
|
|
154
170
|
getMfaToken,
|
|
155
171
|
getSessionPublicKey,
|
|
156
172
|
getSignedSessionId: generateChainingSignature,
|
|
@@ -30,6 +30,7 @@ var dynamicContextProps = require('../../../store/state/dynamicContextProps/dyna
|
|
|
30
30
|
require('../../../store/state/primaryWalletId/primaryWalletId.cjs');
|
|
31
31
|
require('../../../store/state/connectedWalletsInfo/connectedWalletsInfo.cjs');
|
|
32
32
|
require('../../functions/getWaasAddressTypeLabel/getWaasAddressTypeLabel.cjs');
|
|
33
|
+
var isEvmClientGasSponsorshipEnabled = require('../../functions/isEvmClientGasSponsorshipEnabled/isEvmClientGasSponsorshipEnabled.cjs');
|
|
33
34
|
require('../../../events/dynamicEvents.cjs');
|
|
34
35
|
var isCookieEnabled = require('../../../client/extension/functions/isCookieEnabled/isCookieEnabled.cjs');
|
|
35
36
|
var generateChainingSignature = require('../../../client/extension/functions/generateChainingSignature/generateChainingSignature.cjs');
|
|
@@ -49,6 +50,9 @@ onUnauthorized) => {
|
|
|
49
50
|
const svmGasSponsorshipEnabled = (_c = (_b = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _a === void 0 ? void 0 : _a.embeddedWallets) === null || _b === void 0 ? void 0 : _b.svmGasSponsorshipEnabled) !== null && _c !== void 0 ? _c : false;
|
|
50
51
|
const svmGasSponsorshipEnabledRef = React.useRef(svmGasSponsorshipEnabled);
|
|
51
52
|
svmGasSponsorshipEnabledRef.current = svmGasSponsorshipEnabled;
|
|
53
|
+
const evmGasSponsorshipEnabled = isEvmClientGasSponsorshipEnabled.isEvmClientGasSponsorshipEnabled(projectSettings);
|
|
54
|
+
const evmGasSponsorshipEnabledRef = React.useRef(evmGasSponsorshipEnabled);
|
|
55
|
+
evmGasSponsorshipEnabledRef.current = evmGasSponsorshipEnabled;
|
|
52
56
|
if (!(walletOptions === null || walletOptions === void 0 ? void 0 : walletOptions.length))
|
|
53
57
|
return;
|
|
54
58
|
walletOptions.forEach((walletOption) => {
|
|
@@ -58,6 +62,7 @@ onUnauthorized) => {
|
|
|
58
62
|
apiBaseUrl: apiBaseUrl !== null && apiBaseUrl !== void 0 ? apiBaseUrl : apiUrl.DEFAULT_WAAS_API_URL,
|
|
59
63
|
authMode: isCookieAuthEnabled ? 'cookie' : 'header',
|
|
60
64
|
environmentId,
|
|
65
|
+
getEvmGasSponsorshipEnabled: () => evmGasSponsorshipEnabledRef.current,
|
|
61
66
|
getMfaToken,
|
|
62
67
|
getSessionPublicKey: getSessionPublicKey.getSessionPublicKey,
|
|
63
68
|
getSignedSessionId: generateChainingSignature.generateChainingSignature,
|
|
@@ -26,6 +26,7 @@ import { useApiBaseUrl } from '../../../store/state/dynamicContextProps/dynamicC
|
|
|
26
26
|
import '../../../store/state/primaryWalletId/primaryWalletId.js';
|
|
27
27
|
import '../../../store/state/connectedWalletsInfo/connectedWalletsInfo.js';
|
|
28
28
|
import '../../functions/getWaasAddressTypeLabel/getWaasAddressTypeLabel.js';
|
|
29
|
+
import { isEvmClientGasSponsorshipEnabled } from '../../functions/isEvmClientGasSponsorshipEnabled/isEvmClientGasSponsorshipEnabled.js';
|
|
29
30
|
import '../../../events/dynamicEvents.js';
|
|
30
31
|
import { isCookieEnabled } from '../../../client/extension/functions/isCookieEnabled/isCookieEnabled.js';
|
|
31
32
|
import { generateChainingSignature } from '../../../client/extension/functions/generateChainingSignature/generateChainingSignature.js';
|
|
@@ -45,6 +46,9 @@ onUnauthorized) => {
|
|
|
45
46
|
const svmGasSponsorshipEnabled = (_c = (_b = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _a === void 0 ? void 0 : _a.embeddedWallets) === null || _b === void 0 ? void 0 : _b.svmGasSponsorshipEnabled) !== null && _c !== void 0 ? _c : false;
|
|
46
47
|
const svmGasSponsorshipEnabledRef = useRef(svmGasSponsorshipEnabled);
|
|
47
48
|
svmGasSponsorshipEnabledRef.current = svmGasSponsorshipEnabled;
|
|
49
|
+
const evmGasSponsorshipEnabled = isEvmClientGasSponsorshipEnabled(projectSettings);
|
|
50
|
+
const evmGasSponsorshipEnabledRef = useRef(evmGasSponsorshipEnabled);
|
|
51
|
+
evmGasSponsorshipEnabledRef.current = evmGasSponsorshipEnabled;
|
|
48
52
|
if (!(walletOptions === null || walletOptions === void 0 ? void 0 : walletOptions.length))
|
|
49
53
|
return;
|
|
50
54
|
walletOptions.forEach((walletOption) => {
|
|
@@ -54,6 +58,7 @@ onUnauthorized) => {
|
|
|
54
58
|
apiBaseUrl: apiBaseUrl !== null && apiBaseUrl !== void 0 ? apiBaseUrl : DEFAULT_WAAS_API_URL,
|
|
55
59
|
authMode: isCookieAuthEnabled ? 'cookie' : 'header',
|
|
56
60
|
environmentId,
|
|
61
|
+
getEvmGasSponsorshipEnabled: () => evmGasSponsorshipEnabledRef.current,
|
|
57
62
|
getMfaToken,
|
|
58
63
|
getSessionPublicKey,
|
|
59
64
|
getSignedSessionId: generateChainingSignature,
|
|
@@ -17,6 +17,8 @@ const STELLAR_CAIP2_TESTNET = 'stellar:testnet';
|
|
|
17
17
|
const STELLAR_MAINNET_NETWORK_ID = 800;
|
|
18
18
|
// Stellar testnet numeric network ID
|
|
19
19
|
const STELLAR_TESTNET_NETWORK_ID = 801;
|
|
20
|
+
// Bitcoin mainnet numeric network ID, used when a connector reports no network
|
|
21
|
+
const BITCOIN_MAINNET_NETWORK_ID = 1;
|
|
20
22
|
/**
|
|
21
23
|
* Converts Stellar network identifiers to numeric network IDs.
|
|
22
24
|
* Supports both hash format (7ac33997...) and CAIP-2 format (stellar:pubnet).
|
|
@@ -44,9 +46,11 @@ const convertStellarNetworkToNumeric = (networkId) => {
|
|
|
44
46
|
* Resolves the network ID for API requests, handling chain-specific conversions.
|
|
45
47
|
*/
|
|
46
48
|
const resolveNetworkIdForRequest = (chainName, networkId) => {
|
|
47
|
-
// Bitcoin does not need a network ID but the request requires one
|
|
48
49
|
if (chainName === sdkApiCore.ChainEnum.Btc) {
|
|
49
|
-
|
|
50
|
+
const bitcoinNetworkId = Number(networkId);
|
|
51
|
+
return isNaN(bitcoinNetworkId)
|
|
52
|
+
? BITCOIN_MAINNET_NETWORK_ID
|
|
53
|
+
: bitcoinNetworkId;
|
|
50
54
|
}
|
|
51
55
|
if (chainName === sdkApiCore.ChainEnum.Stellar) {
|
|
52
56
|
return convertStellarNetworkToNumeric(networkId);
|
|
@@ -13,6 +13,8 @@ const STELLAR_CAIP2_TESTNET = 'stellar:testnet';
|
|
|
13
13
|
const STELLAR_MAINNET_NETWORK_ID = 800;
|
|
14
14
|
// Stellar testnet numeric network ID
|
|
15
15
|
const STELLAR_TESTNET_NETWORK_ID = 801;
|
|
16
|
+
// Bitcoin mainnet numeric network ID, used when a connector reports no network
|
|
17
|
+
const BITCOIN_MAINNET_NETWORK_ID = 1;
|
|
16
18
|
/**
|
|
17
19
|
* Converts Stellar network identifiers to numeric network IDs.
|
|
18
20
|
* Supports both hash format (7ac33997...) and CAIP-2 format (stellar:pubnet).
|
|
@@ -40,9 +42,11 @@ const convertStellarNetworkToNumeric = (networkId) => {
|
|
|
40
42
|
* Resolves the network ID for API requests, handling chain-specific conversions.
|
|
41
43
|
*/
|
|
42
44
|
const resolveNetworkIdForRequest = (chainName, networkId) => {
|
|
43
|
-
// Bitcoin does not need a network ID but the request requires one
|
|
44
45
|
if (chainName === ChainEnum.Btc) {
|
|
45
|
-
|
|
46
|
+
const bitcoinNetworkId = Number(networkId);
|
|
47
|
+
return isNaN(bitcoinNetworkId)
|
|
48
|
+
? BITCOIN_MAINNET_NETWORK_ID
|
|
49
|
+
: bitcoinNetworkId;
|
|
46
50
|
}
|
|
47
51
|
if (chainName === ChainEnum.Stellar) {
|
|
48
52
|
return convertStellarNetworkToNumeric(networkId);
|
|
@@ -186,7 +186,8 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
|
|
|
186
186
|
if (!activeConnector ||
|
|
187
187
|
(!chainId &&
|
|
188
188
|
activeConnector.connectedChain !== 'SOL' &&
|
|
189
|
-
activeConnector.connectedChain !== 'TON'
|
|
189
|
+
activeConnector.connectedChain !== 'TON' &&
|
|
190
|
+
activeConnector.connectedChain !== 'BTC')) {
|
|
190
191
|
logger.logger.error('[TransactionConfirmationView] Simulation failed:', {
|
|
191
192
|
chain: activeConnector === null || activeConnector === void 0 ? void 0 : activeConnector.connectedChain,
|
|
192
193
|
chainId,
|
|
@@ -196,6 +197,11 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
|
|
|
196
197
|
isFetchingSimulationRef.current = false;
|
|
197
198
|
return;
|
|
198
199
|
}
|
|
200
|
+
if (activeConnector.connectedChain === 'BTC') {
|
|
201
|
+
setSimulationState({ status: SimulationStatus.SKIPPED });
|
|
202
|
+
isFetchingSimulationRef.current = false;
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
199
205
|
try {
|
|
200
206
|
let result;
|
|
201
207
|
if (activeConnector.key === 'zerodev') {
|
|
@@ -178,7 +178,8 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
|
|
|
178
178
|
if (!activeConnector ||
|
|
179
179
|
(!chainId &&
|
|
180
180
|
activeConnector.connectedChain !== 'SOL' &&
|
|
181
|
-
activeConnector.connectedChain !== 'TON'
|
|
181
|
+
activeConnector.connectedChain !== 'TON' &&
|
|
182
|
+
activeConnector.connectedChain !== 'BTC')) {
|
|
182
183
|
logger.error('[TransactionConfirmationView] Simulation failed:', {
|
|
183
184
|
chain: activeConnector === null || activeConnector === void 0 ? void 0 : activeConnector.connectedChain,
|
|
184
185
|
chainId,
|
|
@@ -188,6 +189,11 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
|
|
|
188
189
|
isFetchingSimulationRef.current = false;
|
|
189
190
|
return;
|
|
190
191
|
}
|
|
192
|
+
if (activeConnector.connectedChain === 'BTC') {
|
|
193
|
+
setSimulationState({ status: SimulationStatus.SKIPPED });
|
|
194
|
+
isFetchingSimulationRef.current = false;
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
191
197
|
try {
|
|
192
198
|
let result;
|
|
193
199
|
if (activeConnector.key === 'zerodev') {
|
|
@@ -37,6 +37,7 @@ require('@dynamic-labs-sdk/client/core');
|
|
|
37
37
|
require('eventemitter3');
|
|
38
38
|
require('@dynamic-labs-sdk/client');
|
|
39
39
|
require('../../../../config/ApiEndpoint.cjs');
|
|
40
|
+
var getEmbeddedBitcoinAddressForNetwork = require('../../../../utils/functions/getEmbeddedBitcoinAddressForNetwork/getEmbeddedBitcoinAddressForNetwork.cjs');
|
|
40
41
|
require('@dynamic-labs/locale');
|
|
41
42
|
require('../../../../store/state/dynamicContextProps/dynamicContextProps.cjs');
|
|
42
43
|
require('../../../../store/state/primaryWalletId/primaryWalletId.cjs');
|
|
@@ -126,8 +127,12 @@ require('../../../../components/Popper/Popper/Popper.cjs');
|
|
|
126
127
|
require('../../../../components/Popper/PopperContext/PopperContext.cjs');
|
|
127
128
|
|
|
128
129
|
const Wallet = ({ wallet, ens, clickable }) => {
|
|
129
|
-
var _a;
|
|
130
|
-
const { connector
|
|
130
|
+
var _a, _b;
|
|
131
|
+
const { connector } = wallet;
|
|
132
|
+
// Embedded BTC wallets carry a per-network address; wallet.address is the
|
|
133
|
+
// static mainnet one, so a listed wallet would show — and copy — a mainnet
|
|
134
|
+
// address while a testnet network is selected.
|
|
135
|
+
const address = (_a = getEmbeddedBitcoinAddressForNetwork.getEmbeddedBitcoinAddressForNetwork(wallet)) !== null && _a !== void 0 ? _a : wallet.address;
|
|
131
136
|
const switchWallet = useSwitchWallet.useSwitchWallet();
|
|
132
137
|
const { t } = reactI18next.useTranslation();
|
|
133
138
|
const { setSelectedWalletWithAction, projectSettings } = useInternalDynamicContext.useInternalDynamicContext();
|
|
@@ -143,7 +148,7 @@ const Wallet = ({ wallet, ens, clickable }) => {
|
|
|
143
148
|
Icon: jsxRuntime.jsx(switchHorizontal.ReactComponent, {}),
|
|
144
149
|
callback: handleSwitchWallet,
|
|
145
150
|
copykey: 'dyn_secondary_wallet.title',
|
|
146
|
-
hide: !((
|
|
151
|
+
hide: !((_b = wallet.connector) === null || _b === void 0 ? void 0 : _b.isAvailable),
|
|
147
152
|
text: t('dyn_secondary_wallet.title'),
|
|
148
153
|
},
|
|
149
154
|
];
|
|
@@ -33,6 +33,7 @@ import '@dynamic-labs-sdk/client/core';
|
|
|
33
33
|
import 'eventemitter3';
|
|
34
34
|
import '@dynamic-labs-sdk/client';
|
|
35
35
|
import '../../../../config/ApiEndpoint.js';
|
|
36
|
+
import { getEmbeddedBitcoinAddressForNetwork } from '../../../../utils/functions/getEmbeddedBitcoinAddressForNetwork/getEmbeddedBitcoinAddressForNetwork.js';
|
|
36
37
|
import '@dynamic-labs/locale';
|
|
37
38
|
import '../../../../store/state/dynamicContextProps/dynamicContextProps.js';
|
|
38
39
|
import '../../../../store/state/primaryWalletId/primaryWalletId.js';
|
|
@@ -122,8 +123,12 @@ import '../../../../components/Popper/Popper/Popper.js';
|
|
|
122
123
|
import '../../../../components/Popper/PopperContext/PopperContext.js';
|
|
123
124
|
|
|
124
125
|
const Wallet = ({ wallet, ens, clickable }) => {
|
|
125
|
-
var _a;
|
|
126
|
-
const { connector
|
|
126
|
+
var _a, _b;
|
|
127
|
+
const { connector } = wallet;
|
|
128
|
+
// Embedded BTC wallets carry a per-network address; wallet.address is the
|
|
129
|
+
// static mainnet one, so a listed wallet would show — and copy — a mainnet
|
|
130
|
+
// address while a testnet network is selected.
|
|
131
|
+
const address = (_a = getEmbeddedBitcoinAddressForNetwork(wallet)) !== null && _a !== void 0 ? _a : wallet.address;
|
|
127
132
|
const switchWallet = useSwitchWallet();
|
|
128
133
|
const { t } = useTranslation();
|
|
129
134
|
const { setSelectedWalletWithAction, projectSettings } = useInternalDynamicContext();
|
|
@@ -139,7 +144,7 @@ const Wallet = ({ wallet, ens, clickable }) => {
|
|
|
139
144
|
Icon: jsx(SvgSwitchHorizontal, {}),
|
|
140
145
|
callback: handleSwitchWallet,
|
|
141
146
|
copykey: 'dyn_secondary_wallet.title',
|
|
142
|
-
hide: !((
|
|
147
|
+
hide: !((_b = wallet.connector) === null || _b === void 0 ? void 0 : _b.isAvailable),
|
|
143
148
|
text: t('dyn_secondary_wallet.title'),
|
|
144
149
|
},
|
|
145
150
|
];
|