@dynamic-labs-sdk/client 1.6.0 → 1.7.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-DyXEKMWn.cjs → InvalidParamError-CTssOe86.cjs} +105 -993
- package/dist/InvalidParamError-CTssOe86.cjs.map +1 -0
- package/dist/{InvalidParamError-BIptAjbC.native.esm.js → InvalidParamError-Crwntjl7.native.esm.js} +90 -828
- package/dist/InvalidParamError-Crwntjl7.native.esm.js.map +1 -0
- package/dist/{InvalidParamError-BZ0LHaml.esm.js → InvalidParamError-fQLJaGBW.esm.js} +90 -795
- package/dist/InvalidParamError-fQLJaGBW.esm.js.map +1 -0
- package/dist/{NotWaasWalletAccountError-CElqwdQO.cjs → NotWaasWalletAccountError-2RaDipZu.cjs} +4 -4
- package/dist/NotWaasWalletAccountError-2RaDipZu.cjs.map +1 -0
- package/dist/{NotWaasWalletAccountError-nT4jrLbp.esm.js → NotWaasWalletAccountError-BJLGGYmU.native.esm.js} +4 -4
- package/dist/NotWaasWalletAccountError-BJLGGYmU.native.esm.js.map +1 -0
- package/dist/{NotWaasWalletAccountError-BbOA5rPd.native.esm.js → NotWaasWalletAccountError-DF_S7gqo.esm.js} +4 -4
- package/dist/NotWaasWalletAccountError-DF_S7gqo.esm.js.map +1 -0
- package/dist/core.cjs +23 -23
- package/dist/core.cjs.map +1 -1
- package/dist/core.esm.js +5 -5
- package/dist/core.native.esm.js +5 -5
- package/dist/{getNetworkProviderFromNetworkId-B7DIqT2T.native.esm.js → getNetworkProviderFromNetworkId-BCSmILlH.native.esm.js} +310 -39
- package/dist/getNetworkProviderFromNetworkId-BCSmILlH.native.esm.js.map +1 -0
- package/dist/{getNetworkProviderFromNetworkId-BkAPIdRC.esm.js → getNetworkProviderFromNetworkId-BWhaD23J.esm.js} +276 -38
- package/dist/getNetworkProviderFromNetworkId-BWhaD23J.esm.js.map +1 -0
- package/dist/{getNetworkProviderFromNetworkId-DbI5MZhq.cjs → getNetworkProviderFromNetworkId-C1p9Rrg3.cjs} +351 -44
- package/dist/getNetworkProviderFromNetworkId-C1p9Rrg3.cjs.map +1 -0
- package/dist/{getSignedSessionId-BF6n8gve.cjs → getSignedSessionId-CxxYNC_8.cjs} +3 -3
- package/dist/{getSignedSessionId-BF6n8gve.cjs.map → getSignedSessionId-CxxYNC_8.cjs.map} +1 -1
- package/dist/{getSignedSessionId-1TV-x__C.native.esm.js → getSignedSessionId-DPOXdh6y.native.esm.js} +3 -3
- package/dist/{getSignedSessionId-1TV-x__C.native.esm.js.map → getSignedSessionId-DPOXdh6y.native.esm.js.map} +1 -1
- package/dist/{getSignedSessionId-y3YtxFHZ.esm.js → getSignedSessionId-c7dS4PQ9.esm.js} +3 -3
- package/dist/{getSignedSessionId-y3YtxFHZ.esm.js.map → getSignedSessionId-c7dS4PQ9.esm.js.map} +1 -1
- package/dist/getVerifiedCredentialForWalletAccount-Cahp763h.esm.js +701 -0
- package/dist/getVerifiedCredentialForWalletAccount-Cahp763h.esm.js.map +1 -0
- package/dist/getVerifiedCredentialForWalletAccount-Di8dM5Wx.cjs +887 -0
- package/dist/getVerifiedCredentialForWalletAccount-Di8dM5Wx.cjs.map +1 -0
- package/dist/getVerifiedCredentialForWalletAccount-DuNbORNW.native.esm.js +701 -0
- package/dist/getVerifiedCredentialForWalletAccount-DuNbORNW.native.esm.js.map +1 -0
- package/dist/index.cjs +76 -76
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +14 -14
- package/dist/index.esm.js.map +1 -1
- package/dist/index.native.esm.js +14 -14
- package/dist/index.native.esm.js.map +1 -1
- package/dist/{isMfaRequiredForAction-Dy4-S3mr.esm.js → isMfaRequiredForAction-BjRvPrU6.esm.js} +2 -2
- package/dist/{isMfaRequiredForAction-Dy4-S3mr.esm.js.map → isMfaRequiredForAction-BjRvPrU6.esm.js.map} +1 -1
- package/dist/{isMfaRequiredForAction-B2vKX31S.native.esm.js → isMfaRequiredForAction-D8G5PBAd.native.esm.js} +2 -2
- package/dist/{isMfaRequiredForAction-B2vKX31S.native.esm.js.map → isMfaRequiredForAction-D8G5PBAd.native.esm.js.map} +1 -1
- package/dist/{isMfaRequiredForAction-K2Jh-3-j.cjs → isMfaRequiredForAction-hlhj0qAC.cjs} +2 -2
- package/dist/{isMfaRequiredForAction-K2Jh-3-j.cjs.map → isMfaRequiredForAction-hlhj0qAC.cjs.map} +1 -1
- package/dist/modules/apiClient/apiClient.types.d.ts +0 -12
- package/dist/modules/apiClient/apiClient.types.d.ts.map +1 -1
- package/dist/modules/apiClient/createApiClient.d.ts.map +1 -1
- package/dist/modules/auth/logoutReason.d.ts +1 -1
- package/dist/modules/auth/logoutReason.d.ts.map +1 -1
- package/dist/modules/auth/logoutWithReason/logoutWithReason.d.ts.map +1 -1
- package/dist/modules/deviceRegistration/getRegisteredDevices/getRegisteredDevices.d.ts.map +1 -1
- package/dist/modules/user/refreshAuth/refreshAuth.d.ts.map +1 -1
- package/dist/modules/waas/backupWaasKeySharesToGoogleDrive/backupWaasKeySharesToGoogleDrive.d.ts +12 -1
- package/dist/modules/waas/backupWaasKeySharesToGoogleDrive/backupWaasKeySharesToGoogleDrive.d.ts.map +1 -1
- package/dist/modules/waas/createWaasProvider/createWaasProvider.d.ts.map +1 -1
- package/dist/modules/waas/waas.types.d.ts +1 -0
- package/dist/modules/waas/waas.types.d.ts.map +1 -1
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/waas.cjs +12 -9
- package/dist/waas.cjs.map +1 -1
- package/dist/waas.esm.js +6 -4
- package/dist/waas.esm.js.map +1 -1
- package/dist/waas.native.esm.js +6 -4
- package/dist/waas.native.esm.js.map +1 -1
- package/dist/waasCore.cjs +6 -4
- package/dist/waasCore.cjs.map +1 -1
- package/dist/waasCore.esm.js +5 -4
- package/dist/waasCore.esm.js.map +1 -1
- package/dist/waasCore.native.esm.js +5 -4
- package/dist/waasCore.native.esm.js.map +1 -1
- package/package.json +4 -2
- package/dist/InvalidParamError-BIptAjbC.native.esm.js.map +0 -1
- package/dist/InvalidParamError-BZ0LHaml.esm.js.map +0 -1
- package/dist/InvalidParamError-DyXEKMWn.cjs.map +0 -1
- package/dist/NotWaasWalletAccountError-BbOA5rPd.native.esm.js.map +0 -1
- package/dist/NotWaasWalletAccountError-CElqwdQO.cjs.map +0 -1
- package/dist/NotWaasWalletAccountError-nT4jrLbp.esm.js.map +0 -1
- package/dist/getNetworkProviderFromNetworkId-B7DIqT2T.native.esm.js.map +0 -1
- package/dist/getNetworkProviderFromNetworkId-BkAPIdRC.esm.js.map +0 -1
- package/dist/getNetworkProviderFromNetworkId-DbI5MZhq.cjs.map +0 -1
- package/dist/getVerifiedCredentialForWalletAccount-BfJ29erz.cjs +0 -346
- package/dist/getVerifiedCredentialForWalletAccount-BfJ29erz.cjs.map +0 -1
- package/dist/getVerifiedCredentialForWalletAccount-CLyC2nOl.native.esm.js +0 -269
- package/dist/getVerifiedCredentialForWalletAccount-CLyC2nOl.native.esm.js.map +0 -1
- package/dist/getVerifiedCredentialForWalletAccount-etV50QRH.esm.js +0 -269
- package/dist/getVerifiedCredentialForWalletAccount-etV50QRH.esm.js.map +0 -1
- package/dist/modules/apiClient/utils/sessionExpiryLogoutMiddleware/createSessionExpiryLogoutMiddleware.d.ts +0 -27
- package/dist/modules/apiClient/utils/sessionExpiryLogoutMiddleware/createSessionExpiryLogoutMiddleware.d.ts.map +0 -1
|
@@ -1,37 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
-
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
-
key = keys[i];
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
13
|
-
__defProp(to, key, {
|
|
14
|
-
get: ((k) => from[k]).bind(null, key),
|
|
15
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
return to;
|
|
21
|
-
};
|
|
22
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
23
|
-
value: mod,
|
|
24
|
-
enumerable: true
|
|
25
|
-
}) : target, mod));
|
|
26
|
-
|
|
27
|
-
//#endregion
|
|
1
|
+
const require_getNetworkProviderFromNetworkId = require('./getNetworkProviderFromNetworkId-C1p9Rrg3.cjs');
|
|
28
2
|
let _dynamic_labs_sdk_api_core = require("@dynamic-labs/sdk-api-core");
|
|
29
|
-
let zod_mini = require("zod/mini");
|
|
30
|
-
zod_mini = __toESM(zod_mini);
|
|
31
3
|
|
|
32
4
|
//#region package.json
|
|
33
5
|
var name = "@dynamic-labs-sdk/client";
|
|
34
|
-
var version = "1.
|
|
6
|
+
var version = "1.7.0";
|
|
35
7
|
var dependencies = {
|
|
36
8
|
"@dynamic-labs-sdk/assert-package-version": "workspace:*",
|
|
37
9
|
"@dynamic-labs-wallet/browser-wallet-client": "1.0.7",
|
|
@@ -942,186 +914,109 @@ const createDeviceSignatureHeadersMiddleware = (client) => {
|
|
|
942
914
|
};
|
|
943
915
|
|
|
944
916
|
//#endregion
|
|
945
|
-
//#region src/
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
* @not-instrumented
|
|
949
|
-
*/
|
|
950
|
-
const setCookie = (cookie) => {
|
|
951
|
-
document.cookie = cookie;
|
|
952
|
-
};
|
|
953
|
-
|
|
954
|
-
//#endregion
|
|
955
|
-
//#region src/modules/clientEvents/clientEvents.ts
|
|
956
|
-
/**
|
|
957
|
-
* Adds an event listener for Dynamic client events.
|
|
958
|
-
*
|
|
959
|
-
* This function allows you to listen for various events emitted by the Dynamic client,
|
|
960
|
-
* such as authentication state changes, wallet connections, and more.
|
|
961
|
-
*
|
|
962
|
-
* @param params.event - The event name to listen for.
|
|
963
|
-
* @param params.listener - The callback function to execute when the event is fired.
|
|
964
|
-
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
965
|
-
* @returns A function that can be called to remove the listener.
|
|
966
|
-
* @not-instrumented
|
|
967
|
-
*/
|
|
968
|
-
const onEvent = ({ event, listener }, client = getDefaultClient()) => {
|
|
969
|
-
const { eventEmitter } = getCore(client);
|
|
970
|
-
eventEmitter.on(event, listener);
|
|
971
|
-
return () => {
|
|
972
|
-
eventEmitter.off(event, listener);
|
|
973
|
-
};
|
|
974
|
-
};
|
|
975
|
-
/**
|
|
976
|
-
* Removes an event listener from Dynamic client events.
|
|
977
|
-
*
|
|
978
|
-
* This function unsubscribes a previously registered event listener
|
|
979
|
-
* from the specified Dynamic client event.
|
|
980
|
-
*
|
|
981
|
-
* @param params.event - The event name to remove the listener from.
|
|
982
|
-
* @param params.listener - The callback function to remove.
|
|
983
|
-
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
984
|
-
* @not-instrumented
|
|
985
|
-
*/
|
|
986
|
-
const offEvent = ({ event, listener }, client = getDefaultClient()) => {
|
|
987
|
-
const { eventEmitter } = getCore(client);
|
|
988
|
-
eventEmitter.off(event, listener);
|
|
989
|
-
};
|
|
990
|
-
/**
|
|
991
|
-
* Adds a one-time event listener for Dynamic client events.
|
|
992
|
-
*
|
|
993
|
-
* This function listens for an event that will automatically remove itself
|
|
994
|
-
* after being triggered once.
|
|
995
|
-
*
|
|
996
|
-
* @param params.event - The event name to listen for.
|
|
997
|
-
* @param params.listener - The callback function to execute when the event is fired.
|
|
998
|
-
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
999
|
-
* @returns A function that can be called to remove the listener before it fires.
|
|
1000
|
-
* @not-instrumented
|
|
1001
|
-
*/
|
|
1002
|
-
const onceEvent = ({ event, listener }, client = getDefaultClient()) => {
|
|
1003
|
-
const { eventEmitter } = getCore(client);
|
|
1004
|
-
eventEmitter.once(event, listener);
|
|
1005
|
-
return () => {
|
|
1006
|
-
eventEmitter.off(event, listener);
|
|
1007
|
-
};
|
|
1008
|
-
};
|
|
1009
|
-
/**
|
|
1010
|
-
* Emits a Dynamic client event.
|
|
1011
|
-
*
|
|
1012
|
-
* This function triggers an event that will be received by all registered
|
|
1013
|
-
* listeners for the specified event type.
|
|
1014
|
-
*
|
|
1015
|
-
* @param params.event - The event name to emit.
|
|
1016
|
-
* @param params.args - The arguments to pass to event listeners.
|
|
1017
|
-
* @param client - The Dynamic client instance.
|
|
1018
|
-
* @not-instrumented
|
|
1019
|
-
*/
|
|
1020
|
-
const emitEvent = ({ event, args }, client) => {
|
|
1021
|
-
const { eventEmitter } = getCore(client);
|
|
1022
|
-
eventEmitter.emit(event, args);
|
|
1023
|
-
};
|
|
1024
|
-
|
|
1025
|
-
//#endregion
|
|
1026
|
-
//#region src/utils/retryOnFail/InvalidRetryOnFailCallError.ts
|
|
1027
|
-
/**
|
|
1028
|
-
* This error is thrown when the `retryOnFail` function is called with an invalid
|
|
1029
|
-
* number of retries (i.e. less than 0).
|
|
1030
|
-
*/
|
|
1031
|
-
var InvalidRetryOnFailCallError = class extends BaseError {
|
|
1032
|
-
constructor(maxRetries) {
|
|
917
|
+
//#region src/errors/UnauthorizedError.ts
|
|
918
|
+
var UnauthorizedError = class extends BaseError {
|
|
919
|
+
constructor({ cause }) {
|
|
1033
920
|
super({
|
|
1034
|
-
cause
|
|
1035
|
-
code: "
|
|
921
|
+
cause,
|
|
922
|
+
code: "unauthorized_error",
|
|
1036
923
|
docsUrl: null,
|
|
1037
|
-
name: "
|
|
1038
|
-
shortMessage:
|
|
924
|
+
name: "UnauthorizedError",
|
|
925
|
+
shortMessage: "Unauthorized"
|
|
1039
926
|
});
|
|
1040
927
|
}
|
|
1041
928
|
};
|
|
1042
929
|
|
|
1043
930
|
//#endregion
|
|
1044
|
-
//#region src/utils/
|
|
931
|
+
//#region src/modules/apiClient/utils/unauthorizedMiddleware/createUnauthorizedMiddleware.ts
|
|
1045
932
|
/** @not-instrumented */
|
|
1046
|
-
const
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
* Reaching this point should never happen and this
|
|
1055
|
-
* error is thrown to help us debug the issue.
|
|
1056
|
-
*/
|
|
1057
|
-
throw new InvalidRetryOnFailCallError(maxRetries);
|
|
1058
|
-
};
|
|
1059
|
-
|
|
1060
|
-
//#endregion
|
|
1061
|
-
//#region src/errors/InvalidWalletProviderKeyError.ts
|
|
1062
|
-
var InvalidWalletProviderKeyError = class extends BaseError {
|
|
1063
|
-
constructor(value) {
|
|
1064
|
-
super({
|
|
1065
|
-
cause: null,
|
|
1066
|
-
code: "invalid_wallet_provider_key",
|
|
1067
|
-
docsUrl: null,
|
|
1068
|
-
name: "InvalidWalletProviderKeyError",
|
|
1069
|
-
shortMessage: `Invalid wallet provider key: ${value}. Key must be in the format of <normalizedWalletNameWithChain>:<walletProviderType>[:<suffix>]`
|
|
1070
|
-
});
|
|
933
|
+
const createUnauthorizedMiddleware = () => ({ post: async (context) => {
|
|
934
|
+
if (context.response.status === 401) {
|
|
935
|
+
let cause = null;
|
|
936
|
+
try {
|
|
937
|
+
const errorBody = await context.response.clone().json();
|
|
938
|
+
if (errorBody && "error" in errorBody && typeof errorBody.error === "string") cause = new Error(errorBody.error);
|
|
939
|
+
} catch {}
|
|
940
|
+
throw new UnauthorizedError({ cause });
|
|
1071
941
|
}
|
|
1072
|
-
|
|
942
|
+
return context.response;
|
|
943
|
+
} });
|
|
1073
944
|
|
|
1074
945
|
//#endregion
|
|
1075
|
-
//#region src/modules/
|
|
1076
|
-
/**
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
946
|
+
//#region src/modules/apiClient/createApiClient.ts
|
|
947
|
+
/**
|
|
948
|
+
* Returns a new instance of the SDK API client.
|
|
949
|
+
*
|
|
950
|
+
* This is not meant for storing, as it is very light we can create it whenever needed.
|
|
951
|
+
* @not-instrumented
|
|
952
|
+
*/
|
|
953
|
+
const createApiClient = (options = {}, client) => {
|
|
954
|
+
const core = getCore(client);
|
|
955
|
+
const coreState = core.state.get();
|
|
956
|
+
const settings = {
|
|
957
|
+
basePath: core.apiBaseUrl,
|
|
958
|
+
headers: {
|
|
959
|
+
"Content-Type": "application/json",
|
|
960
|
+
[DYNAMIC_API_VERSION_HEADER]: `API/${DYNAMIC_SDK_API_VERSION}`,
|
|
961
|
+
[DYNAMIC_REQUEST_ID_HEADER]: randomString({ length: 50 }),
|
|
962
|
+
[DYNAMIC_SDK_SESSION_ID_HEADER]: core.sdkSessionId,
|
|
963
|
+
[DYNAMIC_SDK_VERSION_HEADER]: `${CLIENT_SDK_NAME}/${version}`,
|
|
964
|
+
...core.getApiHeaders(),
|
|
965
|
+
...options.headers
|
|
966
|
+
}
|
|
1084
967
|
};
|
|
968
|
+
if (core.metadata?.universalLink) settings.headers["Origin"] = core.metadata.universalLink;
|
|
969
|
+
if (client.token) settings.headers.Authorization = `Bearer ${client.token}`;
|
|
970
|
+
if (client.projectSettings && isCookieEnabled(client)) settings.credentials = "include";
|
|
971
|
+
if (options.includeMfaToken && coreState.mfaToken) settings.headers[MFA_TOKEN_HEADER] = coreState.mfaToken;
|
|
972
|
+
if (options.elevatedAccessTokenScope) {
|
|
973
|
+
const elevatedToken = __getElevatedAccessToken_wrapped({ scope: options.elevatedAccessTokenScope }, client);
|
|
974
|
+
if (elevatedToken) settings.headers[ELEVATED_ACCESS_TOKEN_HEADER] = elevatedToken;
|
|
975
|
+
}
|
|
976
|
+
const sessionPublicKey = getSessionKeys(client)?.publicKey;
|
|
977
|
+
const isSessionPublicKeyHeaderPresent = settings.headers[SESSION_PUBLIC_KEY_HEADER] !== void 0;
|
|
978
|
+
if (sessionPublicKey && !isSessionPublicKeyHeaderPresent) settings.headers[SESSION_PUBLIC_KEY_HEADER] = sessionPublicKey;
|
|
979
|
+
return new _dynamic_labs_sdk_api_core.SDKApi(new _dynamic_labs_sdk_api_core.Configuration({
|
|
980
|
+
...settings,
|
|
981
|
+
fetchApi: core.fetch,
|
|
982
|
+
middleware: [
|
|
983
|
+
createDeviceSignatureHeadersMiddleware(client),
|
|
984
|
+
createConvertToApiErrorMiddleware({ errorMappers: [...options.errorMappers || [], clientErrorMapper] }),
|
|
985
|
+
createUnauthorizedMiddleware()
|
|
986
|
+
]
|
|
987
|
+
}));
|
|
1085
988
|
};
|
|
1086
989
|
|
|
1087
990
|
//#endregion
|
|
1088
|
-
//#region src/
|
|
1089
|
-
/**
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
}
|
|
991
|
+
//#region src/utils/getNonce/fetchAndStoreNonces/fetchAndStoreNonces.ts
|
|
992
|
+
/**
|
|
993
|
+
* Fetches a batch of nonces from the API.
|
|
994
|
+
*
|
|
995
|
+
* Prefetching is critical for iOS deep link wallet providers (e.g. Phantom
|
|
996
|
+
* redirect). On iOS, a network request (like fetching a nonce) between a user
|
|
997
|
+
* action and a deeplink call will break the gesture chain, causing iOS to
|
|
998
|
+
* silently ignore the deeplink. By prefetching nonces ahead of time,
|
|
999
|
+
* `getNonce` can return synchronously from cache and the deeplink fires
|
|
1000
|
+
* without an interrupting network round-trip.
|
|
1001
|
+
*
|
|
1002
|
+
* New nonces are **appended** to the existing pool so that unconsumed entries
|
|
1003
|
+
* are not discarded by a background refetch.
|
|
1004
|
+
* @not-instrumented
|
|
1005
|
+
*/
|
|
1006
|
+
const fetchAndStoreNonces = async (client) => {
|
|
1007
|
+
const core = getCore(client);
|
|
1008
|
+
const { environmentId } = core;
|
|
1009
|
+
const { nonces } = await createApiClient({}, client).getNonces({
|
|
1010
|
+
count: NONCE_POOL_SIZE,
|
|
1011
|
+
environmentId
|
|
1012
|
+
});
|
|
1013
|
+
const existing = core.state.get().prefetchedNonces;
|
|
1014
|
+
core.state.set({
|
|
1015
|
+
prefetchedNonces: [...existing, ...nonces],
|
|
1016
|
+
prefetchedNoncesExpiration: Date.now() + NONCE_POOL_EXPIRATION_TIME
|
|
1017
|
+
});
|
|
1106
1018
|
};
|
|
1107
1019
|
|
|
1108
|
-
//#endregion
|
|
1109
|
-
//#region src/modules/wallets/utils/convertUnverifiedWalletAccountToWalletAccount/convertUnverifiedWalletAccountToWalletAccount.ts
|
|
1110
|
-
/** @not-instrumented */
|
|
1111
|
-
const convertUnverifiedWalletAccountToWalletAccount = ({ unverifiedWalletAccount }) => ({
|
|
1112
|
-
address: unverifiedWalletAccount.address,
|
|
1113
|
-
addressesWithTypes: unverifiedWalletAccount.addressesWithTypes,
|
|
1114
|
-
chain: unverifiedWalletAccount.chain,
|
|
1115
|
-
id: formatWalletAccountId({
|
|
1116
|
-
address: unverifiedWalletAccount.address,
|
|
1117
|
-
chain: unverifiedWalletAccount.chain,
|
|
1118
|
-
walletProviderKey: unverifiedWalletAccount.walletProviderKey
|
|
1119
|
-
}),
|
|
1120
|
-
lastSelectedAt: unverifiedWalletAccount.lastSelectedAt,
|
|
1121
|
-
verifiedCredentialId: null,
|
|
1122
|
-
walletProviderKey: unverifiedWalletAccount.walletProviderKey
|
|
1123
|
-
});
|
|
1124
|
-
|
|
1125
1020
|
//#endregion
|
|
1126
1021
|
//#region src/modules/wallets/constants.ts
|
|
1127
1022
|
const CHAINS_INFO_MAP = {
|
|
@@ -1226,657 +1121,30 @@ const getChainFromVerifiedCredentialChain = (verifiedCredentialChain) => {
|
|
|
1226
1121
|
};
|
|
1227
1122
|
|
|
1228
1123
|
//#endregion
|
|
1229
|
-
//#region src/
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
* verified credentials' `walletName` field.
|
|
1233
|
-
* @not-instrumented
|
|
1234
|
-
*/
|
|
1235
|
-
const normalizeWalletNameWithChain = ({ displayName, chain }) => {
|
|
1236
|
-
const sanitizedWalletName = displayName.replace(/[^a-zA-Z0-9]/g, "").toLowerCase();
|
|
1237
|
-
const chainLowered = chain.toLocaleLowerCase();
|
|
1238
|
-
if (sanitizedWalletName.endsWith(chainLowered)) return sanitizedWalletName;
|
|
1239
|
-
return `${sanitizedWalletName}${chainLowered}`;
|
|
1240
|
-
};
|
|
1241
|
-
|
|
1242
|
-
//#endregion
|
|
1243
|
-
//#region src/modules/wallets/utils/formatWalletProviderKey/formatWalletProviderKey.ts
|
|
1244
|
-
/**
|
|
1245
|
-
* Assembles the wallet provider key from the wallet name, chain, and wallet provider type.
|
|
1246
|
-
*
|
|
1247
|
-
* The suffix is optional and can be used to add a uniquely identifying string to the key, which
|
|
1248
|
-
* might be necessary for some wallet providers (like Wallet Connect).
|
|
1249
|
-
*
|
|
1250
|
-
* IMPORTANT: Do NOT add a suffix unless absolutely necessary, as it will cause the wallet account
|
|
1251
|
-
* to not be able to find its wallet provider when connecting to a new device (it won't be possible
|
|
1252
|
-
* to determine the full key just from the Verified Credential data).
|
|
1253
|
-
* @not-instrumented
|
|
1254
|
-
*/
|
|
1255
|
-
const formatWalletProviderKey = ({ suffix, chain, displayName, walletProviderType }) => {
|
|
1256
|
-
return `${normalizeWalletNameWithChain({
|
|
1257
|
-
chain,
|
|
1258
|
-
displayName
|
|
1259
|
-
})}:${walletProviderType}${suffix ? `:${suffix}` : ""}`;
|
|
1260
|
-
};
|
|
1261
|
-
|
|
1262
|
-
//#endregion
|
|
1263
|
-
//#region src/modules/wallets/walletProvider/walletProviderKeyMap/getWalletProviderKeyFromVerifiedCredential/getWalletProviderKeyFromVerifiedCredential.ts
|
|
1264
|
-
/** @not-instrumented */
|
|
1265
|
-
const getWalletProviderKeyFromVerifiedCredential = ({ verifiedCredential }, client) => {
|
|
1266
|
-
const { walletProviderKeyMap } = getCore(client).state.get();
|
|
1267
|
-
const storedWalletProviderKey = walletProviderKeyMap[verifiedCredential.id];
|
|
1268
|
-
if (storedWalletProviderKey) return { walletProviderKey: storedWalletProviderKey };
|
|
1269
|
-
/**
|
|
1270
|
-
* We fallback to comprising the wallet provider key from walletName and walletProvider.
|
|
1271
|
-
*
|
|
1272
|
-
* Some wallet provider types (like Wallet Connect) also use a special suffix for their wallet provider
|
|
1273
|
-
* keys, so this won't be enough for them.
|
|
1274
|
-
* Therefore, for those specific wallet providers, the wallet account will remain without a wallet provider
|
|
1275
|
-
* and will require reconnection.
|
|
1276
|
-
* Read walletProvider.types.ts for more info.
|
|
1277
|
-
*/
|
|
1278
|
-
assertDefined(verifiedCredential.walletName, `Failed to get wallet provider for verified credential with ID ${verifiedCredential.id}: missing walletName`);
|
|
1279
|
-
assertDefined(verifiedCredential.walletProvider, `Failed to get wallet provider for verified credential with ID ${verifiedCredential.id}: missing walletProvider`);
|
|
1280
|
-
assertDefined(verifiedCredential.chain, `Failed to get wallet provider for verified credential with ID ${verifiedCredential.id}: missing chain`);
|
|
1281
|
-
return { walletProviderKey: formatWalletProviderKey({
|
|
1282
|
-
chain: getChainFromVerifiedCredentialChain(verifiedCredential.chain),
|
|
1283
|
-
displayName: verifiedCredential.walletName,
|
|
1284
|
-
walletProviderType: verifiedCredential.walletProvider
|
|
1285
|
-
}) };
|
|
1286
|
-
};
|
|
1287
|
-
|
|
1288
|
-
//#endregion
|
|
1289
|
-
//#region src/modules/wallets/utils/convertVerifiedCredentialToWalletAccount/convertVerifiedCredentialToWalletAccount.ts
|
|
1290
|
-
/** @not-instrumented */
|
|
1291
|
-
const convertVerifiedCredentialToWalletAccount = ({ verifiedCredential }, client) => {
|
|
1292
|
-
assertDefined(verifiedCredential.address, "Missing address in verified credential");
|
|
1293
|
-
assertDefined(verifiedCredential.chain, "Missing chain in verified credential");
|
|
1294
|
-
const chain = getChainFromVerifiedCredentialChain(verifiedCredential.chain);
|
|
1295
|
-
const { walletProviderKey } = getWalletProviderKeyFromVerifiedCredential({ verifiedCredential }, client);
|
|
1296
|
-
const walletAccountId = formatWalletAccountId({
|
|
1297
|
-
address: verifiedCredential.address,
|
|
1298
|
-
chain,
|
|
1299
|
-
walletProviderKey
|
|
1300
|
-
});
|
|
1301
|
-
return {
|
|
1302
|
-
address: verifiedCredential.address,
|
|
1303
|
-
addressesWithTypes: verifiedCredential.walletAdditionalAddresses,
|
|
1304
|
-
chain,
|
|
1305
|
-
hardwareWalletVendor: verifiedCredential.walletProperties?.hardwareWallet,
|
|
1306
|
-
id: walletAccountId,
|
|
1307
|
-
lastSelectedAt: verifiedCredential.lastSelectedAt ?? null,
|
|
1308
|
-
verifiedCredentialId: verifiedCredential.id,
|
|
1309
|
-
walletProviderKey
|
|
1310
|
-
};
|
|
1311
|
-
};
|
|
1312
|
-
|
|
1313
|
-
//#endregion
|
|
1314
|
-
//#region src/modules/wallets/getWalletAccounts/getWalletAccountsFromState/getWalletAccountsFromState.ts
|
|
1315
|
-
/** @not-instrumented */
|
|
1316
|
-
const getWalletAccountsFromState = ({ unverifiedWalletAccounts, user }, client) => {
|
|
1317
|
-
const walletAccountsMap = /* @__PURE__ */ new Map();
|
|
1318
|
-
/**
|
|
1319
|
-
* Handle the unverified wallet accounts before the user verified credentials
|
|
1320
|
-
* so the later verified wallet accounts can override the unverified wallet accounts
|
|
1321
|
-
*/
|
|
1322
|
-
unverifiedWalletAccounts.forEach((unverifiedWalletAccount) => {
|
|
1323
|
-
const walletAccount = convertUnverifiedWalletAccountToWalletAccount({ unverifiedWalletAccount });
|
|
1324
|
-
walletAccountsMap.set(walletAccount.id, walletAccount);
|
|
1325
|
-
});
|
|
1326
|
-
(user?.verifiedCredentials ?? []).filter((verified) => verified.format === _dynamic_labs_sdk_api_core.JwtVerifiedCredentialFormatEnum.Blockchain).forEach((verifiedWalletAccount) => {
|
|
1327
|
-
const walletAccount = convertVerifiedCredentialToWalletAccount({ verifiedCredential: verifiedWalletAccount }, client);
|
|
1328
|
-
walletAccountsMap.set(walletAccount.id, walletAccount);
|
|
1329
|
-
});
|
|
1330
|
-
return Array.from(walletAccountsMap.values());
|
|
1331
|
-
};
|
|
1332
|
-
|
|
1333
|
-
//#endregion
|
|
1334
|
-
//#region src/modules/wallets/getWalletAccounts/getWalletAccounts.ts
|
|
1335
|
-
/**
|
|
1336
|
-
* Retrieves all wallet accounts associated with the current session.
|
|
1337
|
-
*
|
|
1338
|
-
* This function returns both verified and unverified wallet accounts,
|
|
1339
|
-
* combining data from user credentials and local unverified accounts.
|
|
1340
|
-
* You can differentiate between verified and unverified wallet accounts by
|
|
1341
|
-
* checking the `verifiedCredentialId` property.
|
|
1342
|
-
*
|
|
1343
|
-
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
1344
|
-
* @returns An array of wallet accounts associated with the session.
|
|
1345
|
-
* @not-instrumented
|
|
1346
|
-
*/
|
|
1347
|
-
const getWalletAccounts = (client = getDefaultClient()) => {
|
|
1348
|
-
const { unverifiedWalletAccounts, user } = getCore(client).state.get();
|
|
1349
|
-
return getWalletAccountsFromState({
|
|
1350
|
-
unverifiedWalletAccounts,
|
|
1351
|
-
user
|
|
1352
|
-
}, client);
|
|
1353
|
-
};
|
|
1354
|
-
|
|
1355
|
-
//#endregion
|
|
1356
|
-
//#region src/modules/auth/isSignedIn/isSignedIn.ts
|
|
1357
|
-
/**
|
|
1358
|
-
* Checks if the user is currently signed in to the Dynamic client.
|
|
1359
|
-
*
|
|
1360
|
-
* The client is considered to be in a signed in state if a user has
|
|
1361
|
-
* authenticated or if the client has at least one wallet connected.
|
|
1362
|
-
*
|
|
1363
|
-
* @deprecated What counts as "signed in" is your app's business logic, not the
|
|
1364
|
-
* SDK's. This helper bakes in one opinion (a user OR any connected wallet),
|
|
1365
|
-
* which rarely matches every app and forces a dependency on us for every
|
|
1366
|
-
* variation. Compose your own check from the underlying primitives instead —
|
|
1367
|
-
* e.g. `Boolean(client.user) || isAnyWalletAccountConnected(client)` — and
|
|
1368
|
-
* layer in whatever your app requires (device registration, completed
|
|
1369
|
-
* onboarding, satisfied MFA, a required embedded wallet, …). See the
|
|
1370
|
-
* "Check if signed in" guide:
|
|
1371
|
-
* https://www.dynamic.xyz/docs/javascript/user-session-management
|
|
1372
|
-
*
|
|
1373
|
-
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
1374
|
-
* @returns True if the user is signed in, false otherwise.
|
|
1375
|
-
* @not-instrumented
|
|
1376
|
-
*/
|
|
1377
|
-
const isSignedIn = (client = getDefaultClient()) => Boolean(client.user || getWalletAccounts(client).length > 0);
|
|
1378
|
-
|
|
1379
|
-
//#endregion
|
|
1380
|
-
//#region src/services/storage/createStorageKeySchema/createStorageKeySchema.ts
|
|
1381
|
-
/** @not-instrumented */
|
|
1382
|
-
const createStorageKeySchema = (params) => {
|
|
1383
|
-
return params;
|
|
1384
|
-
};
|
|
1385
|
-
|
|
1386
|
-
//#endregion
|
|
1387
|
-
//#region src/modules/projectSettings/fetchProjectSettings/projectSettingsExpirationScheme.ts
|
|
1388
|
-
/**
|
|
1389
|
-
* The schema to track the expiration time of the project settings.
|
|
1390
|
-
*/
|
|
1391
|
-
const projectSettingsExpirationStorageKeySchema = createStorageKeySchema({
|
|
1392
|
-
key: "projectSettingsExpiration",
|
|
1393
|
-
schema: zod_mini.number()
|
|
1394
|
-
});
|
|
1395
|
-
|
|
1396
|
-
//#endregion
|
|
1397
|
-
//#region src/modules/projectSettings/fetchProjectSettings/fetchProjectSettings.ts
|
|
1398
|
-
/**
|
|
1399
|
-
* Expiration time of the project settings in milliseconds.
|
|
1400
|
-
*/
|
|
1401
|
-
const PROJECT_SETTINGS_EXPIRATION_TIME = 1e3 * 60 * 5;
|
|
1402
|
-
/**
|
|
1403
|
-
* Fetches and updates the project settings from the API.
|
|
1404
|
-
*
|
|
1405
|
-
* This function retrieves the latest project configuration settings
|
|
1406
|
-
* from Dynamic's servers, including authentication options, enabled chains,
|
|
1407
|
-
* and security configurations. The settings are cached for performance.
|
|
1408
|
-
*
|
|
1409
|
-
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
1410
|
-
* @returns A promise that resolves to the updated project settings.
|
|
1411
|
-
* @not-instrumented
|
|
1412
|
-
*/
|
|
1413
|
-
const fetchProjectSettings = async (client = getDefaultClient()) => {
|
|
1414
|
-
const core = getCore(client);
|
|
1415
|
-
const currentExpiration = await core.storage.getItem(projectSettingsExpirationStorageKeySchema);
|
|
1416
|
-
if (Boolean(client.projectSettings) && !(currentExpiration && currentExpiration < Date.now()) && isSignedIn(client)) return client.projectSettings;
|
|
1417
|
-
const apiClient = createApiClient({}, client);
|
|
1418
|
-
core.logger.debug("[fetchProjectSettings] Fetching project settings...");
|
|
1419
|
-
const doFetch = async () => apiClient.getEnvironmentSettings({
|
|
1420
|
-
environmentId: core.environmentId,
|
|
1421
|
-
sdkVersion: `${CLIENT_SDK_NAME}/${core.version}`
|
|
1422
|
-
}, { credentials: "omit" });
|
|
1423
|
-
const projectSettings = await retryOnFail({
|
|
1424
|
-
fn: doFetch,
|
|
1425
|
-
maxRetries: 2
|
|
1426
|
-
});
|
|
1427
|
-
core.state.set({ projectSettings: projectSettings ?? null });
|
|
1428
|
-
await core.storage.setItem(projectSettingsExpirationStorageKeySchema, Date.now() + PROJECT_SETTINGS_EXPIRATION_TIME);
|
|
1429
|
-
return projectSettings;
|
|
1430
|
-
};
|
|
1124
|
+
//#region src/constants.ts
|
|
1125
|
+
const SDK_API_CORE_VERSION = dependencies["@dynamic-labs/sdk-api-core"];
|
|
1126
|
+
const DYNAMIC_ICONIC_SPRITE_URL = "https://iconic.dynamic-static-assets.com/icons/sprite.svg";
|
|
1431
1127
|
|
|
1432
1128
|
//#endregion
|
|
1433
|
-
//#region src/modules/
|
|
1434
|
-
|
|
1435
|
-
const
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
core.state.set({ sessionKeys: publicKey });
|
|
1441
|
-
return { publicKey };
|
|
1129
|
+
//#region src/modules/waas/constants.ts
|
|
1130
|
+
const DEFAULT_WAAS_BASE_API_URL = "https://app.dynamicauth.com";
|
|
1131
|
+
const DEFAULT_WAAS_BASE_MPC_RELAY_API_URL = "https://relay.dynamicauth.com";
|
|
1132
|
+
const DYNAMIC_WAAS_METADATA = {
|
|
1133
|
+
displayName: "Dynamic WaaS",
|
|
1134
|
+
icon: `${DYNAMIC_ICONIC_SPRITE_URL}#dynamicwaas`,
|
|
1135
|
+
normalizedWalletName: "dynamicwaas"
|
|
1442
1136
|
};
|
|
1443
1137
|
|
|
1444
1138
|
//#endregion
|
|
1445
|
-
//#region src/errors/
|
|
1446
|
-
var
|
|
1447
|
-
constructor(
|
|
1139
|
+
//#region src/errors/InvalidParamError.ts
|
|
1140
|
+
var InvalidParamError = class extends BaseError {
|
|
1141
|
+
constructor(message) {
|
|
1448
1142
|
super({
|
|
1449
1143
|
cause: null,
|
|
1450
|
-
code: "
|
|
1144
|
+
code: "invalid_param_error",
|
|
1451
1145
|
docsUrl: null,
|
|
1452
|
-
name: "
|
|
1453
|
-
shortMessage:
|
|
1454
|
-
});
|
|
1455
|
-
}
|
|
1456
|
-
};
|
|
1457
|
-
|
|
1458
|
-
//#endregion
|
|
1459
|
-
//#region src/services/runtimeServices/createRuntimeServiceAccessKey/createRuntimeServiceAccessKey.ts
|
|
1460
|
-
/**
|
|
1461
|
-
* Creates a service accessor function that manages service instantiation and caching.
|
|
1462
|
-
* The returned function will either retrieve an existing service from the registry or
|
|
1463
|
-
* create a new one using the provided builder function.
|
|
1464
|
-
*
|
|
1465
|
-
* @template - The type of service to be created/accessed
|
|
1466
|
-
* @param key - Unique identifier for the service in the registry
|
|
1467
|
-
* @param builder - Function that creates the service instance when called with a DynamicClient
|
|
1468
|
-
* @not-instrumented
|
|
1469
|
-
*/
|
|
1470
|
-
const createRuntimeServiceAccessKey = (key, builder) => (client) => {
|
|
1471
|
-
const { runtimeServices } = getCore(client);
|
|
1472
|
-
const currentService = runtimeServices.getByKey(key);
|
|
1473
|
-
if (currentService) return currentService;
|
|
1474
|
-
const service = builder(client);
|
|
1475
|
-
runtimeServices.register(key, service);
|
|
1476
|
-
return service;
|
|
1477
|
-
};
|
|
1478
|
-
|
|
1479
|
-
//#endregion
|
|
1480
|
-
//#region src/modules/wallets/walletProviderRegistry/createWalletProviderRegistry/createWalletProviderRegistry.ts
|
|
1481
|
-
/**
|
|
1482
|
-
* Creates a new wallet provider registry that manages wallet providers with priority-based registration.
|
|
1483
|
-
*
|
|
1484
|
-
* @returns The wallet provider registry instance
|
|
1485
|
-
*
|
|
1486
|
-
* @example
|
|
1487
|
-
* ```typescript
|
|
1488
|
-
* const registry = createWalletProviderRegistry();
|
|
1489
|
-
*
|
|
1490
|
-
* registry.register({
|
|
1491
|
-
* priority: WalletProviderPriority.WALLET_SDK,
|
|
1492
|
-
* walletProvider: myWalletProvider
|
|
1493
|
-
* });
|
|
1494
|
-
*
|
|
1495
|
-
* const provider = registry.getByKey('my-wallet-key');
|
|
1496
|
-
* const providers = registry.listProviders();
|
|
1497
|
-
* ```
|
|
1498
|
-
* @not-instrumented
|
|
1499
|
-
*/
|
|
1500
|
-
const createWalletProviderRegistry = (client) => {
|
|
1501
|
-
const registry = /* @__PURE__ */ new Map();
|
|
1502
|
-
return {
|
|
1503
|
-
getByKey: (key) => registry.get(key)?.walletProvider,
|
|
1504
|
-
listProviderEntries: () => Array.from(registry.values()),
|
|
1505
|
-
listProviders: () => Array.from(registry.values()).map((v) => v.walletProvider),
|
|
1506
|
-
register: (args) => {
|
|
1507
|
-
const existingEntry = registry.get(args.walletProvider.key);
|
|
1508
|
-
if (existingEntry) {
|
|
1509
|
-
if (existingEntry.priority < args.priority) {
|
|
1510
|
-
registry.set(args.walletProvider.key, args);
|
|
1511
|
-
emitEvent({
|
|
1512
|
-
args: { walletProviderKey: args.walletProvider.key },
|
|
1513
|
-
event: "walletProviderChanged"
|
|
1514
|
-
}, client);
|
|
1515
|
-
}
|
|
1516
|
-
} else {
|
|
1517
|
-
registry.set(args.walletProvider.key, args);
|
|
1518
|
-
emitEvent({
|
|
1519
|
-
args: { walletProvider: args.walletProvider },
|
|
1520
|
-
event: "walletProviderRegistered"
|
|
1521
|
-
}, client);
|
|
1522
|
-
emitEvent({
|
|
1523
|
-
args: { walletProviderKey: args.walletProvider.key },
|
|
1524
|
-
event: "walletProviderChanged"
|
|
1525
|
-
}, client);
|
|
1526
|
-
}
|
|
1527
|
-
},
|
|
1528
|
-
unregister: (key) => {
|
|
1529
|
-
registry.delete(key);
|
|
1530
|
-
emitEvent({
|
|
1531
|
-
args: { walletProviderKey: key },
|
|
1532
|
-
event: "walletProviderUnregistered"
|
|
1533
|
-
}, client);
|
|
1534
|
-
}
|
|
1535
|
-
};
|
|
1536
|
-
};
|
|
1537
|
-
|
|
1538
|
-
//#endregion
|
|
1539
|
-
//#region src/modules/wallets/walletProviderRegistry/getWalletProviderRegistry/getWalletProviderRegistry.ts
|
|
1540
|
-
/**
|
|
1541
|
-
* This function provides access to a shared instance of the wallet provider registry.
|
|
1542
|
-
*
|
|
1543
|
-
* It ensures that the same registry instance is used throughout the client to maintaining
|
|
1544
|
-
* consistency of registered wallet providers across different parts of the codebase.
|
|
1545
|
-
*
|
|
1546
|
-
* @returns The wallet provider registry instance
|
|
1547
|
-
*
|
|
1548
|
-
* @example
|
|
1549
|
-
* ```typescript
|
|
1550
|
-
* // Get the registry instance
|
|
1551
|
-
* const registry = getWalletProviderRegistry();
|
|
1552
|
-
*
|
|
1553
|
-
* // Register a wallet provider
|
|
1554
|
-
* registry.register({
|
|
1555
|
-
* priority: WalletProviderPriority.WALLET_SDK,
|
|
1556
|
-
* walletProvider: myWalletProvider
|
|
1557
|
-
* });
|
|
1558
|
-
*
|
|
1559
|
-
* // Retrieve a specific provider
|
|
1560
|
-
* const provider = registry.getByKey('metamaskevm');
|
|
1561
|
-
* ```
|
|
1562
|
-
*/
|
|
1563
|
-
const getWalletProviderRegistry = createRuntimeServiceAccessKey("walletProviderRegistry", (client) => createWalletProviderRegistry(client));
|
|
1564
|
-
|
|
1565
|
-
//#endregion
|
|
1566
|
-
//#region src/modules/wallets/walletProviderRegistry/walletProviderRegistry.types.ts
|
|
1567
|
-
let WalletProviderPriority = /* @__PURE__ */ function(WalletProviderPriority$1) {
|
|
1568
|
-
/**
|
|
1569
|
-
* Highest priority should be used by wallet providers that implement
|
|
1570
|
-
* the most reliable wallet integration.
|
|
1571
|
-
* example: The SDK provided by the wallet provider.
|
|
1572
|
-
*/
|
|
1573
|
-
WalletProviderPriority$1[WalletProviderPriority$1["WALLET_SDK"] = 100] = "WALLET_SDK";
|
|
1574
|
-
/**
|
|
1575
|
-
* Medium priority should be used by wallet providers that implement
|
|
1576
|
-
* a wallet integration via some reliable standard.
|
|
1577
|
-
* example: A wallet provider that uses EIP6963 announcement.
|
|
1578
|
-
*/
|
|
1579
|
-
WalletProviderPriority$1[WalletProviderPriority$1["WALLET_SELF_ANNOUNCEMENT_STANDARD"] = 50] = "WALLET_SELF_ANNOUNCEMENT_STANDARD";
|
|
1580
|
-
/**
|
|
1581
|
-
* Low priority should be used by wallet providers that implement
|
|
1582
|
-
* a wallet integration on a less reliable standard.
|
|
1583
|
-
* example: A wallet provider that uses window.ethereum, where the
|
|
1584
|
-
* window key can be overridden by other extensions.
|
|
1585
|
-
*/
|
|
1586
|
-
WalletProviderPriority$1[WalletProviderPriority$1["WINDOW_INJECT"] = 20] = "WINDOW_INJECT";
|
|
1587
|
-
return WalletProviderPriority$1;
|
|
1588
|
-
}({});
|
|
1589
|
-
|
|
1590
|
-
//#endregion
|
|
1591
|
-
//#region src/modules/wallets/utils/getWalletProviderFromWalletAccount/getWalletProviderFromWalletAccount.ts
|
|
1592
|
-
/** @not-instrumented */
|
|
1593
|
-
const getWalletProviderFromWalletAccount = ({ walletAccount }, client) => {
|
|
1594
|
-
const walletProvider = getWalletProviderRegistry(client).getByKey(walletAccount.walletProviderKey);
|
|
1595
|
-
if (!walletProvider) throw new NoWalletProviderFoundError({ walletProviderKey: walletAccount.walletProviderKey });
|
|
1596
|
-
return walletProvider;
|
|
1597
|
-
};
|
|
1598
|
-
|
|
1599
|
-
//#endregion
|
|
1600
|
-
//#region src/modules/wallets/utils/getAvailableWalletProvidersFromWalletAccounts/getAvailableWalletProvidersFromWalletAccounts.ts
|
|
1601
|
-
/** @not-instrumented */
|
|
1602
|
-
const getAvailableWalletProvidersFromWalletAccounts = (client) => {
|
|
1603
|
-
const core = getCore(client);
|
|
1604
|
-
const walletProvidersMap = /* @__PURE__ */ new Map();
|
|
1605
|
-
getWalletAccounts(client).forEach((walletAccount) => {
|
|
1606
|
-
if (walletProvidersMap.has(walletAccount.walletProviderKey)) return;
|
|
1607
|
-
try {
|
|
1608
|
-
const walletProvider = getWalletProviderFromWalletAccount({ walletAccount }, client);
|
|
1609
|
-
walletProvidersMap.set(walletAccount.walletProviderKey, walletProvider);
|
|
1610
|
-
} catch (error) {
|
|
1611
|
-
core.logger.debug("Wallet provider not found for wallet account", {
|
|
1612
|
-
error,
|
|
1613
|
-
walletAccount: walletAccount.address
|
|
1614
|
-
});
|
|
1615
|
-
}
|
|
1616
|
-
});
|
|
1617
|
-
return Array.from(walletProvidersMap.values());
|
|
1618
|
-
};
|
|
1619
|
-
|
|
1620
|
-
//#endregion
|
|
1621
|
-
//#region src/modules/wallets/destroyWalletProviders/destroyWalletProviders.ts
|
|
1622
|
-
/**
|
|
1623
|
-
* Tear down every wallet provider on the client.
|
|
1624
|
-
*
|
|
1625
|
-
* Each provider's `destroy` is responsible for its own local + remote
|
|
1626
|
-
* cleanup. We swallow errors so a failing destroy on one provider does not
|
|
1627
|
-
* block teardown of the others (e.g. during logout).
|
|
1628
|
-
*
|
|
1629
|
-
* @not-instrumented
|
|
1630
|
-
*/
|
|
1631
|
-
const destroyWalletProviders = async ({ reason }, client) => {
|
|
1632
|
-
const core = getCore(client);
|
|
1633
|
-
const walletProviders = getAvailableWalletProvidersFromWalletAccounts(client);
|
|
1634
|
-
await Promise.all(walletProviders.map(async (walletProvider) => {
|
|
1635
|
-
if (!walletProvider.destroy) return;
|
|
1636
|
-
try {
|
|
1637
|
-
await walletProvider.destroy({ reason });
|
|
1638
|
-
} catch (err) {
|
|
1639
|
-
core.logger.error(`Error destroying wallet provider ${walletProvider.key}`, err);
|
|
1640
|
-
}
|
|
1641
|
-
}));
|
|
1642
|
-
};
|
|
1643
|
-
|
|
1644
|
-
//#endregion
|
|
1645
|
-
//#region src/modules/auth/consts.ts
|
|
1646
|
-
const DYNAMIC_AUTH_COOKIE_NAME = "DYNAMIC_JWT_TOKEN";
|
|
1647
|
-
|
|
1648
|
-
//#endregion
|
|
1649
|
-
//#region src/modules/auth/logoutWithReason/logoutWithReason.ts
|
|
1650
|
-
/**
|
|
1651
|
-
* Logs the user out with an explicit reason.
|
|
1652
|
-
*
|
|
1653
|
-
* Revokes the session, clears auth state, terminates wallet providers, and
|
|
1654
|
-
* emits the `logout` client event with the given reason. The reason is also
|
|
1655
|
-
* captured as an argument on the function-instrumentation event, which is
|
|
1656
|
-
* how Datadog distinguishes between different logout causes.
|
|
1657
|
-
*
|
|
1658
|
-
* Use this instead of the public `logout` when triggering a logout from
|
|
1659
|
-
* internal or extension code — the caller owns the reason string, so the
|
|
1660
|
-
* telemetry correctly attributes *why* the logout happened.
|
|
1661
|
-
*
|
|
1662
|
-
* @param params - The logout params.
|
|
1663
|
-
* @param params.reason - Why the logout is being triggered. Extension authors
|
|
1664
|
-
* needing a reason outside the SDK catalog can cast with `as LogoutReason`.
|
|
1665
|
-
* @param client - The Dynamic client instance.
|
|
1666
|
-
* @instrumented
|
|
1667
|
-
*/
|
|
1668
|
-
const logoutWithReason = async ({ reason }, client) => {
|
|
1669
|
-
const core = getCore(client);
|
|
1670
|
-
core.logger.debug("[logoutWithReason] Logging out...", { reason });
|
|
1671
|
-
await destroyWalletProviders({ reason }, client);
|
|
1672
|
-
if (client.user !== null) {
|
|
1673
|
-
const apiClient = createApiClient({ skipSessionExpiryLogout: true }, client);
|
|
1674
|
-
try {
|
|
1675
|
-
await apiClient.revokeSession({ environmentId: core.environmentId });
|
|
1676
|
-
} catch (error) {
|
|
1677
|
-
core.logger.error("Failed to revoke session", error);
|
|
1678
|
-
}
|
|
1679
|
-
/**
|
|
1680
|
-
* This deletes the auth cookie if it exists.
|
|
1681
|
-
* If the cookie doesn't exist, this sets a new cookie that expires immediately.
|
|
1682
|
-
*/
|
|
1683
|
-
if (isCookieEnabled(client)) setCookie(`${DYNAMIC_AUTH_COOKIE_NAME}=; Max-Age=-99999999; path=/; SameSite=Lax`);
|
|
1684
|
-
}
|
|
1685
|
-
await core.keychain.removeKey("session");
|
|
1686
|
-
core.state.set({
|
|
1687
|
-
captchaToken: null,
|
|
1688
|
-
elevatedAccessTokens: [],
|
|
1689
|
-
legacyToken: null,
|
|
1690
|
-
mfaToken: null,
|
|
1691
|
-
sessionExpiresAt: null,
|
|
1692
|
-
sessionKeys: null,
|
|
1693
|
-
token: null,
|
|
1694
|
-
unverifiedWalletAccounts: [],
|
|
1695
|
-
user: null
|
|
1696
|
-
});
|
|
1697
|
-
emitEvent({
|
|
1698
|
-
args: { reason },
|
|
1699
|
-
event: "logout"
|
|
1700
|
-
}, client);
|
|
1701
|
-
fetchProjectSettings(client);
|
|
1702
|
-
generateSessionKeys(client);
|
|
1703
|
-
};
|
|
1704
|
-
const __logoutWithReason_impl = logoutWithReason;
|
|
1705
|
-
const __logoutWithReason_wrapped = instrumentFunction({
|
|
1706
|
-
fn: __logoutWithReason_impl,
|
|
1707
|
-
functionName: "logoutWithReason",
|
|
1708
|
-
getCore: () => {
|
|
1709
|
-
try {
|
|
1710
|
-
return getCore(getDefaultClient());
|
|
1711
|
-
} catch {
|
|
1712
|
-
return;
|
|
1713
|
-
}
|
|
1714
|
-
}
|
|
1715
|
-
});
|
|
1716
|
-
|
|
1717
|
-
//#endregion
|
|
1718
|
-
//#region src/modules/apiClient/utils/sessionExpiryLogoutMiddleware/createSessionExpiryLogoutMiddleware.ts
|
|
1719
|
-
const UNAUTHORIZED_STATUS = 401;
|
|
1720
|
-
/**
|
|
1721
|
-
* Creates middleware that ends the local session when an *authenticated*
|
|
1722
|
-
* request is rejected with a 401.
|
|
1723
|
-
*
|
|
1724
|
-
* A 401 on a request that carried an authenticated session means the backend
|
|
1725
|
-
* rejected our credentials, so the local session is stale and must be cleared.
|
|
1726
|
-
* The check is purely local (`client.user`) — we deliberately do not
|
|
1727
|
-
* re-validate over the network, because the 401 itself is the rejection signal
|
|
1728
|
-
* and re-validating would route back through this same middleware.
|
|
1729
|
-
*
|
|
1730
|
-
* Requests made without an authenticated session (e.g. pre-auth probes) are
|
|
1731
|
-
* ignored — there is no session to invalidate. Endpoints that legitimately
|
|
1732
|
-
* return 401 for non-session reasons opt out of this behavior by omitting the
|
|
1733
|
-
* middleware (see `skipSessionExpiryLogout` on `createApiClient`).
|
|
1734
|
-
*
|
|
1735
|
-
* This middleware runs before the error-conversion middleware so it observes
|
|
1736
|
-
* every 401 regardless of response body. The logout is fired as a side effect
|
|
1737
|
-
* and the response is returned unchanged, so the downstream error middleware
|
|
1738
|
-
* still throws the typed error to the caller.
|
|
1739
|
-
*
|
|
1740
|
-
* @param client - The Dynamic client instance.
|
|
1741
|
-
* @not-instrumented
|
|
1742
|
-
*/
|
|
1743
|
-
const createSessionExpiryLogoutMiddleware = (client) => ({ post: async (context) => {
|
|
1744
|
-
if (context.response.status === UNAUTHORIZED_STATUS && client.user !== null) __logoutWithReason_wrapped({ reason: "session-revoked" }, client).catch((error) => {
|
|
1745
|
-
getCore(client).logger.error("Failed to log out after unauthorized response", error);
|
|
1746
|
-
});
|
|
1747
|
-
return context.response;
|
|
1748
|
-
} });
|
|
1749
|
-
|
|
1750
|
-
//#endregion
|
|
1751
|
-
//#region src/errors/UnauthorizedError.ts
|
|
1752
|
-
var UnauthorizedError = class extends BaseError {
|
|
1753
|
-
constructor({ cause }) {
|
|
1754
|
-
super({
|
|
1755
|
-
cause,
|
|
1756
|
-
code: "unauthorized_error",
|
|
1757
|
-
docsUrl: null,
|
|
1758
|
-
name: "UnauthorizedError",
|
|
1759
|
-
shortMessage: "Unauthorized"
|
|
1760
|
-
});
|
|
1761
|
-
}
|
|
1762
|
-
};
|
|
1763
|
-
|
|
1764
|
-
//#endregion
|
|
1765
|
-
//#region src/modules/apiClient/utils/unauthorizedMiddleware/createUnauthorizedMiddleware.ts
|
|
1766
|
-
/** @not-instrumented */
|
|
1767
|
-
const createUnauthorizedMiddleware = () => ({ post: async (context) => {
|
|
1768
|
-
if (context.response.status === 401) {
|
|
1769
|
-
let cause = null;
|
|
1770
|
-
try {
|
|
1771
|
-
const errorBody = await context.response.clone().json();
|
|
1772
|
-
if (errorBody && "error" in errorBody && typeof errorBody.error === "string") cause = new Error(errorBody.error);
|
|
1773
|
-
} catch {}
|
|
1774
|
-
throw new UnauthorizedError({ cause });
|
|
1775
|
-
}
|
|
1776
|
-
return context.response;
|
|
1777
|
-
} });
|
|
1778
|
-
|
|
1779
|
-
//#endregion
|
|
1780
|
-
//#region src/modules/apiClient/createApiClient.ts
|
|
1781
|
-
/**
|
|
1782
|
-
* Returns a new instance of the SDK API client.
|
|
1783
|
-
*
|
|
1784
|
-
* This is not meant for storing, as it is very light we can create it whenever needed.
|
|
1785
|
-
* @not-instrumented
|
|
1786
|
-
*/
|
|
1787
|
-
const createApiClient = (options = {}, client) => {
|
|
1788
|
-
const core = getCore(client);
|
|
1789
|
-
const coreState = core.state.get();
|
|
1790
|
-
const settings = {
|
|
1791
|
-
basePath: core.apiBaseUrl,
|
|
1792
|
-
headers: {
|
|
1793
|
-
"Content-Type": "application/json",
|
|
1794
|
-
[DYNAMIC_API_VERSION_HEADER]: `API/${DYNAMIC_SDK_API_VERSION}`,
|
|
1795
|
-
[DYNAMIC_REQUEST_ID_HEADER]: randomString({ length: 50 }),
|
|
1796
|
-
[DYNAMIC_SDK_SESSION_ID_HEADER]: core.sdkSessionId,
|
|
1797
|
-
[DYNAMIC_SDK_VERSION_HEADER]: `${CLIENT_SDK_NAME}/${version}`,
|
|
1798
|
-
...core.getApiHeaders(),
|
|
1799
|
-
...options.headers
|
|
1800
|
-
}
|
|
1801
|
-
};
|
|
1802
|
-
if (core.metadata?.universalLink) settings.headers["Origin"] = core.metadata.universalLink;
|
|
1803
|
-
if (client.token) settings.headers.Authorization = `Bearer ${client.token}`;
|
|
1804
|
-
if (client.projectSettings && isCookieEnabled(client)) settings.credentials = "include";
|
|
1805
|
-
if (options.includeMfaToken && coreState.mfaToken) settings.headers[MFA_TOKEN_HEADER] = coreState.mfaToken;
|
|
1806
|
-
if (options.elevatedAccessTokenScope) {
|
|
1807
|
-
const elevatedToken = __getElevatedAccessToken_wrapped({ scope: options.elevatedAccessTokenScope }, client);
|
|
1808
|
-
if (elevatedToken) settings.headers[ELEVATED_ACCESS_TOKEN_HEADER] = elevatedToken;
|
|
1809
|
-
}
|
|
1810
|
-
const sessionPublicKey = getSessionKeys(client)?.publicKey;
|
|
1811
|
-
const isSessionPublicKeyHeaderPresent = settings.headers[SESSION_PUBLIC_KEY_HEADER] !== void 0;
|
|
1812
|
-
if (sessionPublicKey && !isSessionPublicKeyHeaderPresent) settings.headers[SESSION_PUBLIC_KEY_HEADER] = sessionPublicKey;
|
|
1813
|
-
return new _dynamic_labs_sdk_api_core.SDKApi(new _dynamic_labs_sdk_api_core.Configuration({
|
|
1814
|
-
...settings,
|
|
1815
|
-
fetchApi: core.fetch,
|
|
1816
|
-
middleware: [
|
|
1817
|
-
createDeviceSignatureHeadersMiddleware(client),
|
|
1818
|
-
...options.skipSessionExpiryLogout ? [] : [createSessionExpiryLogoutMiddleware(client)],
|
|
1819
|
-
createConvertToApiErrorMiddleware({ errorMappers: [...options.errorMappers || [], clientErrorMapper] }),
|
|
1820
|
-
createUnauthorizedMiddleware()
|
|
1821
|
-
]
|
|
1822
|
-
}));
|
|
1823
|
-
};
|
|
1824
|
-
|
|
1825
|
-
//#endregion
|
|
1826
|
-
//#region src/utils/getNonce/fetchAndStoreNonces/fetchAndStoreNonces.ts
|
|
1827
|
-
/**
|
|
1828
|
-
* Fetches a batch of nonces from the API.
|
|
1829
|
-
*
|
|
1830
|
-
* Prefetching is critical for iOS deep link wallet providers (e.g. Phantom
|
|
1831
|
-
* redirect). On iOS, a network request (like fetching a nonce) between a user
|
|
1832
|
-
* action and a deeplink call will break the gesture chain, causing iOS to
|
|
1833
|
-
* silently ignore the deeplink. By prefetching nonces ahead of time,
|
|
1834
|
-
* `getNonce` can return synchronously from cache and the deeplink fires
|
|
1835
|
-
* without an interrupting network round-trip.
|
|
1836
|
-
*
|
|
1837
|
-
* New nonces are **appended** to the existing pool so that unconsumed entries
|
|
1838
|
-
* are not discarded by a background refetch.
|
|
1839
|
-
* @not-instrumented
|
|
1840
|
-
*/
|
|
1841
|
-
const fetchAndStoreNonces = async (client) => {
|
|
1842
|
-
const core = getCore(client);
|
|
1843
|
-
const { environmentId } = core;
|
|
1844
|
-
const { nonces } = await createApiClient({}, client).getNonces({
|
|
1845
|
-
count: NONCE_POOL_SIZE,
|
|
1846
|
-
environmentId
|
|
1847
|
-
});
|
|
1848
|
-
const existing = core.state.get().prefetchedNonces;
|
|
1849
|
-
core.state.set({
|
|
1850
|
-
prefetchedNonces: [...existing, ...nonces],
|
|
1851
|
-
prefetchedNoncesExpiration: Date.now() + NONCE_POOL_EXPIRATION_TIME
|
|
1852
|
-
});
|
|
1853
|
-
};
|
|
1854
|
-
|
|
1855
|
-
//#endregion
|
|
1856
|
-
//#region src/constants.ts
|
|
1857
|
-
const SDK_API_CORE_VERSION = dependencies["@dynamic-labs/sdk-api-core"];
|
|
1858
|
-
const DYNAMIC_ICONIC_SPRITE_URL = "https://iconic.dynamic-static-assets.com/icons/sprite.svg";
|
|
1859
|
-
|
|
1860
|
-
//#endregion
|
|
1861
|
-
//#region src/modules/waas/constants.ts
|
|
1862
|
-
const DEFAULT_WAAS_BASE_API_URL = "https://app.dynamicauth.com";
|
|
1863
|
-
const DEFAULT_WAAS_BASE_MPC_RELAY_API_URL = "https://relay.dynamicauth.com";
|
|
1864
|
-
const DYNAMIC_WAAS_METADATA = {
|
|
1865
|
-
displayName: "Dynamic WaaS",
|
|
1866
|
-
icon: `${DYNAMIC_ICONIC_SPRITE_URL}#dynamicwaas`,
|
|
1867
|
-
normalizedWalletName: "dynamicwaas"
|
|
1868
|
-
};
|
|
1869
|
-
|
|
1870
|
-
//#endregion
|
|
1871
|
-
//#region src/errors/InvalidParamError.ts
|
|
1872
|
-
var InvalidParamError = class extends BaseError {
|
|
1873
|
-
constructor(message) {
|
|
1874
|
-
super({
|
|
1875
|
-
cause: null,
|
|
1876
|
-
code: "invalid_param_error",
|
|
1877
|
-
docsUrl: null,
|
|
1878
|
-
name: "InvalidParamError",
|
|
1879
|
-
shortMessage: message
|
|
1146
|
+
name: "InvalidParamError",
|
|
1147
|
+
shortMessage: message
|
|
1880
1148
|
});
|
|
1881
1149
|
}
|
|
1882
1150
|
};
|
|
@@ -1930,12 +1198,6 @@ Object.defineProperty(exports, 'DEFAULT_WAAS_BASE_MPC_RELAY_API_URL', {
|
|
|
1930
1198
|
return DEFAULT_WAAS_BASE_MPC_RELAY_API_URL;
|
|
1931
1199
|
}
|
|
1932
1200
|
});
|
|
1933
|
-
Object.defineProperty(exports, 'DYNAMIC_AUTH_COOKIE_NAME', {
|
|
1934
|
-
enumerable: true,
|
|
1935
|
-
get: function () {
|
|
1936
|
-
return DYNAMIC_AUTH_COOKIE_NAME;
|
|
1937
|
-
}
|
|
1938
|
-
});
|
|
1939
1201
|
Object.defineProperty(exports, 'DYNAMIC_ICONIC_SPRITE_URL', {
|
|
1940
1202
|
enumerable: true,
|
|
1941
1203
|
get: function () {
|
|
@@ -1966,12 +1228,6 @@ Object.defineProperty(exports, 'InvalidParamError', {
|
|
|
1966
1228
|
return InvalidParamError;
|
|
1967
1229
|
}
|
|
1968
1230
|
});
|
|
1969
|
-
Object.defineProperty(exports, 'InvalidWalletProviderKeyError', {
|
|
1970
|
-
enumerable: true,
|
|
1971
|
-
get: function () {
|
|
1972
|
-
return InvalidWalletProviderKeyError;
|
|
1973
|
-
}
|
|
1974
|
-
});
|
|
1975
1231
|
Object.defineProperty(exports, 'LinkCredentialError', {
|
|
1976
1232
|
enumerable: true,
|
|
1977
1233
|
get: function () {
|
|
@@ -1996,12 +1252,6 @@ Object.defineProperty(exports, 'NONCE_POOL_SIZE', {
|
|
|
1996
1252
|
return NONCE_POOL_SIZE;
|
|
1997
1253
|
}
|
|
1998
1254
|
});
|
|
1999
|
-
Object.defineProperty(exports, 'NoWalletProviderFoundError', {
|
|
2000
|
-
enumerable: true,
|
|
2001
|
-
get: function () {
|
|
2002
|
-
return NoWalletProviderFoundError;
|
|
2003
|
-
}
|
|
2004
|
-
});
|
|
2005
1255
|
Object.defineProperty(exports, 'SDK_API_CORE_VERSION', {
|
|
2006
1256
|
enumerable: true,
|
|
2007
1257
|
get: function () {
|
|
@@ -2026,30 +1276,12 @@ Object.defineProperty(exports, 'ValueMustBeDefinedError', {
|
|
|
2026
1276
|
return ValueMustBeDefinedError;
|
|
2027
1277
|
}
|
|
2028
1278
|
});
|
|
2029
|
-
Object.defineProperty(exports, 'WalletProviderPriority', {
|
|
2030
|
-
enumerable: true,
|
|
2031
|
-
get: function () {
|
|
2032
|
-
return WalletProviderPriority;
|
|
2033
|
-
}
|
|
2034
|
-
});
|
|
2035
1279
|
Object.defineProperty(exports, '__getElevatedAccessToken_wrapped', {
|
|
2036
1280
|
enumerable: true,
|
|
2037
1281
|
get: function () {
|
|
2038
1282
|
return __getElevatedAccessToken_wrapped;
|
|
2039
1283
|
}
|
|
2040
1284
|
});
|
|
2041
|
-
Object.defineProperty(exports, '__logoutWithReason_wrapped', {
|
|
2042
|
-
enumerable: true,
|
|
2043
|
-
get: function () {
|
|
2044
|
-
return __logoutWithReason_wrapped;
|
|
2045
|
-
}
|
|
2046
|
-
});
|
|
2047
|
-
Object.defineProperty(exports, '__toESM', {
|
|
2048
|
-
enumerable: true,
|
|
2049
|
-
get: function () {
|
|
2050
|
-
return __toESM;
|
|
2051
|
-
}
|
|
2052
|
-
});
|
|
2053
1285
|
Object.defineProperty(exports, 'assertDefined', {
|
|
2054
1286
|
enumerable: true,
|
|
2055
1287
|
get: function () {
|
|
@@ -2068,24 +1300,6 @@ Object.defineProperty(exports, 'createDeviceSignatureHeadersMiddleware', {
|
|
|
2068
1300
|
return createDeviceSignatureHeadersMiddleware;
|
|
2069
1301
|
}
|
|
2070
1302
|
});
|
|
2071
|
-
Object.defineProperty(exports, 'createRuntimeServiceAccessKey', {
|
|
2072
|
-
enumerable: true,
|
|
2073
|
-
get: function () {
|
|
2074
|
-
return createRuntimeServiceAccessKey;
|
|
2075
|
-
}
|
|
2076
|
-
});
|
|
2077
|
-
Object.defineProperty(exports, 'createStorageKeySchema', {
|
|
2078
|
-
enumerable: true,
|
|
2079
|
-
get: function () {
|
|
2080
|
-
return createStorageKeySchema;
|
|
2081
|
-
}
|
|
2082
|
-
});
|
|
2083
|
-
Object.defineProperty(exports, 'emitEvent', {
|
|
2084
|
-
enumerable: true,
|
|
2085
|
-
get: function () {
|
|
2086
|
-
return emitEvent;
|
|
2087
|
-
}
|
|
2088
|
-
});
|
|
2089
1303
|
Object.defineProperty(exports, 'extractSessionId', {
|
|
2090
1304
|
enumerable: true,
|
|
2091
1305
|
get: function () {
|
|
@@ -2098,30 +1312,6 @@ Object.defineProperty(exports, 'fetchAndStoreNonces', {
|
|
|
2098
1312
|
return fetchAndStoreNonces;
|
|
2099
1313
|
}
|
|
2100
1314
|
});
|
|
2101
|
-
Object.defineProperty(exports, 'fetchProjectSettings', {
|
|
2102
|
-
enumerable: true,
|
|
2103
|
-
get: function () {
|
|
2104
|
-
return fetchProjectSettings;
|
|
2105
|
-
}
|
|
2106
|
-
});
|
|
2107
|
-
Object.defineProperty(exports, 'formatWalletAccountId', {
|
|
2108
|
-
enumerable: true,
|
|
2109
|
-
get: function () {
|
|
2110
|
-
return formatWalletAccountId;
|
|
2111
|
-
}
|
|
2112
|
-
});
|
|
2113
|
-
Object.defineProperty(exports, 'formatWalletProviderKey', {
|
|
2114
|
-
enumerable: true,
|
|
2115
|
-
get: function () {
|
|
2116
|
-
return formatWalletProviderKey;
|
|
2117
|
-
}
|
|
2118
|
-
});
|
|
2119
|
-
Object.defineProperty(exports, 'generateSessionKeys', {
|
|
2120
|
-
enumerable: true,
|
|
2121
|
-
get: function () {
|
|
2122
|
-
return generateSessionKeys;
|
|
2123
|
-
}
|
|
2124
|
-
});
|
|
2125
1315
|
Object.defineProperty(exports, 'getChainFromVerifiedCredentialChain', {
|
|
2126
1316
|
enumerable: true,
|
|
2127
1317
|
get: function () {
|
|
@@ -2170,30 +1360,6 @@ Object.defineProperty(exports, 'getUserAgent', {
|
|
|
2170
1360
|
return getUserAgent;
|
|
2171
1361
|
}
|
|
2172
1362
|
});
|
|
2173
|
-
Object.defineProperty(exports, 'getWalletAccounts', {
|
|
2174
|
-
enumerable: true,
|
|
2175
|
-
get: function () {
|
|
2176
|
-
return getWalletAccounts;
|
|
2177
|
-
}
|
|
2178
|
-
});
|
|
2179
|
-
Object.defineProperty(exports, 'getWalletAccountsFromState', {
|
|
2180
|
-
enumerable: true,
|
|
2181
|
-
get: function () {
|
|
2182
|
-
return getWalletAccountsFromState;
|
|
2183
|
-
}
|
|
2184
|
-
});
|
|
2185
|
-
Object.defineProperty(exports, 'getWalletProviderFromWalletAccount', {
|
|
2186
|
-
enumerable: true,
|
|
2187
|
-
get: function () {
|
|
2188
|
-
return getWalletProviderFromWalletAccount;
|
|
2189
|
-
}
|
|
2190
|
-
});
|
|
2191
|
-
Object.defineProperty(exports, 'getWalletProviderRegistry', {
|
|
2192
|
-
enumerable: true,
|
|
2193
|
-
get: function () {
|
|
2194
|
-
return getWalletProviderRegistry;
|
|
2195
|
-
}
|
|
2196
|
-
});
|
|
2197
1363
|
Object.defineProperty(exports, 'instrumentFunction', {
|
|
2198
1364
|
enumerable: true,
|
|
2199
1365
|
get: function () {
|
|
@@ -2206,88 +1372,34 @@ Object.defineProperty(exports, 'isCookieEnabled', {
|
|
|
2206
1372
|
return isCookieEnabled;
|
|
2207
1373
|
}
|
|
2208
1374
|
});
|
|
2209
|
-
Object.defineProperty(exports, 'isSignedIn', {
|
|
2210
|
-
enumerable: true,
|
|
2211
|
-
get: function () {
|
|
2212
|
-
return isSignedIn;
|
|
2213
|
-
}
|
|
2214
|
-
});
|
|
2215
1375
|
Object.defineProperty(exports, 'name', {
|
|
2216
1376
|
enumerable: true,
|
|
2217
1377
|
get: function () {
|
|
2218
1378
|
return name;
|
|
2219
1379
|
}
|
|
2220
1380
|
});
|
|
2221
|
-
Object.defineProperty(exports, 'normalizeAddress', {
|
|
2222
|
-
enumerable: true,
|
|
2223
|
-
get: function () {
|
|
2224
|
-
return normalizeAddress;
|
|
2225
|
-
}
|
|
2226
|
-
});
|
|
2227
|
-
Object.defineProperty(exports, 'normalizeWalletNameWithChain', {
|
|
2228
|
-
enumerable: true,
|
|
2229
|
-
get: function () {
|
|
2230
|
-
return normalizeWalletNameWithChain;
|
|
2231
|
-
}
|
|
2232
|
-
});
|
|
2233
|
-
Object.defineProperty(exports, 'offEvent', {
|
|
2234
|
-
enumerable: true,
|
|
2235
|
-
get: function () {
|
|
2236
|
-
return offEvent;
|
|
2237
|
-
}
|
|
2238
|
-
});
|
|
2239
|
-
Object.defineProperty(exports, 'onEvent', {
|
|
2240
|
-
enumerable: true,
|
|
2241
|
-
get: function () {
|
|
2242
|
-
return onEvent;
|
|
2243
|
-
}
|
|
2244
|
-
});
|
|
2245
|
-
Object.defineProperty(exports, 'onceEvent', {
|
|
2246
|
-
enumerable: true,
|
|
2247
|
-
get: function () {
|
|
2248
|
-
return onceEvent;
|
|
2249
|
-
}
|
|
2250
|
-
});
|
|
2251
1381
|
Object.defineProperty(exports, 'randomString', {
|
|
2252
1382
|
enumerable: true,
|
|
2253
1383
|
get: function () {
|
|
2254
1384
|
return randomString;
|
|
2255
1385
|
}
|
|
2256
1386
|
});
|
|
2257
|
-
Object.defineProperty(exports, 'retryOnFail', {
|
|
2258
|
-
enumerable: true,
|
|
2259
|
-
get: function () {
|
|
2260
|
-
return retryOnFail;
|
|
2261
|
-
}
|
|
2262
|
-
});
|
|
2263
1387
|
Object.defineProperty(exports, 'scrubParameters', {
|
|
2264
1388
|
enumerable: true,
|
|
2265
1389
|
get: function () {
|
|
2266
1390
|
return scrubParameters;
|
|
2267
1391
|
}
|
|
2268
1392
|
});
|
|
2269
|
-
Object.defineProperty(exports, 'setCookie', {
|
|
2270
|
-
enumerable: true,
|
|
2271
|
-
get: function () {
|
|
2272
|
-
return setCookie;
|
|
2273
|
-
}
|
|
2274
|
-
});
|
|
2275
1393
|
Object.defineProperty(exports, 'setDefaultClient', {
|
|
2276
1394
|
enumerable: true,
|
|
2277
1395
|
get: function () {
|
|
2278
1396
|
return setDefaultClient;
|
|
2279
1397
|
}
|
|
2280
1398
|
});
|
|
2281
|
-
Object.defineProperty(exports, 'splitWalletProviderKey', {
|
|
2282
|
-
enumerable: true,
|
|
2283
|
-
get: function () {
|
|
2284
|
-
return splitWalletProviderKey;
|
|
2285
|
-
}
|
|
2286
|
-
});
|
|
2287
1399
|
Object.defineProperty(exports, 'version', {
|
|
2288
1400
|
enumerable: true,
|
|
2289
1401
|
get: function () {
|
|
2290
1402
|
return version;
|
|
2291
1403
|
}
|
|
2292
1404
|
});
|
|
2293
|
-
//# sourceMappingURL=InvalidParamError-
|
|
1405
|
+
//# sourceMappingURL=InvalidParamError-CTssOe86.cjs.map
|