@dynamic-labs-sdk/client 0.14.0 → 0.15.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/{InvalidParamError-DQn49mNB.esm.js → InvalidParamError-Dyk0GfyN.esm.js} +257 -6
- package/dist/InvalidParamError-Dyk0GfyN.esm.js.map +1 -0
- package/dist/{InvalidParamError-DVzrk97b.cjs.js → InvalidParamError-DzSZbHE5.cjs.js} +343 -5
- package/dist/InvalidParamError-DzSZbHE5.cjs.js.map +1 -0
- package/dist/{NotWaasWalletAccountError-IxbdRVGy.cjs.js → NotWaasWalletAccountError-DFTloI8C.cjs.js} +3 -3
- package/dist/{NotWaasWalletAccountError-IxbdRVGy.cjs.js.map → NotWaasWalletAccountError-DFTloI8C.cjs.js.map} +1 -1
- package/dist/{NotWaasWalletAccountError-D0BXVuKy.esm.js → NotWaasWalletAccountError-kNpOqccC.esm.js} +3 -3
- package/dist/{NotWaasWalletAccountError-D0BXVuKy.esm.js.map → NotWaasWalletAccountError-kNpOqccC.esm.js.map} +1 -1
- package/dist/client/core/createCore/getInitialState.d.ts.map +1 -1
- package/dist/core.cjs.js +33 -65
- package/dist/core.cjs.js.map +1 -1
- package/dist/core.esm.js +24 -60
- package/dist/core.esm.js.map +1 -1
- package/dist/errors/DeeplinkConnectAndVerifyUnsupportedError.d.ts +9 -0
- package/dist/errors/DeeplinkConnectAndVerifyUnsupportedError.d.ts.map +1 -0
- package/dist/errors/UnauthorizedError.d.ts +5 -0
- package/dist/errors/UnauthorizedError.d.ts.map +1 -0
- package/dist/exports/core.d.ts +9 -1
- package/dist/exports/core.d.ts.map +1 -1
- package/dist/exports/index.d.ts +13 -2
- package/dist/exports/index.d.ts.map +1 -1
- package/dist/{getNetworkProviderFromNetworkId-z8WEapnj.cjs.js → getNetworkProviderFromNetworkId-BD1iGcEg.cjs.js} +66 -148
- package/dist/getNetworkProviderFromNetworkId-BD1iGcEg.cjs.js.map +1 -0
- package/dist/{getNetworkProviderFromNetworkId-DMMnYrfG.esm.js → getNetworkProviderFromNetworkId-ySZUpmOr.esm.js} +59 -96
- package/dist/getNetworkProviderFromNetworkId-ySZUpmOr.esm.js.map +1 -0
- package/dist/{getSignedSessionId-BKKO2mqj.esm.js → getSignedSessionId-BxhxGkA4.esm.js} +4 -17
- package/dist/getSignedSessionId-BxhxGkA4.esm.js.map +1 -0
- package/dist/{getSignedSessionId-BdGOv_TA.cjs.js → getSignedSessionId-s45HpP3W.cjs.js} +5 -24
- package/dist/getSignedSessionId-s45HpP3W.cjs.js.map +1 -0
- package/dist/{getVerifiedCredentialForWalletAccount-Ck7DNGPJ.cjs.js → getVerifiedCredentialForWalletAccount-BxrgouFz.cjs.js} +2 -3
- package/dist/{getVerifiedCredentialForWalletAccount-Ck7DNGPJ.cjs.js.map → getVerifiedCredentialForWalletAccount-BxrgouFz.cjs.js.map} +1 -1
- package/dist/{getVerifiedCredentialForWalletAccount-DQ7g6O7y.esm.js → getVerifiedCredentialForWalletAccount-Ch8h_J_W.esm.js} +2 -2
- package/dist/{getVerifiedCredentialForWalletAccount-DQ7g6O7y.esm.js.map → getVerifiedCredentialForWalletAccount-Ch8h_J_W.esm.js.map} +1 -1
- package/dist/index.cjs.js +291 -79
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +273 -70
- package/dist/index.esm.js.map +1 -1
- package/dist/{isMfaRequiredForAction-MvVGc7k3.esm.js → isMfaRequiredForAction-D1sFhYH1.esm.js} +3 -10
- package/dist/isMfaRequiredForAction-D1sFhYH1.esm.js.map +1 -0
- package/dist/{isMfaRequiredForAction-BINs954q.cjs.js → isMfaRequiredForAction-DaJSsq8Z.cjs.js} +2 -15
- package/dist/isMfaRequiredForAction-DaJSsq8Z.cjs.js.map +1 -0
- package/dist/modules/apiClient/createApiClient.d.ts.map +1 -1
- package/dist/modules/apiClient/utils/deviceSignatureHeadersMiddleware/createDeviceSignatureHeadersMiddleware.d.ts +4 -0
- package/dist/modules/apiClient/utils/deviceSignatureHeadersMiddleware/createDeviceSignatureHeadersMiddleware.d.ts.map +1 -0
- package/dist/modules/apiClient/utils/deviceSignatureHeadersMiddleware/index.d.ts +2 -0
- package/dist/modules/apiClient/utils/deviceSignatureHeadersMiddleware/index.d.ts.map +1 -0
- package/dist/modules/apiClient/utils/unauthorizedMiddleware/createUnauthorizedMiddleware.d.ts +3 -0
- package/dist/modules/apiClient/utils/unauthorizedMiddleware/createUnauthorizedMiddleware.d.ts.map +1 -0
- package/dist/modules/checkout/submitCheckoutTransaction/index.d.ts +3 -0
- package/dist/modules/checkout/submitCheckoutTransaction/index.d.ts.map +1 -0
- package/dist/modules/checkout/submitCheckoutTransaction/submitCheckoutTransaction.d.ts +22 -0
- package/dist/modules/checkout/submitCheckoutTransaction/submitCheckoutTransaction.d.ts.map +1 -0
- package/dist/modules/deviceRegistration/getDeviceSigner/getDeviceSigner.d.ts.map +1 -1
- package/dist/modules/deviceRegistration/getDeviceSigner/{getOrCreateUserDeviceSigningKeys/getOrCreateUserDeviceSigningKeys.d.ts → getOrCreateEnvironmentDeviceSigningKeys/getOrCreateEnvironmentDeviceSigningKeys.d.ts} +2 -2
- package/dist/modules/deviceRegistration/getDeviceSigner/getOrCreateEnvironmentDeviceSigningKeys/getOrCreateEnvironmentDeviceSigningKeys.d.ts.map +1 -0
- package/dist/modules/deviceRegistration/getDeviceSigner/getOrCreateEnvironmentDeviceSigningKeys/index.d.ts +2 -0
- package/dist/modules/deviceRegistration/getDeviceSigner/getOrCreateEnvironmentDeviceSigningKeys/index.d.ts.map +1 -0
- package/dist/modules/deviceRegistration/getHeadersForNonceSignedByDeviceSigners/getHeadersForNonceSignedByDeviceSigners.d.ts +3 -0
- package/dist/modules/deviceRegistration/getHeadersForNonceSignedByDeviceSigners/getHeadersForNonceSignedByDeviceSigners.d.ts.map +1 -0
- package/dist/modules/deviceRegistration/getHeadersForNonceSignedByDeviceSigners/index.d.ts +2 -0
- package/dist/modules/deviceRegistration/getHeadersForNonceSignedByDeviceSigners/index.d.ts.map +1 -0
- package/dist/modules/deviceRegistration/getRegisteredDevices/getRegisteredDevices.d.ts +3 -0
- package/dist/modules/deviceRegistration/getRegisteredDevices/getRegisteredDevices.d.ts.map +1 -0
- package/dist/modules/deviceRegistration/getRegisteredDevices/index.d.ts +2 -0
- package/dist/modules/deviceRegistration/getRegisteredDevices/index.d.ts.map +1 -0
- package/dist/modules/deviceRegistration/revokeAllRegisteredDevices/index.d.ts +2 -0
- package/dist/modules/deviceRegistration/revokeAllRegisteredDevices/index.d.ts.map +1 -0
- package/dist/modules/deviceRegistration/revokeAllRegisteredDevices/revokeAllRegisteredDevices.d.ts +2 -0
- package/dist/modules/deviceRegistration/revokeAllRegisteredDevices/revokeAllRegisteredDevices.d.ts.map +1 -0
- package/dist/modules/deviceRegistration/revokeRegisteredDevice/index.d.ts +2 -0
- package/dist/modules/deviceRegistration/revokeRegisteredDevice/index.d.ts.map +1 -0
- package/dist/modules/deviceRegistration/revokeRegisteredDevice/revokeRegisteredDevice.d.ts +6 -0
- package/dist/modules/deviceRegistration/revokeRegisteredDevice/revokeRegisteredDevice.d.ts.map +1 -0
- package/dist/modules/initializeClient/initializeClient.d.ts.map +1 -1
- package/dist/modules/wallets/connectAndVerifyWithWalletProvider/connectAndVerifyWithWalletProvider.d.ts +10 -0
- package/dist/modules/wallets/connectAndVerifyWithWalletProvider/connectAndVerifyWithWalletProvider.d.ts.map +1 -1
- package/dist/modules/wallets/transferAmount/index.d.ts +2 -0
- package/dist/modules/wallets/transferAmount/index.d.ts.map +1 -0
- package/dist/modules/wallets/transferAmount/transferAmount.d.ts +19 -0
- package/dist/modules/wallets/transferAmount/transferAmount.d.ts.map +1 -0
- package/dist/modules/wallets/walletProvider/index.d.ts +1 -1
- package/dist/modules/wallets/walletProvider/index.d.ts.map +1 -1
- package/dist/modules/wallets/walletProvider/isDeeplinkWalletProvider/index.d.ts +2 -0
- package/dist/modules/wallets/walletProvider/isDeeplinkWalletProvider/index.d.ts.map +1 -0
- package/dist/modules/wallets/walletProvider/isDeeplinkWalletProvider/isDeeplinkWalletProvider.d.ts +10 -0
- package/dist/modules/wallets/walletProvider/isDeeplinkWalletProvider/isDeeplinkWalletProvider.d.ts.map +1 -0
- package/dist/modules/wallets/walletProvider/walletProvider.types.d.ts +17 -0
- package/dist/modules/wallets/walletProvider/walletProvider.types.d.ts.map +1 -1
- package/dist/services/openDeeplink/createWebDeeplinkOpener/createWebDeeplinkOpener.d.ts +11 -1
- package/dist/services/openDeeplink/createWebDeeplinkOpener/createWebDeeplinkOpener.d.ts.map +1 -1
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/utils/getDeviceNameFromUserAgent/getDeviceNameFromUserAgent.d.ts +6 -0
- package/dist/utils/getDeviceNameFromUserAgent/getDeviceNameFromUserAgent.d.ts.map +1 -0
- package/dist/utils/getDeviceNameFromUserAgent/index.d.ts +2 -0
- package/dist/utils/getDeviceNameFromUserAgent/index.d.ts.map +1 -0
- package/dist/utils/getNonce/constants.d.ts +2 -0
- package/dist/utils/getNonce/constants.d.ts.map +1 -0
- package/dist/utils/getNonce/fetchAndStoreNonces/fetchAndStoreNonces.d.ts +13 -0
- package/dist/utils/getNonce/fetchAndStoreNonces/fetchAndStoreNonces.d.ts.map +1 -0
- package/dist/utils/getNonce/fetchAndStoreNonces/index.d.ts +2 -0
- package/dist/utils/getNonce/fetchAndStoreNonces/index.d.ts.map +1 -0
- package/dist/utils/getNonce/getNonce.d.ts +7 -0
- package/dist/utils/getNonce/getNonce.d.ts.map +1 -1
- package/dist/utils/getNonce/state.d.ts +11 -0
- package/dist/utils/getNonce/state.d.ts.map +1 -0
- package/dist/utils/parseAmountToSmallestUnit/index.d.ts +2 -0
- package/dist/utils/parseAmountToSmallestUnit/index.d.ts.map +1 -0
- package/dist/utils/parseAmountToSmallestUnit/parseAmountToSmallestUnit.d.ts +22 -0
- package/dist/utils/parseAmountToSmallestUnit/parseAmountToSmallestUnit.d.ts.map +1 -0
- package/dist/waas.cjs.js +3 -4
- package/dist/waas.cjs.js.map +1 -1
- package/dist/waas.esm.js +3 -3
- package/dist/waasCore.cjs.js +3 -4
- package/dist/waasCore.cjs.js.map +1 -1
- package/dist/waasCore.esm.js +3 -3
- package/package.json +3 -3
- package/dist/InvalidParamError-DQn49mNB.esm.js.map +0 -1
- package/dist/InvalidParamError-DVzrk97b.cjs.js.map +0 -1
- package/dist/getNetworkProviderFromNetworkId-DMMnYrfG.esm.js.map +0 -1
- package/dist/getNetworkProviderFromNetworkId-z8WEapnj.cjs.js.map +0 -1
- package/dist/getSignedSessionId-BKKO2mqj.esm.js.map +0 -1
- package/dist/getSignedSessionId-BdGOv_TA.cjs.js.map +0 -1
- package/dist/isMfaRequiredForAction-BINs954q.cjs.js.map +0 -1
- package/dist/isMfaRequiredForAction-MvVGc7k3.esm.js.map +0 -1
- package/dist/modules/deviceRegistration/getDeviceSigner/getOrCreateUserDeviceSigningKeys/getOrCreateUserDeviceSigningKeys.d.ts.map +0 -1
package/dist/index.cjs.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
3
|
-
const require_getVerifiedCredentialForWalletAccount = require('./getVerifiedCredentialForWalletAccount-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
1
|
+
const require_InvalidParamError = require('./InvalidParamError-DzSZbHE5.cjs.js');
|
|
2
|
+
const require_getNetworkProviderFromNetworkId = require('./getNetworkProviderFromNetworkId-BD1iGcEg.cjs.js');
|
|
3
|
+
const require_getVerifiedCredentialForWalletAccount = require('./getVerifiedCredentialForWalletAccount-BxrgouFz.cjs.js');
|
|
4
|
+
const require_NotWaasWalletAccountError = require('./NotWaasWalletAccountError-DFTloI8C.cjs.js');
|
|
5
|
+
const require_isMfaRequiredForAction = require('./isMfaRequiredForAction-DaJSsq8Z.cjs.js');
|
|
6
6
|
let _dynamic_labs_sdk_assert_package_version = require("@dynamic-labs-sdk/assert-package-version");
|
|
7
7
|
let _dynamic_labs_sdk_api_core = require("@dynamic-labs/sdk-api-core");
|
|
8
8
|
let zod_mini = require("zod/mini");
|
|
9
|
-
zod_mini =
|
|
9
|
+
zod_mini = require_InvalidParamError.__toESM(zod_mini);
|
|
10
10
|
let eventemitter3 = require("eventemitter3");
|
|
11
|
-
eventemitter3 =
|
|
11
|
+
eventemitter3 = require_InvalidParamError.__toESM(eventemitter3);
|
|
12
12
|
let _simplewebauthn_browser = require("@simplewebauthn/browser");
|
|
13
13
|
|
|
14
14
|
//#region src/modules/state/raiseStateEvents/events.ts
|
|
@@ -79,7 +79,7 @@ const isSignedIn = (client = require_InvalidParamError.getDefaultClient()) => Bo
|
|
|
79
79
|
/**
|
|
80
80
|
* The schema to track the expiration time of the project settings.
|
|
81
81
|
*/
|
|
82
|
-
const projectSettingsExpirationStorageKeySchema =
|
|
82
|
+
const projectSettingsExpirationStorageKeySchema = require_InvalidParamError.createStorageKeySchema({
|
|
83
83
|
key: "projectSettingsExpiration",
|
|
84
84
|
schema: zod_mini.number()
|
|
85
85
|
});
|
|
@@ -119,26 +119,6 @@ const fetchProjectSettings = async (client = require_InvalidParamError.getDefaul
|
|
|
119
119
|
return projectSettings;
|
|
120
120
|
};
|
|
121
121
|
|
|
122
|
-
//#endregion
|
|
123
|
-
//#region src/modules/sessionKeys/generateSessionKeys/generateSessionKeys.ts
|
|
124
|
-
const generateSessionKeys = async (client) => {
|
|
125
|
-
const { private: privateKey, public: publicKey, privateJwk: privateKeyJwk } = await require_getNetworkProviderFromNetworkId.p256Keygen();
|
|
126
|
-
const core = require_InvalidParamError.getCore(client);
|
|
127
|
-
const stringifiedSessionKeys = JSON.stringify({
|
|
128
|
-
privateKey,
|
|
129
|
-
privateKeyJwk,
|
|
130
|
-
publicKey,
|
|
131
|
-
registered: false
|
|
132
|
-
});
|
|
133
|
-
const encodedSessionKeys = require_InvalidParamError.getBuffer().from(stringifiedSessionKeys).toString("base64");
|
|
134
|
-
core.state.set({ sessionKeys: encodedSessionKeys });
|
|
135
|
-
return {
|
|
136
|
-
privateKey,
|
|
137
|
-
privateKeyJwk,
|
|
138
|
-
publicKey
|
|
139
|
-
};
|
|
140
|
-
};
|
|
141
|
-
|
|
142
122
|
//#endregion
|
|
143
123
|
//#region src/services/runtimeServices/createRuntimeServices/createRuntimeServices.ts
|
|
144
124
|
/**
|
|
@@ -231,7 +211,7 @@ const logout = async (client = require_InvalidParamError.getDefaultClient()) =>
|
|
|
231
211
|
});
|
|
232
212
|
require_getVerifiedCredentialForWalletAccount.emitEvent({ event: "logout" }, client);
|
|
233
213
|
fetchProjectSettings(client);
|
|
234
|
-
generateSessionKeys(client);
|
|
214
|
+
require_getNetworkProviderFromNetworkId.generateSessionKeys(client);
|
|
235
215
|
};
|
|
236
216
|
|
|
237
217
|
//#endregion
|
|
@@ -347,7 +327,7 @@ const walletProviderKeyMapSchema = zod_mini.record(zod_mini.string(), zod_mini.s
|
|
|
347
327
|
|
|
348
328
|
//#endregion
|
|
349
329
|
//#region src/modules/storageSync/schema.ts
|
|
350
|
-
const stateStorageKeySchema =
|
|
330
|
+
const stateStorageKeySchema = require_InvalidParamError.createStorageKeySchema({
|
|
351
331
|
key: "state",
|
|
352
332
|
schema: zod_mini.object({
|
|
353
333
|
apiVersion: zod_mini.string(),
|
|
@@ -357,7 +337,7 @@ const stateStorageKeySchema = require_getNetworkProviderFromNetworkId.createStor
|
|
|
357
337
|
walletProviderKeyMap: walletProviderKeyMapSchema
|
|
358
338
|
})
|
|
359
339
|
});
|
|
360
|
-
const sessionStorageKeySchema =
|
|
340
|
+
const sessionStorageKeySchema = require_InvalidParamError.createStorageKeySchema({
|
|
361
341
|
key: "session",
|
|
362
342
|
schema: zod_mini.object({
|
|
363
343
|
captchaToken: zod_mini.nullable(zod_mini.string()),
|
|
@@ -486,11 +466,14 @@ const initializeClient = async (client = require_InvalidParamError.getDefaultCli
|
|
|
486
466
|
const fetchProjectSettingsPromise = initializeStorageSyncPromise.then(async () => {
|
|
487
467
|
if (!core.state.get().projectSettings) await fetchProjectSettings(client);
|
|
488
468
|
});
|
|
469
|
+
fetchProjectSettingsPromise.then(() => require_InvalidParamError.fetchAndStoreNonces(client)).catch((error) => {
|
|
470
|
+
core.logger.error("Failed to prefetch nonces:", error);
|
|
471
|
+
});
|
|
489
472
|
/**
|
|
490
473
|
* Generate session keys if they don't exist
|
|
491
474
|
*/
|
|
492
475
|
const generateSessionKeysPromise = fetchProjectSettingsPromise.then(async () => {
|
|
493
|
-
if (!core.state.get().sessionKeys) await generateSessionKeys(client);
|
|
476
|
+
if (!core.state.get().sessionKeys) await require_getNetworkProviderFromNetworkId.generateSessionKeys(client);
|
|
494
477
|
});
|
|
495
478
|
/**
|
|
496
479
|
* Refresh user state on initialization when cookie is enabled.
|
|
@@ -644,12 +627,22 @@ const createNavigationHandler = () => {
|
|
|
644
627
|
//#endregion
|
|
645
628
|
//#region src/services/openDeeplink/createWebDeeplinkOpener/createWebDeeplinkOpener.ts
|
|
646
629
|
/**
|
|
647
|
-
* Creates a deeplink opener that
|
|
630
|
+
* Creates a deeplink opener that navigates the current tab to the deeplink URL.
|
|
631
|
+
*
|
|
632
|
+
* Uses `window.location.assign` instead of `window.open` deliberately.
|
|
633
|
+
* This matters for Phantom redirect specifically, which is the only deep link
|
|
634
|
+
* provider that redirects back to the app in a new tab. With `window.open`,
|
|
635
|
+
* the browser first opens an `about:blank` tab before the native wallet app
|
|
636
|
+
* handles the deep link. When Phantom redirects back, it opens yet another
|
|
637
|
+
* tab. The user ends up with three tabs (original, about:blank, redirect) and
|
|
638
|
+
* the browser focuses the lingering about:blank after the redirect tab closes.
|
|
639
|
+
* `window.location.assign` reuses the current tab, avoiding the extra tab
|
|
640
|
+
* entirely.
|
|
648
641
|
*/
|
|
649
642
|
const createWebDeeplinkOpener = () => {
|
|
650
643
|
if (require_getNetworkProviderFromNetworkId.isServerSideRendering()) return () => Promise.reject(new UnavailableInServerSideError("createWebDeeplinkOpener"));
|
|
651
644
|
return async (url) => {
|
|
652
|
-
window.
|
|
645
|
+
window.location.assign(url);
|
|
653
646
|
};
|
|
654
647
|
};
|
|
655
648
|
|
|
@@ -804,6 +797,7 @@ const getInitialState = () => ({
|
|
|
804
797
|
initStatus: "uninitialized",
|
|
805
798
|
legacyToken: null,
|
|
806
799
|
mfaToken: null,
|
|
800
|
+
prefetchedNonces: [],
|
|
807
801
|
projectSettings: null,
|
|
808
802
|
sessionExpiresAt: null,
|
|
809
803
|
sessionKeys: null,
|
|
@@ -925,6 +919,27 @@ var CheckoutSessionTokenMissingError = class extends require_InvalidParamError.B
|
|
|
925
919
|
}
|
|
926
920
|
};
|
|
927
921
|
|
|
922
|
+
//#endregion
|
|
923
|
+
//#region src/errors/DeeplinkConnectAndVerifyUnsupportedError.ts
|
|
924
|
+
var DeeplinkConnectAndVerifyUnsupportedError = class extends require_InvalidParamError.BaseError {
|
|
925
|
+
constructor({ walletProviderKey }) {
|
|
926
|
+
super({
|
|
927
|
+
cause: null,
|
|
928
|
+
code: "deeplink_connect_and_verify_unsupported",
|
|
929
|
+
docsUrl: null,
|
|
930
|
+
metaMessages: [
|
|
931
|
+
`Wallet provider key: ${walletProviderKey}`,
|
|
932
|
+
"On mobile, deep link wallet providers (e.g. Phantom redirect) cannot connect and verify in a single step.",
|
|
933
|
+
"iOS does not allow two sequential deep links — the second one is silently ignored because it is no longer tied to a user gesture.",
|
|
934
|
+
"Android may handle sequential deep links differently, but this guard applies to all mobile platforms to ensure a stable experience and prevent production-only errors.",
|
|
935
|
+
"Use connectWithWalletProvider() first, then call verifyWalletAccount() from a separate user action (e.g. a \"Verify Ownership\" button)."
|
|
936
|
+
],
|
|
937
|
+
name: "DeeplinkConnectAndVerifyUnsupportedError",
|
|
938
|
+
shortMessage: "connectAndVerifyWithWalletProvider is not supported for deep link wallet providers on mobile. Use connectWithWalletProvider and verifyWalletAccount separately."
|
|
939
|
+
});
|
|
940
|
+
}
|
|
941
|
+
};
|
|
942
|
+
|
|
928
943
|
//#endregion
|
|
929
944
|
//#region src/errors/FeeEstimationFailedError.ts
|
|
930
945
|
var FeeEstimationFailedError = class extends require_InvalidParamError.BaseError {
|
|
@@ -1460,7 +1475,7 @@ const removeDynamicOauthParamsFromUrl = (url) => {
|
|
|
1460
1475
|
//#endregion
|
|
1461
1476
|
//#region src/modules/auth/social/oauth/redirectStateStorageSchema/redirectStateStorageSchema.ts
|
|
1462
1477
|
/** The schema to track the state of the OAuth flow. */
|
|
1463
|
-
const redirectStateStorageKeySchema =
|
|
1478
|
+
const redirectStateStorageKeySchema = require_InvalidParamError.createStorageKeySchema({
|
|
1464
1479
|
key: "redirectState",
|
|
1465
1480
|
schema: zod_mini.object({
|
|
1466
1481
|
codeVerifier: zod_mini.optional(zod_mini.string()),
|
|
@@ -1740,7 +1755,7 @@ const getMultichainBalances = async ({ balanceRequest }, client = require_Invali
|
|
|
1740
1755
|
//#endregion
|
|
1741
1756
|
//#region src/modules/checkout/utils/createCheckoutSessionTokenStorageKey/createCheckoutSessionTokenStorageKey.ts
|
|
1742
1757
|
const createCheckoutSessionTokenStorageKey = (transactionId) => {
|
|
1743
|
-
return
|
|
1758
|
+
return require_InvalidParamError.createStorageKeySchema({
|
|
1744
1759
|
key: `checkoutSessionToken:${transactionId}`,
|
|
1745
1760
|
schema: zod_mini.string()
|
|
1746
1761
|
});
|
|
@@ -1907,6 +1922,67 @@ const prepareCheckoutTransaction = async ({ transactionId }, client = require_In
|
|
|
1907
1922
|
});
|
|
1908
1923
|
};
|
|
1909
1924
|
|
|
1925
|
+
//#endregion
|
|
1926
|
+
//#region src/modules/wallets/utils/assertWalletProviderMethodDefined/assertWalletProviderMethodDefined.ts
|
|
1927
|
+
/**
|
|
1928
|
+
* Asserts that a specific wallet provider method is defined, throwing an error if it's not.
|
|
1929
|
+
* This function acts as a type guard, narrowing the type to ensure the method exists.
|
|
1930
|
+
*
|
|
1931
|
+
* @template T - The specific wallet provider method key being checked
|
|
1932
|
+
* @param walletProvider - The wallet provider object to check
|
|
1933
|
+
* @param methodName - The name of the method to check for availability
|
|
1934
|
+
* @throws Throws WalletProviderMethodUnavailableError if the method is not defined
|
|
1935
|
+
* @example
|
|
1936
|
+
* ```typescript
|
|
1937
|
+
* const walletProvider: WalletProvider = getWalletProvider();
|
|
1938
|
+
* assertWalletProviderMethodDefined(walletProvider, 'connect');
|
|
1939
|
+
* // walletProvider.connect is now guaranteed to be defined
|
|
1940
|
+
* await walletProvider.connect();
|
|
1941
|
+
* ```
|
|
1942
|
+
*/
|
|
1943
|
+
function assertWalletProviderMethodDefined(walletProvider, methodName) {
|
|
1944
|
+
if (walletProvider[methodName] === void 0) throw new WalletProviderMethodUnavailableError({
|
|
1945
|
+
methodName,
|
|
1946
|
+
walletProviderKey: walletProvider.key
|
|
1947
|
+
});
|
|
1948
|
+
}
|
|
1949
|
+
|
|
1950
|
+
//#endregion
|
|
1951
|
+
//#region src/modules/checkout/submitCheckoutTransaction/submitCheckoutTransaction.ts
|
|
1952
|
+
/**
|
|
1953
|
+
* Prepares, signs, and broadcasts a checkout transaction in one call.
|
|
1954
|
+
*
|
|
1955
|
+
* Orchestrates the full submission flow:
|
|
1956
|
+
* 1. Calls prepareCheckoutTransaction to advance to signing state and lock the quote
|
|
1957
|
+
* 2. Ensures the wallet is on the correct network for the transaction
|
|
1958
|
+
* 3. Delegates on-chain signing to the wallet provider's executeCheckoutTransaction method
|
|
1959
|
+
* 4. Calls broadcastCheckoutTransaction with the resulting txHash
|
|
1960
|
+
*
|
|
1961
|
+
* @param params SubmitCheckoutTransactionParams - The transaction ID, wallet account, and optional step callback.
|
|
1962
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
1963
|
+
* @returns The broadcasted checkout transaction
|
|
1964
|
+
*/
|
|
1965
|
+
const submitCheckoutTransaction = async ({ onStepChange, transactionId, walletAccount }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
1966
|
+
const prepared = await prepareCheckoutTransaction({ transactionId }, client);
|
|
1967
|
+
require_InvalidParamError.assertDefined(prepared.signingPayload, "No signing payload returned from prepare — quote may be missing transaction data");
|
|
1968
|
+
const walletProvider = require_getVerifiedCredentialForWalletAccount.getWalletProviderFromWalletAccount({ walletAccount }, client);
|
|
1969
|
+
assertWalletProviderMethodDefined(walletProvider, "executeCheckoutTransaction");
|
|
1970
|
+
const requiredNetworkId = prepared.signingPayload.chainId;
|
|
1971
|
+
if (requiredNetworkId && walletProvider.switchActiveNetwork) {
|
|
1972
|
+
const { networkId: activeNetworkId } = await walletProvider.getActiveNetworkId();
|
|
1973
|
+
if (activeNetworkId !== requiredNetworkId) await walletProvider.switchActiveNetwork({ networkId: requiredNetworkId });
|
|
1974
|
+
}
|
|
1975
|
+
const { transactionHash } = await walletProvider.executeCheckoutTransaction({
|
|
1976
|
+
onStepChange,
|
|
1977
|
+
signingPayload: prepared.signingPayload,
|
|
1978
|
+
walletAccount
|
|
1979
|
+
});
|
|
1980
|
+
return broadcastCheckoutTransaction({
|
|
1981
|
+
transactionId,
|
|
1982
|
+
txHash: transactionHash
|
|
1983
|
+
}, client);
|
|
1984
|
+
};
|
|
1985
|
+
|
|
1910
1986
|
//#endregion
|
|
1911
1987
|
//#region src/modules/deviceRegistration/completeDeviceRegistration/completeDeviceRegistration.ts
|
|
1912
1988
|
const DEVICE_REGISTRATION_TOKEN_HEADER = "x-dynamic-device-registration-token";
|
|
@@ -1961,6 +2037,23 @@ const detectDeviceRegistrationRedirect = ({ url }) => {
|
|
|
1961
2037
|
}
|
|
1962
2038
|
};
|
|
1963
2039
|
|
|
2040
|
+
//#endregion
|
|
2041
|
+
//#region src/modules/deviceRegistration/getRegisteredDevices/getRegisteredDevices.ts
|
|
2042
|
+
const getRegisteredDevices = async (client = require_InvalidParamError.getDefaultClient()) => {
|
|
2043
|
+
const core = require_InvalidParamError.getCore(client);
|
|
2044
|
+
const apiClient = require_InvalidParamError.createApiClient({}, client);
|
|
2045
|
+
try {
|
|
2046
|
+
return (await apiClient.listDeviceRegistrations({ environmentId: core.environmentId })).deviceRegistrations;
|
|
2047
|
+
} catch (error) {
|
|
2048
|
+
/**
|
|
2049
|
+
* The API will return 401 when no devices are registered when there are no
|
|
2050
|
+
* devices registered. We need to handle this case gracefully.
|
|
2051
|
+
*/
|
|
2052
|
+
if (error instanceof require_InvalidParamError.UnauthorizedError) return [];
|
|
2053
|
+
throw error;
|
|
2054
|
+
}
|
|
2055
|
+
};
|
|
2056
|
+
|
|
1964
2057
|
//#endregion
|
|
1965
2058
|
//#region src/modules/deviceRegistration/isDeviceRegistrationRequired/isDeviceRegistrationRequired.ts
|
|
1966
2059
|
/**
|
|
@@ -1977,6 +2070,26 @@ const isDeviceRegistrationRequired = (client = require_InvalidParamError.getDefa
|
|
|
1977
2070
|
return Boolean(user.scope?.includes("device:register"));
|
|
1978
2071
|
};
|
|
1979
2072
|
|
|
2073
|
+
//#endregion
|
|
2074
|
+
//#region src/modules/deviceRegistration/revokeAllRegisteredDevices/revokeAllRegisteredDevices.ts
|
|
2075
|
+
const revokeAllRegisteredDevices = async (client = require_InvalidParamError.getDefaultClient()) => {
|
|
2076
|
+
const core = require_InvalidParamError.getCore(client);
|
|
2077
|
+
await require_InvalidParamError.createApiClient({}, client).deleteAllDeviceRegistrations({ environmentId: core.environmentId });
|
|
2078
|
+
await require_NotWaasWalletAccountError.refreshAuth(client);
|
|
2079
|
+
};
|
|
2080
|
+
|
|
2081
|
+
//#endregion
|
|
2082
|
+
//#region src/modules/deviceRegistration/revokeRegisteredDevice/revokeRegisteredDevice.ts
|
|
2083
|
+
const revokeRegisteredDevice = async ({ deviceRegistrationId }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
2084
|
+
require_InvalidParamError.assertDefined(deviceRegistrationId, "deviceRegistrationId is required");
|
|
2085
|
+
const core = require_InvalidParamError.getCore(client);
|
|
2086
|
+
await require_InvalidParamError.createApiClient({}, client).deleteDeviceRegistration({
|
|
2087
|
+
deviceRegistrationId,
|
|
2088
|
+
environmentId: core.environmentId
|
|
2089
|
+
});
|
|
2090
|
+
await require_NotWaasWalletAccountError.refreshAuth(client);
|
|
2091
|
+
};
|
|
2092
|
+
|
|
1980
2093
|
//#endregion
|
|
1981
2094
|
//#region src/modules/funding/coinbase/addCoinbaseOnrampOrderEventListener/addCoinbaseOnrampOrderEventListener.ts
|
|
1982
2095
|
/**
|
|
@@ -2276,7 +2389,7 @@ const fetchWithTimeout = async (client) => {
|
|
|
2276
2389
|
/**
|
|
2277
2390
|
* The schema to store the cached wallet book data.
|
|
2278
2391
|
*/
|
|
2279
|
-
const walletBookCacheStorageKeySchema =
|
|
2392
|
+
const walletBookCacheStorageKeySchema = require_InvalidParamError.createStorageKeySchema({
|
|
2280
2393
|
key: "legacyWalletBookCache",
|
|
2281
2394
|
schema: zod_mini.object({
|
|
2282
2395
|
groups: zod_mini.record(zod_mini.string(), zod_mini.any()),
|
|
@@ -4127,29 +4240,27 @@ const assertWalletAccountSigningAvailability = async ({ walletAccount }, client
|
|
|
4127
4240
|
};
|
|
4128
4241
|
|
|
4129
4242
|
//#endregion
|
|
4130
|
-
//#region src/
|
|
4243
|
+
//#region src/utils/isMobile/isMobile.ts
|
|
4131
4244
|
/**
|
|
4132
|
-
*
|
|
4133
|
-
* This function acts as a type guard, narrowing the type to ensure the method exists.
|
|
4134
|
-
*
|
|
4135
|
-
* @template T - The specific wallet provider method key being checked
|
|
4136
|
-
* @param walletProvider - The wallet provider object to check
|
|
4137
|
-
* @param methodName - The name of the method to check for availability
|
|
4138
|
-
* @throws Throws WalletProviderMethodUnavailableError if the method is not defined
|
|
4139
|
-
* @example
|
|
4140
|
-
* ```typescript
|
|
4141
|
-
* const walletProvider: WalletProvider = getWalletProvider();
|
|
4142
|
-
* assertWalletProviderMethodDefined(walletProvider, 'connect');
|
|
4143
|
-
* // walletProvider.connect is now guaranteed to be defined
|
|
4144
|
-
* await walletProvider.connect();
|
|
4145
|
-
* ```
|
|
4245
|
+
* Sourced from http://detectmobilebrowsers.com/
|
|
4146
4246
|
*/
|
|
4147
|
-
|
|
4148
|
-
|
|
4149
|
-
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
}
|
|
4247
|
+
const userAgentRegex1 = /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ios|ipad|playbook|silk/i;
|
|
4248
|
+
const userAgentRegex2 = /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i;
|
|
4249
|
+
const isMobile = (maxTouchPointsOverride) => {
|
|
4250
|
+
if (typeof window === "undefined" || typeof navigator === "undefined") return false;
|
|
4251
|
+
return userAgentRegex1.test(navigator.userAgent) || userAgentRegex2.test(navigator.userAgent.substring(0, 4)) || isIPad(maxTouchPointsOverride) || isIPhone();
|
|
4252
|
+
};
|
|
4253
|
+
const isIPhone = () => typeof window === "undefined" || typeof navigator === "undefined" ? false : /iPhone|ios/.test(navigator.userAgent);
|
|
4254
|
+
/**
|
|
4255
|
+
* @param [optional] maxTouchPointsOverride - this is used for testing since
|
|
4256
|
+
* it seems that JSDOM doesn't support maxTouchPoints, so it was impossible
|
|
4257
|
+
* to mock it
|
|
4258
|
+
*/
|
|
4259
|
+
const isIPad = (maxTouchPointsOverride) => {
|
|
4260
|
+
if (typeof window === "undefined" || typeof navigator === "undefined") return false;
|
|
4261
|
+
const maxTouchPoints = maxTouchPointsOverride || navigator.maxTouchPoints;
|
|
4262
|
+
return /iPad/.test(navigator.userAgent) || /Mac/.test(navigator.userAgent) && maxTouchPoints === 5;
|
|
4263
|
+
};
|
|
4153
4264
|
|
|
4154
4265
|
//#endregion
|
|
4155
4266
|
//#region src/modules/wallets/utils/getAddressesWithTypesFromConnectionResult/getAddressesWithTypesFromConnectionResult.ts
|
|
@@ -4241,7 +4352,7 @@ const getSignInMessage = async ({ walletAccount }, client) => {
|
|
|
4241
4352
|
require_InvalidParamError.assertDefined(universalLink, "Universal link is not set");
|
|
4242
4353
|
const url = new URL(universalLink);
|
|
4243
4354
|
const domain = url.host;
|
|
4244
|
-
const nonce = await
|
|
4355
|
+
const nonce = await require_InvalidParamError.getNonce(client);
|
|
4245
4356
|
const walletProvider = require_getVerifiedCredentialForWalletAccount.getWalletProviderFromWalletAccount({ walletAccount }, client);
|
|
4246
4357
|
if (walletProvider.chain === "STARK")
|
|
4247
4358
|
/**
|
|
@@ -4359,6 +4470,13 @@ const verifyWalletAccount = async ({ walletAccount, requestedScopes }, client =
|
|
|
4359
4470
|
}, client);
|
|
4360
4471
|
};
|
|
4361
4472
|
|
|
4473
|
+
//#endregion
|
|
4474
|
+
//#region src/modules/wallets/walletProvider/isDeeplinkWalletProvider/isDeeplinkWalletProvider.ts
|
|
4475
|
+
/**
|
|
4476
|
+
* Returns true if the wallet provider uses the deep link protocol (e.g. Phantom redirect on mobile).
|
|
4477
|
+
*/
|
|
4478
|
+
const isDeeplinkWalletProvider = ({ walletProvider }) => walletProvider.walletProviderType === _dynamic_labs_sdk_api_core.WalletProviderEnum.DeepLink;
|
|
4479
|
+
|
|
4362
4480
|
//#endregion
|
|
4363
4481
|
//#region src/modules/wallets/connectAndVerifyWithWalletProvider/connectAndVerifyWithWalletProvider.ts
|
|
4364
4482
|
/**
|
|
@@ -4368,12 +4486,24 @@ const verifyWalletAccount = async ({ walletAccount, requestedScopes }, client =
|
|
|
4368
4486
|
* requiring the user to sign a message to prove wallet ownership before
|
|
4369
4487
|
* the wallet account is added to their profile.
|
|
4370
4488
|
*
|
|
4489
|
+
* @throws {DeeplinkConnectAndVerifyUnsupportedError} On mobile with deep link
|
|
4490
|
+
* wallet providers (e.g. Phantom redirect). This function triggers two sequential
|
|
4491
|
+
* deeplinks — one to connect and another to sign for verification. iOS will not
|
|
4492
|
+
* honor the second deeplink because it is no longer tied to a user gesture.
|
|
4493
|
+
* Android may handle sequential deeplinks differently, but this guard applies to
|
|
4494
|
+
* all mobile platforms to ensure a stable experience and prevent production-only
|
|
4495
|
+
* errors. Use `connectWithWalletProvider` first and then invoke
|
|
4496
|
+
* `verifyWalletAccount` separately from a new user gesture (e.g. a "Verify
|
|
4497
|
+
* Ownership" button).
|
|
4498
|
+
*
|
|
4371
4499
|
* @param params.walletProviderKey - The unique key identifying the wallet provider to connect to.
|
|
4372
4500
|
* @param [params.hardwareWalletVendor] - The hardware wallet vendor, if connecting via a hardware wallet (e.g. 'ledger').
|
|
4373
4501
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
4374
4502
|
* @returns A promise that resolves to the connected and verified wallet account.
|
|
4375
4503
|
*/
|
|
4376
4504
|
const connectAndVerifyWithWalletProvider = async ({ walletProviderKey, hardwareWalletVendor }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
4505
|
+
const walletProvider = require_getVerifiedCredentialForWalletAccount.getWalletProviderByKey({ walletProviderKey }, client);
|
|
4506
|
+
if (isMobile() && isDeeplinkWalletProvider({ walletProvider })) throw new DeeplinkConnectAndVerifyUnsupportedError({ walletProviderKey });
|
|
4377
4507
|
const walletAccount = await connectWithWalletProvider({
|
|
4378
4508
|
addToDynamicWalletAccounts: false,
|
|
4379
4509
|
hardwareWalletVendor,
|
|
@@ -4745,6 +4875,34 @@ const signMessage = async ({ walletAccount, message }, client = require_InvalidP
|
|
|
4745
4875
|
return { signature };
|
|
4746
4876
|
};
|
|
4747
4877
|
|
|
4878
|
+
//#endregion
|
|
4879
|
+
//#region src/modules/wallets/transferAmount/transferAmount.ts
|
|
4880
|
+
/**
|
|
4881
|
+
* Transfers an amount of currency from the wallet account to a recipient.
|
|
4882
|
+
*
|
|
4883
|
+
* Supports native token transfers and, where supported by the chain,
|
|
4884
|
+
* fungible/token transfers via the optional `token` parameter.
|
|
4885
|
+
*
|
|
4886
|
+
* @param params.walletAccount - The wallet account to transfer from.
|
|
4887
|
+
* @param params.amount - The amount to transfer as a decimal string (e.g. "1.5").
|
|
4888
|
+
* @param params.recipient - The recipient address.
|
|
4889
|
+
* @param params.token - Optional token info for non-native transfers.
|
|
4890
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
4891
|
+
* @returns A promise that resolves to an object containing the transaction hash.
|
|
4892
|
+
* @throws If the wallet provider does not support the transfer amount method.
|
|
4893
|
+
*/
|
|
4894
|
+
const transferAmount = async ({ walletAccount, amount, recipient, token }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
4895
|
+
const walletProvider = require_getVerifiedCredentialForWalletAccount.getWalletProviderFromWalletAccount({ walletAccount }, client);
|
|
4896
|
+
assertWalletProviderMethodDefined(walletProvider, "transferAmount");
|
|
4897
|
+
const { transactionHash } = await walletProvider.transferAmount({
|
|
4898
|
+
amount,
|
|
4899
|
+
recipient,
|
|
4900
|
+
token,
|
|
4901
|
+
walletAccount
|
|
4902
|
+
});
|
|
4903
|
+
return { transactionHash };
|
|
4904
|
+
};
|
|
4905
|
+
|
|
4748
4906
|
//#endregion
|
|
4749
4907
|
//#region src/modules/wallets/transferWalletAccount/transferWalletAccount.ts
|
|
4750
4908
|
/**
|
|
@@ -4823,26 +4981,71 @@ const onWalletProviderEvent = ({ callback, event, walletProviderKey }, client =
|
|
|
4823
4981
|
};
|
|
4824
4982
|
|
|
4825
4983
|
//#endregion
|
|
4826
|
-
//#region src/utils/
|
|
4827
|
-
|
|
4828
|
-
|
|
4829
|
-
|
|
4830
|
-
|
|
4831
|
-
|
|
4832
|
-
|
|
4833
|
-
|
|
4834
|
-
|
|
4835
|
-
}
|
|
4836
|
-
|
|
4837
|
-
|
|
4838
|
-
|
|
4839
|
-
|
|
4840
|
-
|
|
4841
|
-
|
|
4842
|
-
|
|
4843
|
-
|
|
4844
|
-
|
|
4845
|
-
|
|
4984
|
+
//#region src/utils/getDeviceNameFromUserAgent/getDeviceNameFromUserAgent.ts
|
|
4985
|
+
const browserMatchers = [
|
|
4986
|
+
{
|
|
4987
|
+
name: "Edge",
|
|
4988
|
+
pattern: /Edg(e|A|iOS)?\//
|
|
4989
|
+
},
|
|
4990
|
+
{
|
|
4991
|
+
name: "Opera",
|
|
4992
|
+
pattern: /OPR\/|Opera/
|
|
4993
|
+
},
|
|
4994
|
+
{
|
|
4995
|
+
name: "Samsung Browser",
|
|
4996
|
+
pattern: /SamsungBrowser/
|
|
4997
|
+
},
|
|
4998
|
+
{
|
|
4999
|
+
name: "Firefox",
|
|
5000
|
+
pattern: /Firefox/
|
|
5001
|
+
},
|
|
5002
|
+
{
|
|
5003
|
+
name: "Safari",
|
|
5004
|
+
pattern: /^(?!.*(?:Chrome|Chromium|CriOS)).*Safari/
|
|
5005
|
+
},
|
|
5006
|
+
{
|
|
5007
|
+
name: "Chrome",
|
|
5008
|
+
pattern: /Chrome|CriOS/
|
|
5009
|
+
}
|
|
5010
|
+
];
|
|
5011
|
+
const osMatchers = [
|
|
5012
|
+
{
|
|
5013
|
+
name: "iPhone",
|
|
5014
|
+
pattern: /iPhone/
|
|
5015
|
+
},
|
|
5016
|
+
{
|
|
5017
|
+
name: "iPad",
|
|
5018
|
+
pattern: /iPad/
|
|
5019
|
+
},
|
|
5020
|
+
{
|
|
5021
|
+
name: "Android",
|
|
5022
|
+
pattern: /Android/
|
|
5023
|
+
},
|
|
5024
|
+
{
|
|
5025
|
+
name: "Windows",
|
|
5026
|
+
pattern: /Windows/
|
|
5027
|
+
},
|
|
5028
|
+
{
|
|
5029
|
+
name: "macOS",
|
|
5030
|
+
pattern: /Macintosh|Mac OS X/
|
|
5031
|
+
},
|
|
5032
|
+
{
|
|
5033
|
+
name: "Linux",
|
|
5034
|
+
pattern: /Linux/
|
|
5035
|
+
},
|
|
5036
|
+
{
|
|
5037
|
+
name: "ChromeOS",
|
|
5038
|
+
pattern: /CrOS/
|
|
5039
|
+
}
|
|
5040
|
+
];
|
|
5041
|
+
const getDeviceNameFromUserAgent = ({ userAgent }) => {
|
|
5042
|
+
if (!userAgent) return null;
|
|
5043
|
+
const browser = browserMatchers.find(({ pattern }) => pattern.test(userAgent))?.name;
|
|
5044
|
+
const os = osMatchers.find(({ pattern }) => pattern.test(userAgent))?.name;
|
|
5045
|
+
if (browser && os) return `${browser} on ${os}`;
|
|
5046
|
+
if (browser) return browser;
|
|
5047
|
+
if (os) return os;
|
|
5048
|
+
return null;
|
|
4846
5049
|
};
|
|
4847
5050
|
|
|
4848
5051
|
//#endregion
|
|
@@ -4853,6 +5056,7 @@ const isIPad = (maxTouchPointsOverride) => {
|
|
|
4853
5056
|
exports.BaseError = require_InvalidParamError.BaseError;
|
|
4854
5057
|
exports.CheckoutSessionTokenMissingError = CheckoutSessionTokenMissingError;
|
|
4855
5058
|
exports.ClientAlreadyInitializedError = ClientAlreadyInitializedError;
|
|
5059
|
+
exports.DeeplinkConnectAndVerifyUnsupportedError = DeeplinkConnectAndVerifyUnsupportedError;
|
|
4856
5060
|
exports.FeeEstimationFailedError = FeeEstimationFailedError;
|
|
4857
5061
|
exports.InvalidDeviceRegistrationRedirectError = InvalidDeviceRegistrationRedirectError;
|
|
4858
5062
|
exports.InvalidExternalAuthError = require_InvalidParamError.InvalidExternalAuthError;
|
|
@@ -4881,6 +5085,7 @@ exports.NoWebAuthNSupportError = NoWebAuthNSupportError;
|
|
|
4881
5085
|
exports.NotWaasWalletAccountError = require_NotWaasWalletAccountError.NotWaasWalletAccountError;
|
|
4882
5086
|
exports.SandboxMaximumThresholdReachedError = require_InvalidParamError.SandboxMaximumThresholdReachedError;
|
|
4883
5087
|
exports.SimulationFailedError = SimulationFailedError;
|
|
5088
|
+
exports.UnauthorizedError = require_InvalidParamError.UnauthorizedError;
|
|
4884
5089
|
exports.UnavailableInServerSideError = UnavailableInServerSideError;
|
|
4885
5090
|
exports.UnrecognizedNetworkError = UnrecognizedNetworkError;
|
|
4886
5091
|
exports.UserNotAuthenticatedError = UserNotAuthenticatedError;
|
|
@@ -4929,6 +5134,7 @@ exports.getCheckoutTransactionQuote = getCheckoutTransactionQuote;
|
|
|
4929
5134
|
exports.getCoinbaseBuyUrl = getCoinbaseBuyUrl;
|
|
4930
5135
|
exports.getConnectedAddresses = getConnectedAddresses;
|
|
4931
5136
|
exports.getDefaultClient = require_InvalidParamError.getDefaultClient;
|
|
5137
|
+
exports.getDeviceNameFromUserAgent = getDeviceNameFromUserAgent;
|
|
4932
5138
|
exports.getDeviceRegistrationTokenFromUrl = getDeviceRegistrationTokenFromUrl;
|
|
4933
5139
|
exports.getElevatedAccessToken = getElevatedAccessToken;
|
|
4934
5140
|
exports.getKrakenAccounts = getKrakenAccounts;
|
|
@@ -4942,6 +5148,7 @@ exports.getNetworksData = require_getNetworkProviderFromNetworkId.getNetworksDat
|
|
|
4942
5148
|
exports.getOwnerWalletAccountForSmartWalletAccount = getOwnerWalletAccountForSmartWalletAccount;
|
|
4943
5149
|
exports.getPasskeys = getPasskeys;
|
|
4944
5150
|
exports.getPrimaryWalletAccount = getPrimaryWalletAccount;
|
|
5151
|
+
exports.getRegisteredDevices = getRegisteredDevices;
|
|
4945
5152
|
exports.getTransactionHistory = getTransactionHistory;
|
|
4946
5153
|
exports.getUserSocialAccounts = getUserSocialAccounts;
|
|
4947
5154
|
exports.getWalletAccountAddressByType = getWalletAccountAddressByType;
|
|
@@ -4953,6 +5160,7 @@ exports.getWalletProviderDataByKey = getWalletProviderDataByKey;
|
|
|
4953
5160
|
exports.hasExtension = require_getNetworkProviderFromNetworkId.hasExtension;
|
|
4954
5161
|
exports.initializeClient = initializeClient;
|
|
4955
5162
|
exports.isCaptchaRequired = require_getNetworkProviderFromNetworkId.isCaptchaRequired;
|
|
5163
|
+
exports.isDeeplinkWalletProvider = isDeeplinkWalletProvider;
|
|
4956
5164
|
exports.isDeviceRegistrationRequired = isDeviceRegistrationRequired;
|
|
4957
5165
|
exports.isHardwareWalletAccount = isHardwareWalletAccount;
|
|
4958
5166
|
exports.isMfaRequiredForAction = require_isMfaRequiredForAction.isMfaRequiredForAction;
|
|
@@ -4976,6 +5184,8 @@ exports.refreshUser = refreshUser;
|
|
|
4976
5184
|
exports.registerPasskey = registerPasskey;
|
|
4977
5185
|
exports.registerTotpMfaDevice = registerTotpMfaDevice;
|
|
4978
5186
|
exports.removeWalletAccount = removeWalletAccount;
|
|
5187
|
+
exports.revokeAllRegisteredDevices = revokeAllRegisteredDevices;
|
|
5188
|
+
exports.revokeRegisteredDevice = revokeRegisteredDevice;
|
|
4979
5189
|
exports.selectPrimaryWalletAccount = selectPrimaryWalletAccount;
|
|
4980
5190
|
exports.sendEmailOTP = sendEmailOTP;
|
|
4981
5191
|
exports.sendSmsOTP = sendSmsOTP;
|
|
@@ -4984,8 +5194,10 @@ exports.setDefaultMfaDevice = setDefaultMfaDevice;
|
|
|
4984
5194
|
exports.signInWithExternalJwt = signInWithExternalJwt;
|
|
4985
5195
|
exports.signInWithPasskey = signInWithPasskey;
|
|
4986
5196
|
exports.signMessage = signMessage;
|
|
5197
|
+
exports.submitCheckoutTransaction = submitCheckoutTransaction;
|
|
4987
5198
|
exports.supportedCountries = supportedCountries;
|
|
4988
5199
|
exports.switchActiveNetwork = switchActiveNetwork;
|
|
5200
|
+
exports.transferAmount = transferAmount;
|
|
4989
5201
|
exports.transferWalletAccount = transferWalletAccount;
|
|
4990
5202
|
exports.unlinkSocialAccount = unlinkSocialAccount;
|
|
4991
5203
|
exports.updateUser = updateUser;
|