@dynamic-labs-sdk/client 1.24.1 → 1.26.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/dist/client/core/createCore/createCore.d.ts.map +1 -1
- package/dist/client/core/types/DynamicCore.d.ts +11 -0
- package/dist/client/core/types/DynamicCore.d.ts.map +1 -1
- package/dist/core.cjs +7 -7
- package/dist/core.cjs.map +1 -1
- package/dist/core.esm.js +6 -7
- package/dist/core.esm.js.map +1 -1
- package/dist/core.native.esm.js +6 -6
- package/dist/core.native.esm.js.map +1 -1
- package/dist/errors/CoinbaseTransferMfaFailedError.d.ts +34 -0
- package/dist/errors/CoinbaseTransferMfaFailedError.d.ts.map +1 -0
- package/dist/errors/CoinbaseTransferMfaRequiredError.d.ts +37 -0
- package/dist/errors/CoinbaseTransferMfaRequiredError.d.ts.map +1 -0
- package/dist/errors/CoinbaseTravelRuleRequiredError.d.ts +55 -0
- package/dist/errors/CoinbaseTravelRuleRequiredError.d.ts.map +1 -0
- package/dist/errors/TransactionBroadcastError.d.ts +44 -0
- package/dist/errors/TransactionBroadcastError.d.ts.map +1 -0
- package/dist/exports/core.d.ts +2 -0
- package/dist/exports/core.d.ts.map +1 -1
- package/dist/exports/index.d.ts +9 -1
- package/dist/exports/index.d.ts.map +1 -1
- package/dist/exports/waas.d.ts +3 -1
- package/dist/exports/waas.d.ts.map +1 -1
- package/dist/exports/waasCore.d.ts +1 -1
- package/dist/exports/waasCore.d.ts.map +1 -1
- package/dist/{getNetworkProviderFromNetworkId-nLBIQ_5p.native.esm.js → getNetworkProviderFromNetworkId-C5GtE2ef.native.esm.js} +29 -4
- package/dist/getNetworkProviderFromNetworkId-C5GtE2ef.native.esm.js.map +1 -0
- package/dist/{getNetworkProviderFromNetworkId-CIcatN8-.cjs → getNetworkProviderFromNetworkId-CSxvdrc9.cjs} +32 -2
- package/dist/{getNetworkProviderFromNetworkId-CYONf9-8.esm.js.map → getNetworkProviderFromNetworkId-CSxvdrc9.cjs.map} +1 -1
- package/dist/{getNetworkProviderFromNetworkId-CYONf9-8.esm.js → getNetworkProviderFromNetworkId-D7lIOS6I.esm.js} +27 -3
- package/dist/getNetworkProviderFromNetworkId-D7lIOS6I.esm.js.map +1 -0
- package/dist/{getSignedSessionId-B2kslh_k.esm.js → getSignedSessionId-B5Dijw-8.native.esm.js} +12 -3
- package/dist/{getSignedSessionId-DV0hK3Tu.native.esm.js.map → getSignedSessionId-B5Dijw-8.native.esm.js.map} +1 -1
- package/dist/{getSignedSessionId-DV0hK3Tu.native.esm.js → getSignedSessionId-BiL9k0nE.esm.js} +3 -3
- package/dist/getSignedSessionId-BiL9k0nE.esm.js.map +1 -0
- package/dist/{getSignedSessionId-NZ8ndqG1.cjs → getSignedSessionId-CpcQiZTF.cjs} +17 -2
- package/dist/getSignedSessionId-CpcQiZTF.cjs.map +1 -0
- package/dist/{getWalletProviderByKey-DzKZXm5S.cjs → getWalletProviderByKey-BMJ9TcjM.cjs} +2 -2
- package/dist/{getWalletProviderByKey-DzKZXm5S.cjs.map → getWalletProviderByKey-BMJ9TcjM.cjs.map} +1 -1
- package/dist/{getWalletProviderByKey-DPZP397j.native.esm.js → getWalletProviderByKey-CBIrILYZ.native.esm.js} +2 -2
- package/dist/{getWalletProviderByKey-DPZP397j.native.esm.js.map → getWalletProviderByKey-CBIrILYZ.native.esm.js.map} +1 -1
- package/dist/{getWalletProviderByKey-Dh3JbMi6.esm.js → getWalletProviderByKey-CU8zmrf2.esm.js} +2 -2
- package/dist/{getWalletProviderByKey-Dh3JbMi6.esm.js.map → getWalletProviderByKey-CU8zmrf2.esm.js.map} +1 -1
- package/dist/index.cjs +405 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +397 -8
- package/dist/index.esm.js.map +1 -1
- package/dist/index.native.esm.js +397 -8
- package/dist/index.native.esm.js.map +1 -1
- package/dist/{isDynamicWaasEnabled-BbhbghRE.esm.js → isDynamicWaasEnabled-CBvSRUgG.esm.js} +34 -3
- package/dist/isDynamicWaasEnabled-CBvSRUgG.esm.js.map +1 -0
- package/dist/{isDynamicWaasEnabled-BmB0lQJf.native.esm.js → isDynamicWaasEnabled-d82cX7j9.native.esm.js} +34 -3
- package/dist/isDynamicWaasEnabled-d82cX7j9.native.esm.js.map +1 -0
- package/dist/{isDynamicWaasEnabled-D2U3MRnA.cjs → isDynamicWaasEnabled-idmeju9B.cjs} +39 -2
- package/dist/isDynamicWaasEnabled-idmeju9B.cjs.map +1 -0
- package/dist/{isMfaRequiredForAction-DP0kk0tY.native.esm.js → isMfaRequiredForAction-1O_rFiPN.native.esm.js} +32 -3
- package/dist/isMfaRequiredForAction-1O_rFiPN.native.esm.js.map +1 -0
- package/dist/{isMfaRequiredForAction-DBlmv1ew.esm.js → isMfaRequiredForAction-D1rhRlDu.esm.js} +2 -2
- package/dist/{isMfaRequiredForAction-DBlmv1ew.esm.js.map → isMfaRequiredForAction-D1rhRlDu.esm.js.map} +1 -1
- package/dist/{isMfaRequiredForAction-DCyorelQ.cjs → isMfaRequiredForAction-D5o4qznt.cjs} +2 -2
- package/dist/{isMfaRequiredForAction-DCyorelQ.cjs.map → isMfaRequiredForAction-D5o4qznt.cjs.map} +1 -1
- package/dist/{isUserOnboardingComplete-DygWGu6p.cjs → isUserOnboardingComplete-BfRUVwrT.cjs} +3 -3
- package/dist/{isUserOnboardingComplete-DygWGu6p.cjs.map → isUserOnboardingComplete-BfRUVwrT.cjs.map} +1 -1
- package/dist/{isUserOnboardingComplete-Ebw4x90F.native.esm.js → isUserOnboardingComplete-bR7jwdjO.native.esm.js} +3 -3
- package/dist/{isUserOnboardingComplete-Ebw4x90F.native.esm.js.map → isUserOnboardingComplete-bR7jwdjO.native.esm.js.map} +1 -1
- package/dist/{isUserOnboardingComplete-WzXFgdor.esm.js → isUserOnboardingComplete-k3nlisFA.esm.js} +3 -3
- package/dist/{isUserOnboardingComplete-WzXFgdor.esm.js.map → isUserOnboardingComplete-k3nlisFA.esm.js.map} +1 -1
- package/dist/{migrateFromFireblocks-CzPWPaDr.cjs → migrateFromFireblocks-BcYmEZ3_.cjs} +3 -54
- package/dist/migrateFromFireblocks-BcYmEZ3_.cjs.map +1 -0
- package/dist/{migrateFromFireblocks-BkcGdF_B.esm.js → migrateFromFireblocks-Bm7eIfaa.esm.js} +4 -43
- package/dist/migrateFromFireblocks-Bm7eIfaa.esm.js.map +1 -0
- package/dist/migrateFromFireblocks-DVP5tGv_.native.esm.js +65 -0
- package/dist/migrateFromFireblocks-DVP5tGv_.native.esm.js.map +1 -0
- package/dist/modules/apiClient/utils/clientErrorMapper/clientErrorMapper.d.ts.map +1 -1
- package/dist/modules/auth/social/social.types.d.ts +1 -1
- package/dist/modules/auth/social/social.types.d.ts.map +1 -1
- package/dist/modules/funding/coinbase/coinbase.consts.d.ts +74 -0
- package/dist/modules/funding/coinbase/coinbase.consts.d.ts.map +1 -0
- package/dist/modules/funding/coinbase/coinbase.types.d.ts +150 -1
- package/dist/modules/funding/coinbase/coinbase.types.d.ts.map +1 -1
- package/dist/modules/funding/coinbase/createCoinbaseExchangeTransfer/createCoinbaseExchangeTransfer.d.ts +83 -0
- package/dist/modules/funding/coinbase/createCoinbaseExchangeTransfer/createCoinbaseExchangeTransfer.d.ts.map +1 -0
- package/dist/modules/funding/coinbase/createCoinbaseExchangeTransfer/index.d.ts +3 -0
- package/dist/modules/funding/coinbase/createCoinbaseExchangeTransfer/index.d.ts.map +1 -0
- package/dist/modules/funding/coinbase/getCoinbaseAccounts/getCoinbaseAccounts.d.ts +41 -0
- package/dist/modules/funding/coinbase/getCoinbaseAccounts/getCoinbaseAccounts.d.ts.map +1 -0
- package/dist/modules/funding/coinbase/getCoinbaseAccounts/index.d.ts +3 -0
- package/dist/modules/funding/coinbase/getCoinbaseAccounts/index.d.ts.map +1 -0
- package/dist/modules/funding/coinbase/utils/parseCoinbaseTravelRuleMissingFields/index.d.ts +2 -0
- package/dist/modules/funding/coinbase/utils/parseCoinbaseTravelRuleMissingFields/index.d.ts.map +1 -0
- package/dist/modules/funding/coinbase/utils/parseCoinbaseTravelRuleMissingFields/parseCoinbaseTravelRuleMissingFields.d.ts +26 -0
- package/dist/modules/funding/coinbase/utils/parseCoinbaseTravelRuleMissingFields/parseCoinbaseTravelRuleMissingFields.d.ts.map +1 -0
- package/dist/modules/waas/broadcastWaasTransaction/broadcastWaasTransaction.d.ts +18 -0
- package/dist/modules/waas/broadcastWaasTransaction/broadcastWaasTransaction.d.ts.map +1 -0
- package/dist/modules/waas/businessAccounts/addBusinessAccountMember/addBusinessAccountMember.d.ts.map +1 -1
- package/dist/modules/waas/businessAccounts/addBusinessAccountSigner/addBusinessAccountSigner.d.ts.map +1 -1
- package/dist/modules/waas/businessAccounts/addWalletToBusinessAccount/addWalletToBusinessAccount.d.ts.map +1 -1
- package/dist/modules/waas/businessAccounts/createBusinessAccount/createBusinessAccount.d.ts +13 -1
- package/dist/modules/waas/businessAccounts/createBusinessAccount/createBusinessAccount.d.ts.map +1 -1
- package/dist/modules/waas/businessAccounts/getBusinessAccount/getBusinessAccount.d.ts +2 -1
- package/dist/modules/waas/businessAccounts/getBusinessAccount/getBusinessAccount.d.ts.map +1 -1
- package/dist/modules/waas/businessAccounts/listBusinessAccounts/listBusinessAccounts.d.ts +15 -2
- package/dist/modules/waas/businessAccounts/listBusinessAccounts/listBusinessAccounts.d.ts.map +1 -1
- package/dist/modules/waas/businessAccounts/removeBusinessAccountMember/removeBusinessAccountMember.d.ts.map +1 -1
- package/dist/modules/waas/businessAccounts/removeBusinessAccountSigner/removeBusinessAccountSigner.d.ts.map +1 -1
- package/dist/modules/waas/businessAccounts/removeBusinessAccountWallet/index.d.ts +2 -0
- package/dist/modules/waas/businessAccounts/removeBusinessAccountWallet/index.d.ts.map +1 -0
- package/dist/modules/waas/businessAccounts/removeBusinessAccountWallet/removeBusinessAccountWallet.d.ts +32 -0
- package/dist/modules/waas/businessAccounts/removeBusinessAccountWallet/removeBusinessAccountWallet.d.ts.map +1 -0
- package/dist/modules/waas/businessAccounts/transferBusinessAccountOwnership/transferBusinessAccountOwnership.d.ts.map +1 -1
- package/dist/modules/waas/businessAccounts/updateBusinessAccountMemberRole/updateBusinessAccountMemberRole.d.ts.map +1 -1
- package/dist/modules/waas/createWaasClient/createWaasClient.d.ts.map +1 -1
- package/dist/modules/waas/createWaasProvider/createWaasProvider.d.ts.map +1 -1
- package/dist/modules/waas/transactionBroadcastErrorMapper/transactionBroadcastErrorMapper.d.ts +8 -0
- package/dist/modules/waas/transactionBroadcastErrorMapper/transactionBroadcastErrorMapper.d.ts.map +1 -0
- package/dist/modules/waas/waas.types.d.ts +14 -0
- package/dist/modules/waas/waas.types.d.ts.map +1 -1
- package/dist/modules/wallets/walletProviderRegistry/index.d.ts +2 -1
- package/dist/modules/wallets/walletProviderRegistry/index.d.ts.map +1 -1
- package/dist/modules/wallets/walletProviderRegistry/walletProviderRegistry.consts.d.ts +34 -0
- package/dist/modules/wallets/walletProviderRegistry/walletProviderRegistry.consts.d.ts.map +1 -0
- package/dist/modules/wallets/walletProviderRegistry/walletProviderRegistry.types.d.ts +5 -21
- package/dist/modules/wallets/walletProviderRegistry/walletProviderRegistry.types.d.ts.map +1 -1
- package/dist/services/appForeground/appForeground.types.d.ts +36 -0
- package/dist/services/appForeground/appForeground.types.d.ts.map +1 -0
- package/dist/services/appForeground/createAppForegroundSubscriber/createAppForegroundSubscriber.d.ts +12 -0
- package/dist/services/appForeground/createAppForegroundSubscriber/createAppForegroundSubscriber.d.ts.map +1 -0
- package/dist/services/appForeground/createAppForegroundSubscriber/index.d.ts +2 -0
- package/dist/services/appForeground/createAppForegroundSubscriber/index.d.ts.map +1 -0
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/{updateAuthFromVerifyResponse-B8tDJdXY.cjs → updateAuthFromVerifyResponse-CPOvKWih.cjs} +20 -26
- package/dist/updateAuthFromVerifyResponse-CPOvKWih.cjs.map +1 -0
- package/dist/{NativeModuleNotLinkedError-dFDBC524.native.esm.js → updateAuthFromVerifyResponse-CTfG6oZa.native.esm.js} +21 -56
- package/dist/updateAuthFromVerifyResponse-CTfG6oZa.native.esm.js.map +1 -0
- package/dist/{updateAuthFromVerifyResponse-C_yGmd99.esm.js → updateAuthFromVerifyResponse-CfqviWkz.esm.js} +20 -26
- package/dist/updateAuthFromVerifyResponse-CfqviWkz.esm.js.map +1 -0
- package/dist/utils/assertChainName/assertChainName.d.ts +15 -0
- package/dist/utils/assertChainName/assertChainName.d.ts.map +1 -0
- package/dist/utils/assertChainName/index.d.ts +2 -0
- package/dist/utils/assertChainName/index.d.ts.map +1 -0
- package/dist/waas.cjs +75 -35
- package/dist/waas.cjs.map +1 -1
- package/dist/waas.esm.js +75 -37
- package/dist/waas.esm.js.map +1 -1
- package/dist/waas.native.esm.js +75 -36
- package/dist/waas.native.esm.js.map +1 -1
- package/dist/waasCore.cjs +138 -12
- package/dist/waasCore.cjs.map +1 -1
- package/dist/waasCore.esm.js +135 -9
- package/dist/waasCore.esm.js.map +1 -1
- package/dist/waasCore.native.esm.js +351 -8
- package/dist/waasCore.native.esm.js.map +1 -1
- package/package.json +3 -3
- package/dist/NativeModuleNotLinkedError-dFDBC524.native.esm.js.map +0 -1
- package/dist/consumeMfaTokenIfRequiredForAction-DdGzQwQQ.esm.js +0 -12
- package/dist/consumeMfaTokenIfRequiredForAction-DdGzQwQQ.esm.js.map +0 -1
- package/dist/consumeMfaTokenIfRequiredForAction-IsOFRL68.cjs +0 -17
- package/dist/consumeMfaTokenIfRequiredForAction-IsOFRL68.cjs.map +0 -1
- package/dist/getNetworkProviderFromNetworkId-CIcatN8-.cjs.map +0 -1
- package/dist/getNetworkProviderFromNetworkId-nLBIQ_5p.native.esm.js.map +0 -1
- package/dist/getSignedSessionId-B2kslh_k.esm.js.map +0 -1
- package/dist/getSignedSessionId-NZ8ndqG1.cjs.map +0 -1
- package/dist/isDynamicWaasEnabled-BbhbghRE.esm.js.map +0 -1
- package/dist/isDynamicWaasEnabled-BmB0lQJf.native.esm.js.map +0 -1
- package/dist/isDynamicWaasEnabled-D2U3MRnA.cjs.map +0 -1
- package/dist/isMfaRequiredForAction-DP0kk0tY.native.esm.js.map +0 -1
- package/dist/migrateFromFireblocks-BkcGdF_B.esm.js.map +0 -1
- package/dist/migrateFromFireblocks-C1yQ4dm7.native.esm.js +0 -321
- package/dist/migrateFromFireblocks-C1yQ4dm7.native.esm.js.map +0 -1
- package/dist/migrateFromFireblocks-CzPWPaDr.cjs.map +0 -1
- package/dist/updateAuthFromVerifyResponse-B8tDJdXY.cjs.map +0 -1
- package/dist/updateAuthFromVerifyResponse-C_yGmd99.esm.js.map +0 -1
|
@@ -1,13 +1,261 @@
|
|
|
1
|
-
import { Ct as
|
|
2
|
-
import "./isDynamicWaasEnabled-
|
|
3
|
-
import {
|
|
4
|
-
import "./
|
|
5
|
-
import { n as consumeMfaTokenIfRequiredForAction, t as getSignedSessionId } from "./getSignedSessionId-
|
|
6
|
-
import {
|
|
1
|
+
import { Ct as version, M as CHAINS_INFO_MAP, St as name, V as createApiClient, at as CLIENT_SDK_NAME, bt as BaseError, d as DYNAMIC_WAAS_METADATA, dt as assertDefined, i as InvalidParamError, it as APIError, j as getChainFromVerifiedCredentialChain, l as DEFAULT_WAAS_BASE_API_URL, mt as randomString, pt as getElevatedAccessToken, u as DEFAULT_WAAS_BASE_MPC_RELAY_API_URL, ut as isCookieEnabled, xt as getCore } from "./updateAuthFromVerifyResponse-CTfG6oZa.native.esm.js";
|
|
2
|
+
import { n as TransactionBroadcastError } from "./isDynamicWaasEnabled-d82cX7j9.native.esm.js";
|
|
3
|
+
import { i as NativeModuleNotLinkedError } from "./isMfaRequiredForAction-1O_rFiPN.native.esm.js";
|
|
4
|
+
import { a as WaasOnboardingIncompleteError, i as preconnectWaasIframe, o as WaasLoadFailedError, t as isUserOnboardingComplete } from "./isUserOnboardingComplete-bR7jwdjO.native.esm.js";
|
|
5
|
+
import { n as consumeMfaTokenIfRequiredForAction, t as getSignedSessionId } from "./getSignedSessionId-B5Dijw-8.native.esm.js";
|
|
6
|
+
import { n as getWaasWalletProviderFromWalletAccount, t as migrateFromFireblocks } from "./migrateFromFireblocks-DVP5tGv_.native.esm.js";
|
|
7
7
|
import { assertPackageVersion } from "@dynamic-labs-sdk/assert-package-version";
|
|
8
|
-
import { MFAAction, TokenScope, WalletProviderEnum } from "@dynamic-labs/sdk-api-core";
|
|
9
|
-
import {
|
|
8
|
+
import { MFAAction, TokenScope, WaasTransactionBroadcastStatus, WaasTransactionEncoding, WalletProviderEnum } from "@dynamic-labs/sdk-api-core";
|
|
9
|
+
import { ACCESSIBLE, getGenericPassword, resetGenericPassword, setGenericPassword } from "react-native-keychain";
|
|
10
|
+
import { NativeEventEmitter, TurboModuleRegistry } from "react-native";
|
|
11
|
+
import { DynamicWalletClient, ThresholdSignatureScheme, WalletOperation } from "@dynamic-labs-wallet/browser-wallet-client";
|
|
10
12
|
|
|
13
|
+
//#region src/errors/CorruptedKeyShareError.ts
|
|
14
|
+
/**
|
|
15
|
+
* Thrown when a persisted client key share cannot be parsed back into its
|
|
16
|
+
* structured form (e.g. a partially-written or corrupted keychain entry).
|
|
17
|
+
*
|
|
18
|
+
* Surfaced as a typed error rather than swallowed so callers can distinguish
|
|
19
|
+
* "no key share stored" (empty result) from "key share exists but is
|
|
20
|
+
* unreadable" — the latter must never be silently treated as the former,
|
|
21
|
+
* which could trigger an unintended re-keygen that overwrites recoverable
|
|
22
|
+
* material.
|
|
23
|
+
*/
|
|
24
|
+
var CorruptedKeyShareError = class extends BaseError {
|
|
25
|
+
constructor({ cause = null } = {}) {
|
|
26
|
+
super({
|
|
27
|
+
cause,
|
|
28
|
+
code: "corrupted_key_share_error",
|
|
29
|
+
details: "The stored client key share could not be parsed. The secure storage entry may be partially written or corrupted.",
|
|
30
|
+
docsUrl: null,
|
|
31
|
+
name: "CorruptedKeyShareError",
|
|
32
|
+
shortMessage: "Stored client key share is corrupted and cannot be read."
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
//#endregion
|
|
38
|
+
//#region src/turboModules/NativeDynamicWebView.ts
|
|
39
|
+
var NativeDynamicWebView_default = TurboModuleRegistry.get("DynamicClientWebView");
|
|
40
|
+
|
|
41
|
+
//#endregion
|
|
42
|
+
//#region src/errors/WebViewLoadFailedError.ts
|
|
43
|
+
/**
|
|
44
|
+
* Thrown when `DynamicWebView.open()` (via the WaaS transport provider)
|
|
45
|
+
* fails to establish a usable load. Inspect `reason` to distinguish the
|
|
46
|
+
* failure mode; `statusCode` and `underlyingError` provide structured
|
|
47
|
+
* metadata for the cases that have it.
|
|
48
|
+
*/
|
|
49
|
+
var WebViewLoadFailedError = class extends BaseError {
|
|
50
|
+
reason;
|
|
51
|
+
statusCode;
|
|
52
|
+
underlyingError;
|
|
53
|
+
constructor({ reason, shortMessage, cause = null, statusCode, underlyingError }) {
|
|
54
|
+
super({
|
|
55
|
+
cause,
|
|
56
|
+
code: "webview_load_failed_error",
|
|
57
|
+
details: underlyingError,
|
|
58
|
+
docsUrl: null,
|
|
59
|
+
name: "WebViewLoadFailedError",
|
|
60
|
+
shortMessage
|
|
61
|
+
});
|
|
62
|
+
this.reason = reason;
|
|
63
|
+
this.statusCode = statusCode;
|
|
64
|
+
this.underlyingError = underlyingError;
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
//#endregion
|
|
69
|
+
//#region src/modules/waas/createWaasClient/translateNativeOpenError.ts
|
|
70
|
+
const REASON_BY_NATIVE_CODE = {
|
|
71
|
+
webview_cancelled: "cancelled",
|
|
72
|
+
webview_content_process_terminated: "content_process_terminated",
|
|
73
|
+
webview_http_error: "http_error",
|
|
74
|
+
webview_instance_busy: "instance_busy",
|
|
75
|
+
webview_invalid_url: "invalid_url",
|
|
76
|
+
webview_navigation_failed: "navigation_failed",
|
|
77
|
+
webview_no_host_view: "no_host_view",
|
|
78
|
+
webview_unsupported: "unsupported"
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Translates a native `DynamicWebView.open()` rejection into a typed
|
|
82
|
+
* `WebViewLoadFailedError`. Maps the native RCT reject code to the JS-level
|
|
83
|
+
* `WebViewLoadFailureReason` discriminator (falling back to
|
|
84
|
+
* `navigation_failed` for unrecognized codes) and carries through the
|
|
85
|
+
* structured `statusCode` / `underlyingError` metadata.
|
|
86
|
+
*
|
|
87
|
+
* The `reason` it produces is the contract `createWaasSDKContainer` branches
|
|
88
|
+
* on — notably `emitError` swallows `cancelled` because that code is only ever
|
|
89
|
+
* produced by our own `close()` teardown (verified on both the iOS and Android
|
|
90
|
+
* native sides). Keep `REASON_BY_NATIVE_CODE` in sync with the native reject
|
|
91
|
+
* codes so that branching stays correct.
|
|
92
|
+
*
|
|
93
|
+
* @notInstrumented
|
|
94
|
+
*/
|
|
95
|
+
const translateNativeOpenError = (err) => {
|
|
96
|
+
const rejection = err ?? {};
|
|
97
|
+
const isNativeRejectionCode = (code) => code != void 0 && code in REASON_BY_NATIVE_CODE;
|
|
98
|
+
const reason = isNativeRejectionCode(rejection.code) ? REASON_BY_NATIVE_CODE[rejection.code] : "navigation_failed";
|
|
99
|
+
return new WebViewLoadFailedError({
|
|
100
|
+
cause: err instanceof Error ? err : null,
|
|
101
|
+
reason,
|
|
102
|
+
shortMessage: rejection.message ?? `DynamicWebView open failed (${reason}).`,
|
|
103
|
+
statusCode: rejection.userInfo?.DynamicWebViewStatusCode,
|
|
104
|
+
underlyingError: rejection.userInfo?.DynamicWebViewUnderlying
|
|
105
|
+
});
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
//#endregion
|
|
109
|
+
//#region src/modules/waas/createWaasClient/createNativeWaasSDKContainer.native.ts
|
|
110
|
+
const NATIVE_MODULE_NAME = "DynamicClientWebView";
|
|
111
|
+
const MESSAGE_EVENT_NAME = "dynamicBridgeMessage";
|
|
112
|
+
const generateInstanceId = () => `${Date.now().toString(36)}-${crypto.randomUUID()}`;
|
|
113
|
+
/**
|
|
114
|
+
* Creates a React Native `WaasSDKContainer` backed by a hidden, headless native
|
|
115
|
+
* WebView (WKWebView on iOS, `android.webkit.WebView` on Android) hosted by the
|
|
116
|
+
* `DynamicClientWebView` TurboModule. Each invocation returns an isolated
|
|
117
|
+
* container with its own instance ID, native WebView, and message routing.
|
|
118
|
+
*
|
|
119
|
+
* Used for MPC operations (signing, key-share management) where there is
|
|
120
|
+
* nothing for the user to see. The VISIBLE private-key export display is no
|
|
121
|
+
* longer a native overlay — it is rendered by the `ExportPrivateKey` component
|
|
122
|
+
* (`@dynamic-labs-sdk/react-native-embedded-wallet-export`) on top of
|
|
123
|
+
* `react-native-webview`, so it scrolls and positions like any RN view.
|
|
124
|
+
*
|
|
125
|
+
* @notInstrumented
|
|
126
|
+
*/
|
|
127
|
+
const createNativeWaasSDKContainer = () => {
|
|
128
|
+
if (!NativeDynamicWebView_default) throw new NativeModuleNotLinkedError({ moduleName: NATIVE_MODULE_NAME });
|
|
129
|
+
const nativeModule = NativeDynamicWebView_default;
|
|
130
|
+
const instanceId = generateInstanceId();
|
|
131
|
+
const emitter = new NativeEventEmitter(nativeModule);
|
|
132
|
+
const messageHandlers = [];
|
|
133
|
+
const errorHandlers = [];
|
|
134
|
+
let subscription = null;
|
|
135
|
+
let destroyed = false;
|
|
136
|
+
const emitError = (err) => {
|
|
137
|
+
if (destroyed) return;
|
|
138
|
+
const translated = translateNativeOpenError(err);
|
|
139
|
+
if (translated.reason === "cancelled") return;
|
|
140
|
+
for (const handler of errorHandlers) handler(translated);
|
|
141
|
+
};
|
|
142
|
+
return {
|
|
143
|
+
destroy() {
|
|
144
|
+
if (destroyed) return;
|
|
145
|
+
destroyed = true;
|
|
146
|
+
subscription?.remove();
|
|
147
|
+
subscription = null;
|
|
148
|
+
messageHandlers.length = 0;
|
|
149
|
+
errorHandlers.length = 0;
|
|
150
|
+
nativeModule.close(instanceId);
|
|
151
|
+
},
|
|
152
|
+
isAlive: () => !destroyed,
|
|
153
|
+
onError(handler) {
|
|
154
|
+
errorHandlers.push(handler);
|
|
155
|
+
return () => {
|
|
156
|
+
const index = errorHandlers.indexOf(handler);
|
|
157
|
+
if (index !== -1) errorHandlers.splice(index, 1);
|
|
158
|
+
};
|
|
159
|
+
},
|
|
160
|
+
onMessage(handler) {
|
|
161
|
+
messageHandlers.push(handler);
|
|
162
|
+
subscription ??= emitter.addListener(MESSAGE_EVENT_NAME, (payload) => {
|
|
163
|
+
if (payload.instanceId !== instanceId) return;
|
|
164
|
+
for (const fn of messageHandlers) fn(payload.data);
|
|
165
|
+
});
|
|
166
|
+
return () => {
|
|
167
|
+
const index = messageHandlers.indexOf(handler);
|
|
168
|
+
if (index !== -1) messageHandlers.splice(index, 1);
|
|
169
|
+
if (messageHandlers.length === 0) {
|
|
170
|
+
subscription?.remove();
|
|
171
|
+
subscription = null;
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
},
|
|
175
|
+
sendMessage(data) {
|
|
176
|
+
nativeModule.sendMessage(instanceId, data);
|
|
177
|
+
},
|
|
178
|
+
async setUrl(url) {
|
|
179
|
+
nativeModule.open(instanceId, url).catch(emitError);
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
//#endregion
|
|
185
|
+
//#region src/modules/waas/createWaasClient/createWaasSDKContainer.native.ts
|
|
186
|
+
/**
|
|
187
|
+
* Creates a React Native `WaasSDKContainer` backed by a hidden, headless native
|
|
188
|
+
* WebView (WKWebView on iOS, `android.webkit.WebView` on Android) hosted by the
|
|
189
|
+
* `DynamicClientWebView` TurboModule. Used for MPC operations (signing, key-share
|
|
190
|
+
* management) where there is nothing for the user to see.
|
|
191
|
+
*
|
|
192
|
+
* For the private-key export display — where the hosted page must render the
|
|
193
|
+
* key for the user — use the `ExportPrivateKey` component from
|
|
194
|
+
* `@dynamic-labs-sdk/react-native-embedded-wallet-export`, which renders the
|
|
195
|
+
* key inside a `react-native-webview` instead of a native overlay.
|
|
196
|
+
*
|
|
197
|
+
* @notInstrumented
|
|
198
|
+
*/
|
|
199
|
+
const createWaasSDKContainer = () => createNativeWaasSDKContainer();
|
|
200
|
+
|
|
201
|
+
//#endregion
|
|
202
|
+
//#region src/modules/waas/createWaasClient/createWaasClient.native.ts
|
|
203
|
+
/**
|
|
204
|
+
* Keychain security options for the client key share. The share is wallet
|
|
205
|
+
* key material that cannot be re-derived locally, so the options are pinned
|
|
206
|
+
* explicitly rather than inherited from `react-native-keychain` defaults
|
|
207
|
+
* (which vary across versions and platforms).
|
|
208
|
+
*
|
|
209
|
+
* `WHEN_UNLOCKED_THIS_DEVICE_ONLY` keeps the share readable only while the
|
|
210
|
+
* device is unlocked, excludes it from iCloud Keychain sync, and prevents it
|
|
211
|
+
* migrating to a new device on encrypted-backup restore. It deliberately does
|
|
212
|
+
* NOT set `accessControl` (e.g. biometry) — reads must not surface a Face ID /
|
|
213
|
+
* passcode prompt, since the share is read on routine wallet operations.
|
|
214
|
+
*/
|
|
215
|
+
const KEY_SHARE_KEYCHAIN_OPTIONS = { accessible: ACCESSIBLE.WHEN_UNLOCKED_THIS_DEVICE_ONLY };
|
|
216
|
+
/** @notInstrumented */
|
|
217
|
+
const createWaasClient = ({ chainName }, client) => {
|
|
218
|
+
const core = getCore(client);
|
|
219
|
+
const additionalTrustedOrigins = core.waas?.additionalTrustedOrigins;
|
|
220
|
+
const getKeyShareService = (accountAddress) => `${core.environmentId}:${accountAddress}`;
|
|
221
|
+
return new DynamicWalletClient({
|
|
222
|
+
authMode: isCookieEnabled(client) ? "cookie" : "header",
|
|
223
|
+
authToken: client.token || "",
|
|
224
|
+
baseApiUrl: (core.apiBaseUrl || DEFAULT_WAAS_BASE_API_URL).replace("/api/v0", ""),
|
|
225
|
+
baseMPCRelayApiUrl: client.projectSettings?.sdk.waas?.relayUrl || DEFAULT_WAAS_BASE_MPC_RELAY_API_URL,
|
|
226
|
+
chainName,
|
|
227
|
+
environmentId: core.environmentId,
|
|
228
|
+
hostOrigin: core.metadata?.universalLink,
|
|
229
|
+
sdkVersion: `${CLIENT_SDK_NAME}/${core.version}`,
|
|
230
|
+
...additionalTrustedOrigins == void 0 ? {} : { additionalTrustedOrigins },
|
|
231
|
+
...core.waas?.loadTimeoutMs == void 0 ? {} : { iframeLoadTimeout: core.waas.loadTimeoutMs },
|
|
232
|
+
...core.waas?.maxLoadRetries == void 0 ? {} : { maxRetryAttempts: core.waas.maxLoadRetries }
|
|
233
|
+
}, {
|
|
234
|
+
createWaasSDKContainer,
|
|
235
|
+
secureStorage: {
|
|
236
|
+
getClientKeyShare: async (accountAddress) => {
|
|
237
|
+
const result = await getGenericPassword({ service: getKeyShareService(accountAddress) });
|
|
238
|
+
if (!result) return [];
|
|
239
|
+
try {
|
|
240
|
+
return JSON.parse(result.password);
|
|
241
|
+
} catch (cause) {
|
|
242
|
+
throw new CorruptedKeyShareError({ cause: cause instanceof Error ? cause : null });
|
|
243
|
+
}
|
|
244
|
+
},
|
|
245
|
+
removeClientKeyShare: async (accountAddress) => {
|
|
246
|
+
await resetGenericPassword({ service: getKeyShareService(accountAddress) });
|
|
247
|
+
},
|
|
248
|
+
setClientKeyShare: async (accountAddress, shares) => {
|
|
249
|
+
await setGenericPassword(accountAddress, JSON.stringify(shares), {
|
|
250
|
+
...KEY_SHARE_KEYCHAIN_OPTIONS,
|
|
251
|
+
service: getKeyShareService(accountAddress)
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
});
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
//#endregion
|
|
11
259
|
//#region src/utils/createTranslateRejection/createTranslateRejection.ts
|
|
12
260
|
/**
|
|
13
261
|
* Builds a reusable decorator, bound once to a `match`/`mapTo` pair, that wraps
|
|
@@ -62,6 +310,94 @@ const getActionAuthorizationTokens = async ({ mfaAction, scope }, client) => {
|
|
|
62
310
|
};
|
|
63
311
|
};
|
|
64
312
|
|
|
313
|
+
//#endregion
|
|
314
|
+
//#region src/modules/waas/transactionBroadcastErrorMapper/transactionBroadcastErrorMapper.ts
|
|
315
|
+
const TRANSACTION_BROADCAST_ERROR_CODES = {
|
|
316
|
+
broadcast_idempotency_conflict: "BROADCAST_IDEMPOTENCY_CONFLICT",
|
|
317
|
+
broadcast_outcome_unknown: "BROADCAST_OUTCOME_UNKNOWN",
|
|
318
|
+
broadcast_rate_limited: "BROADCAST_RATE_LIMITED",
|
|
319
|
+
broadcast_rejected: "BROADCAST_REJECTED",
|
|
320
|
+
broadcast_requires_resign: "BROADCAST_REQUIRES_RESIGN",
|
|
321
|
+
broadcast_wallet_ineligible: "BROADCAST_WALLET_INELIGIBLE",
|
|
322
|
+
invalid_signed_transaction: "INVALID_SIGNED_TRANSACTION",
|
|
323
|
+
network_not_enabled: "NETWORK_NOT_ENABLED",
|
|
324
|
+
signed_transaction_wallet_mismatch: "SIGNED_TRANSACTION_WALLET_MISMATCH",
|
|
325
|
+
unsupported_waas_chain: "UNSUPPORTED_WAAS_CHAIN"
|
|
326
|
+
};
|
|
327
|
+
const TRANSACTION_BROADCAST_SUBMISSION_STATES = new Set([
|
|
328
|
+
"not_submitted",
|
|
329
|
+
"requires_resign",
|
|
330
|
+
"unknown"
|
|
331
|
+
]);
|
|
332
|
+
/**
|
|
333
|
+
* Maps structured WaaS broadcast API failures to a public SDK error.
|
|
334
|
+
*
|
|
335
|
+
* @notInstrumented
|
|
336
|
+
*/
|
|
337
|
+
const transactionBroadcastErrorMapper = (error) => {
|
|
338
|
+
if (!(error instanceof APIError)) return null;
|
|
339
|
+
const code = TRANSACTION_BROADCAST_ERROR_CODES[error.code];
|
|
340
|
+
if (!code) return null;
|
|
341
|
+
const payload = error.payload;
|
|
342
|
+
if (!payload || typeof payload.attempts !== "number" || typeof payload.broadcastId !== "string" || typeof payload.retryable !== "boolean" || typeof payload.submissionState !== "string") return null;
|
|
343
|
+
const submissionState = payload.submissionState;
|
|
344
|
+
if (!TRANSACTION_BROADCAST_SUBMISSION_STATES.has(submissionState)) return null;
|
|
345
|
+
const transactionId = typeof payload.transactionId === "string" ? payload.transactionId : void 0;
|
|
346
|
+
return new TransactionBroadcastError({
|
|
347
|
+
attempts: payload.attempts,
|
|
348
|
+
broadcastId: payload.broadcastId,
|
|
349
|
+
cause: error,
|
|
350
|
+
code,
|
|
351
|
+
message: error.message,
|
|
352
|
+
retryable: payload.retryable,
|
|
353
|
+
submissionState,
|
|
354
|
+
transactionId
|
|
355
|
+
});
|
|
356
|
+
};
|
|
357
|
+
|
|
358
|
+
//#endregion
|
|
359
|
+
//#region src/modules/waas/broadcastWaasTransaction/broadcastWaasTransaction.ts
|
|
360
|
+
const IDEMPOTENCY_KEY_LENGTH = 50;
|
|
361
|
+
/**
|
|
362
|
+
* Broadcasts an already-signed v3 WaaS transaction through the Dynamic API.
|
|
363
|
+
*
|
|
364
|
+
* @notInstrumented
|
|
365
|
+
*/
|
|
366
|
+
const broadcastWaasTransaction = async ({ encoding, networkId, signedTransaction, skipPreflight, walletAccount }, client) => {
|
|
367
|
+
const apiClient = createApiClient({ errorMappers: [transactionBroadcastErrorMapper] }, client);
|
|
368
|
+
let apiEncoding = WaasTransactionEncoding.Hex;
|
|
369
|
+
if (encoding === "base64") apiEncoding = WaasTransactionEncoding.Base64;
|
|
370
|
+
const request = {
|
|
371
|
+
encoding: apiEncoding,
|
|
372
|
+
networkId,
|
|
373
|
+
signedTransaction
|
|
374
|
+
};
|
|
375
|
+
if (skipPreflight !== void 0) request.options = { skipPreflight };
|
|
376
|
+
const walletId = walletAccount.verifiedCredentialId;
|
|
377
|
+
assertDefined(walletId, "Wallet account verified credential id is required for broadcasting");
|
|
378
|
+
const response = await apiClient.broadcastWaasTransaction({
|
|
379
|
+
environmentId: getCore(client).environmentId,
|
|
380
|
+
waasTransactionBroadcastRequest: request,
|
|
381
|
+
walletId,
|
|
382
|
+
xIdempotencyKey: randomString({ length: IDEMPOTENCY_KEY_LENGTH })
|
|
383
|
+
});
|
|
384
|
+
let status = "submitted";
|
|
385
|
+
if (response.status === WaasTransactionBroadcastStatus.AlreadyKnown) status = "already_known";
|
|
386
|
+
return {
|
|
387
|
+
attempts: response.attempts,
|
|
388
|
+
broadcastId: response.broadcastId,
|
|
389
|
+
status,
|
|
390
|
+
transactionId: response.transactionId
|
|
391
|
+
};
|
|
392
|
+
};
|
|
393
|
+
|
|
394
|
+
//#endregion
|
|
395
|
+
//#region src/modules/waas/getWaasChainNameFromChain/getWaasChainNameFromChain.ts
|
|
396
|
+
/** @notInstrumented */
|
|
397
|
+
const getWaasChainNameFromChain = (chain) => {
|
|
398
|
+
return CHAINS_INFO_MAP[chain].waasChainNameOverride || chain;
|
|
399
|
+
};
|
|
400
|
+
|
|
65
401
|
//#endregion
|
|
66
402
|
//#region src/modules/waas/createWaasProvider/isWaasLoadExhaustionError.ts
|
|
67
403
|
/**
|
|
@@ -137,6 +473,7 @@ const createWaasProvider = ({ sdkClient, chain }) => {
|
|
|
137
473
|
waasClient
|
|
138
474
|
});
|
|
139
475
|
};
|
|
476
|
+
const broadcastTransaction = (args) => broadcastWaasTransaction(args, sdkClient);
|
|
140
477
|
const createWalletAccount = async (args = {}) => {
|
|
141
478
|
logger.debug("[createWaasProvider] createWalletAccount", {
|
|
142
479
|
bitcoinConfig: args.bitcoinConfig,
|
|
@@ -267,11 +604,16 @@ const createWaasProvider = ({ sdkClient, chain }) => {
|
|
|
267
604
|
const reshareToNewSignerShareSet = async ({ businessAccountId, password, signerType, targetSignerIdentity, walletAccount }) => {
|
|
268
605
|
const { signature: signedSessionId } = await getSignedSessionId(sdkClient);
|
|
269
606
|
const waasClient = await getWaasClient();
|
|
607
|
+
const { elevatedAccessToken } = await getActionAuthorizationTokens({
|
|
608
|
+
mfaAction: MFAAction.WalletWaasReshare,
|
|
609
|
+
scope: TokenScope.BusinessAccountsigneradd
|
|
610
|
+
}, sdkClient);
|
|
270
611
|
return discardClientOnLoadFailure({
|
|
271
612
|
operation: () => waasClient.reshareToNewSignerShareSet({
|
|
272
613
|
accountAddress: walletAccount.address,
|
|
273
614
|
authToken: sdkClient.token ?? void 0,
|
|
274
615
|
businessAccountId,
|
|
616
|
+
elevatedAccessToken,
|
|
275
617
|
password,
|
|
276
618
|
signedSessionId,
|
|
277
619
|
signerType,
|
|
@@ -417,6 +759,7 @@ const createWaasProvider = ({ sdkClient, chain }) => {
|
|
|
417
759
|
});
|
|
418
760
|
return {
|
|
419
761
|
backupKeySharesToGoogleDrive: translateLoadFailure(backupKeySharesToGoogleDrive),
|
|
762
|
+
broadcastTransaction,
|
|
420
763
|
createWalletAccount: translateLoadFailure(createWalletAccount),
|
|
421
764
|
delegateKeyShares: translateLoadFailure(delegateKeyShares),
|
|
422
765
|
destroy: translateLoadFailure(destroy),
|