@dynamic-labs/sdk-react-core 5.4.1 → 5.6.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 +22 -0
- package/package.cjs +4 -4
- package/package.js +4 -4
- package/package.json +16 -16
- 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/useBusinessAccounts/useBusinessAccounts.cjs +2 -1
- package/src/lib/utils/hooks/useBusinessAccounts/useBusinessAccounts.d.ts +2 -1
- package/src/lib/utils/hooks/useBusinessAccounts/useBusinessAccounts.js +2 -1
- 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/usePolicies/usePolicies.d.ts +12 -12
- 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,26 @@
|
|
|
1
1
|
|
|
2
|
+
## [5.6.0](https://github.com/dynamic-labs/dynamic-auth/compare/v5.5.0...v5.6.0) (2026-09-01)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* forward target signer passwords ([#12300](https://github.com/dynamic-labs/dynamic-auth/issues/12300)) ([39b142b](https://github.com/dynamic-labs/dynamic-auth/commit/39b142b51767ad54ae57196a381bec19a892c06f))
|
|
8
|
+
|
|
9
|
+
## [5.5.0](https://github.com/dynamic-labs/dynamic-auth/compare/v5.4.1...v5.5.0) (2026-08-31)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
* **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))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* **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))
|
|
20
|
+
* **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))
|
|
21
|
+
* **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)
|
|
22
|
+
* **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))
|
|
23
|
+
|
|
2
24
|
### [5.4.1](https://github.com/dynamic-labs/dynamic-auth/compare/v5.4.0...v5.4.1) (2026-08-26)
|
|
3
25
|
|
|
4
26
|
|
package/package.cjs
CHANGED
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
|
-
var version = "5.
|
|
6
|
+
var version = "5.6.0";
|
|
7
7
|
var dependencies = {
|
|
8
8
|
"@dynamic-labs/sdk-api-core": "0.12.0",
|
|
9
|
-
"@dynamic-labs-sdk/client": "1.
|
|
10
|
-
"@dynamic-labs-wallet/browser-wallet-client": "1.0.
|
|
11
|
-
"@dynamic-labs-wallet/forward-mpc-client": "1.0.
|
|
9
|
+
"@dynamic-labs-sdk/client": "1.31.0",
|
|
10
|
+
"@dynamic-labs-wallet/browser-wallet-client": "1.0.118",
|
|
11
|
+
"@dynamic-labs-wallet/forward-mpc-client": "1.0.2",
|
|
12
12
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
|
13
13
|
"@marsidev/react-turnstile": "1.5.2",
|
|
14
14
|
"@thumbmarkjs/thumbmarkjs": "0.16.0",
|
package/package.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
var version = "5.
|
|
2
|
+
var version = "5.6.0";
|
|
3
3
|
var dependencies = {
|
|
4
4
|
"@dynamic-labs/sdk-api-core": "0.12.0",
|
|
5
|
-
"@dynamic-labs-sdk/client": "1.
|
|
6
|
-
"@dynamic-labs-wallet/browser-wallet-client": "1.0.
|
|
7
|
-
"@dynamic-labs-wallet/forward-mpc-client": "1.0.
|
|
5
|
+
"@dynamic-labs-sdk/client": "1.31.0",
|
|
6
|
+
"@dynamic-labs-wallet/browser-wallet-client": "1.0.118",
|
|
7
|
+
"@dynamic-labs-wallet/forward-mpc-client": "1.0.2",
|
|
8
8
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
|
9
9
|
"@marsidev/react-turnstile": "1.5.2",
|
|
10
10
|
"@thumbmarkjs/thumbmarkjs": "0.16.0",
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/sdk-react-core",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.6.0",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@dynamic-labs/sdk-api-core": "0.12.0",
|
|
6
|
-
"@dynamic-labs-sdk/client": "1.
|
|
7
|
-
"@dynamic-labs-wallet/browser-wallet-client": "1.0.
|
|
8
|
-
"@dynamic-labs-wallet/forward-mpc-client": "1.0.
|
|
6
|
+
"@dynamic-labs-sdk/client": "1.31.0",
|
|
7
|
+
"@dynamic-labs-wallet/browser-wallet-client": "1.0.118",
|
|
8
|
+
"@dynamic-labs-wallet/forward-mpc-client": "1.0.2",
|
|
9
9
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
|
10
10
|
"@marsidev/react-turnstile": "1.5.2",
|
|
11
11
|
"@thumbmarkjs/thumbmarkjs": "0.16.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.6.0",
|
|
22
|
+
"@dynamic-labs/iconic": "5.6.0",
|
|
23
|
+
"@dynamic-labs/legacy-client": "5.6.0",
|
|
24
|
+
"@dynamic-labs/locale": "5.6.0",
|
|
25
|
+
"@dynamic-labs/logger": "5.6.0",
|
|
26
|
+
"@dynamic-labs/multi-wallet": "5.6.0",
|
|
27
|
+
"@dynamic-labs/rpc-providers": "5.6.0",
|
|
28
|
+
"@dynamic-labs/store": "5.6.0",
|
|
29
|
+
"@dynamic-labs/types": "5.6.0",
|
|
30
|
+
"@dynamic-labs/utils": "5.6.0",
|
|
31
|
+
"@dynamic-labs/wallet-book": "5.6.0",
|
|
32
|
+
"@dynamic-labs/wallet-connector-core": "5.6.0",
|
|
33
33
|
"eventemitter3": "5.0.1"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
@@ -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 };
|
|
@@ -86,7 +86,7 @@ const useBusinessAccounts = () => {
|
|
|
86
86
|
}), [getBusinessClient]);
|
|
87
87
|
// Adds a signer via the SSE reshare ceremony on the wallet's chain connector.
|
|
88
88
|
// Mints the new signer's share set and seeds it to client-keyshare-service.
|
|
89
|
-
const addBusinessAccountSigner = React.useCallback((_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ accountAddress, walletId, chainName, businessAccountId, targetSignerIdentity, signerType, password, }) {
|
|
89
|
+
const addBusinessAccountSigner = React.useCallback((_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ accountAddress, walletId, chainName, businessAccountId, targetSignerIdentity, signerType, password, targetSignerPassword, }) {
|
|
90
90
|
const connector = getWaasWalletConnector(chainName);
|
|
91
91
|
if (!connector) {
|
|
92
92
|
throw new Error(NO_CONNECTOR_ERROR);
|
|
@@ -112,6 +112,7 @@ const useBusinessAccounts = () => {
|
|
|
112
112
|
password,
|
|
113
113
|
signerType,
|
|
114
114
|
targetSignerIdentity,
|
|
115
|
+
targetSignerPassword,
|
|
115
116
|
walletId,
|
|
116
117
|
});
|
|
117
118
|
}), [addWalletToBusinessAccount, getWaasWalletConnector]);
|
|
@@ -65,10 +65,11 @@ export type AddBusinessAccountSignerInput = {
|
|
|
65
65
|
targetSignerIdentity: TargetSignerIdentity;
|
|
66
66
|
signerType?: BusinessAccountSignerType;
|
|
67
67
|
password?: string;
|
|
68
|
+
targetSignerPassword?: string;
|
|
68
69
|
};
|
|
69
70
|
export declare const useBusinessAccounts: () => {
|
|
70
71
|
addBusinessAccountMember: (input: AddBusinessAccountMemberInput) => Promise<any>;
|
|
71
|
-
addBusinessAccountSigner: ({ accountAddress, walletId, chainName, businessAccountId, targetSignerIdentity, signerType, password, }: AddBusinessAccountSignerInput) => Promise<{
|
|
72
|
+
addBusinessAccountSigner: ({ accountAddress, walletId, chainName, businessAccountId, targetSignerIdentity, signerType, password, targetSignerPassword, }: AddBusinessAccountSignerInput) => Promise<{
|
|
72
73
|
shareSetId: string;
|
|
73
74
|
}>;
|
|
74
75
|
addWalletToBusinessAccount: (input: AddWalletToBusinessAccountInput) => Promise<any>;
|
|
@@ -82,7 +82,7 @@ const useBusinessAccounts = () => {
|
|
|
82
82
|
}), [getBusinessClient]);
|
|
83
83
|
// Adds a signer via the SSE reshare ceremony on the wallet's chain connector.
|
|
84
84
|
// Mints the new signer's share set and seeds it to client-keyshare-service.
|
|
85
|
-
const addBusinessAccountSigner = useCallback((_a) => __awaiter(void 0, [_a], void 0, function* ({ accountAddress, walletId, chainName, businessAccountId, targetSignerIdentity, signerType, password, }) {
|
|
85
|
+
const addBusinessAccountSigner = useCallback((_a) => __awaiter(void 0, [_a], void 0, function* ({ accountAddress, walletId, chainName, businessAccountId, targetSignerIdentity, signerType, password, targetSignerPassword, }) {
|
|
86
86
|
const connector = getWaasWalletConnector(chainName);
|
|
87
87
|
if (!connector) {
|
|
88
88
|
throw new Error(NO_CONNECTOR_ERROR);
|
|
@@ -108,6 +108,7 @@ const useBusinessAccounts = () => {
|
|
|
108
108
|
password,
|
|
109
109
|
signerType,
|
|
110
110
|
targetSignerIdentity,
|
|
111
|
+
targetSignerPassword,
|
|
111
112
|
walletId,
|
|
112
113
|
});
|
|
113
114
|
}), [addWalletToBusinessAccount, getWaasWalletConnector]);
|
|
@@ -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,
|
|
@@ -15,22 +15,22 @@ export type RemoveWalletPolicyRuleInput = WithWalletId<Parameters<typeof removeW
|
|
|
15
15
|
export type RemoveSignerPolicyRuleInput = WithWalletId<Parameters<typeof removeSignerPolicyRuleFromSDK>[0]>;
|
|
16
16
|
export type RemoveAccountPolicyRuleInput = Parameters<typeof removeAccountPolicyRuleFromSDK>[0];
|
|
17
17
|
export declare const usePolicies: () => {
|
|
18
|
-
createPolicy: (input: CreatePolicyInput) => Promise<import("@dynamic-labs-
|
|
19
|
-
getAccountPolicyLayer: (input: GetAccountPolicyLayerInput) => Promise<import("@dynamic-labs-
|
|
18
|
+
createPolicy: (input: CreatePolicyInput) => Promise<import("@dynamic-labs/sdk-api-core").WaasPolicyLayerResponse>;
|
|
19
|
+
getAccountPolicyLayer: (input: GetAccountPolicyLayerInput) => Promise<import("@dynamic-labs/sdk-api-core").WaasPolicyLayerResponse>;
|
|
20
20
|
getPolicy: (input: GetPolicyInput) => Promise<{
|
|
21
21
|
layerId: string;
|
|
22
22
|
rules: import("@dynamic-labs-sdk/client/waas").PolicyRules;
|
|
23
|
-
unmapped: import("@dynamic-labs-
|
|
23
|
+
unmapped: import("@dynamic-labs/sdk-api-core").WaasPolicyRule[];
|
|
24
24
|
updatedAt: Date;
|
|
25
25
|
}>;
|
|
26
|
-
getSignerPolicyLayer: ({ shareSetId, walletId }: GetSignerPolicyLayerInput) => Promise<import("@dynamic-labs-
|
|
27
|
-
getWalletPolicyLayer: ({ walletId }: GetWalletPolicyLayerInput) => Promise<import("@dynamic-labs-
|
|
28
|
-
removeAccountPolicyRule: (input: RemoveAccountPolicyRuleInput) => Promise<import("@dynamic-labs-
|
|
29
|
-
removePolicyRules: (input: RemovePolicyRulesInput) => Promise<import("@dynamic-labs-
|
|
30
|
-
removeSignerPolicyRule: ({ ruleId, shareSetId, walletId }: RemoveSignerPolicyRuleInput) => Promise<import("@dynamic-labs-
|
|
31
|
-
removeWalletPolicyRule: ({ ruleId, walletId }: RemoveWalletPolicyRuleInput) => Promise<import("@dynamic-labs-
|
|
32
|
-
upsertAccountPolicyRule: (input: UpsertAccountPolicyRuleInput) => Promise<import("@dynamic-labs-
|
|
33
|
-
upsertSignerPolicyRule: ({ rule, shareSetId, walletId }: UpsertSignerPolicyRuleInput) => Promise<import("@dynamic-labs-
|
|
34
|
-
upsertWalletPolicyRule: ({ rule, walletId }: UpsertWalletPolicyRuleInput) => Promise<import("@dynamic-labs-
|
|
26
|
+
getSignerPolicyLayer: ({ shareSetId, walletId }: GetSignerPolicyLayerInput) => Promise<import("@dynamic-labs/sdk-api-core").WaasPolicyLayerResponse>;
|
|
27
|
+
getWalletPolicyLayer: ({ walletId }: GetWalletPolicyLayerInput) => Promise<import("@dynamic-labs/sdk-api-core").WaasPolicyLayerResponse>;
|
|
28
|
+
removeAccountPolicyRule: (input: RemoveAccountPolicyRuleInput) => Promise<import("@dynamic-labs/sdk-api-core").WaasPolicyLayerResponse>;
|
|
29
|
+
removePolicyRules: (input: RemovePolicyRulesInput) => Promise<import("@dynamic-labs/sdk-api-core").WaasPolicyLayerResponse>;
|
|
30
|
+
removeSignerPolicyRule: ({ ruleId, shareSetId, walletId }: RemoveSignerPolicyRuleInput) => Promise<import("@dynamic-labs/sdk-api-core").WaasPolicyLayerResponse>;
|
|
31
|
+
removeWalletPolicyRule: ({ ruleId, walletId }: RemoveWalletPolicyRuleInput) => Promise<import("@dynamic-labs/sdk-api-core").WaasPolicyLayerResponse>;
|
|
32
|
+
upsertAccountPolicyRule: (input: UpsertAccountPolicyRuleInput) => Promise<import("@dynamic-labs/sdk-api-core").WaasPolicyLayerResponse>;
|
|
33
|
+
upsertSignerPolicyRule: ({ rule, shareSetId, walletId }: UpsertSignerPolicyRuleInput) => Promise<import("@dynamic-labs/sdk-api-core").WaasPolicyLayerResponse>;
|
|
34
|
+
upsertWalletPolicyRule: ({ rule, walletId }: UpsertWalletPolicyRuleInput) => Promise<import("@dynamic-labs/sdk-api-core").WaasPolicyLayerResponse>;
|
|
35
35
|
};
|
|
36
36
|
export {};
|
|
@@ -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
|
];
|