@dynamic-labs/client 4.0.0-alpha.11 → 4.0.0-alpha.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +5 -5
- package/src/client/client.cjs +2 -0
- package/src/client/client.js +2 -0
- package/src/client/core/modules/initializationModule/initializationModule.cjs +19 -4
- package/src/client/core/modules/initializationModule/initializationModule.js +19 -4
- package/src/client/core/modules/manifestModule/manifestModule.cjs +4 -4
- package/src/modules/sdkModule/sdkModule.cjs +6 -1
- package/src/modules/sdkModule/sdkModule.d.ts +6 -2
- package/src/modules/sdkModule/sdkModule.js +6 -1
- package/src/utils/setupFetchHandler/index.d.ts +1 -0
- package/src/utils/setupFetchHandler/setupFetchHandler.cjs +24 -0
- package/src/utils/setupFetchHandler/setupFetchHandler.d.ts +2 -0
- package/src/utils/setupFetchHandler/setupFetchHandler.js +20 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,22 @@
|
|
|
1
1
|
|
|
2
|
+
## [4.0.0-alpha.12](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.11...v4.0.0-alpha.12) (2024-10-18)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* add support for xverse account change event ([#7114](https://github.com/dynamic-labs/dynamic-auth/issues/7114)) ([79df047](https://github.com/dynamic-labs/dynamic-auth/commit/79df04775edb297a339e2d74adcc873584a6d8af))
|
|
8
|
+
* solana embedded signall headless ([#7132](https://github.com/dynamic-labs/dynamic-auth/issues/7132)) ([fe16b71](https://github.com/dynamic-labs/dynamic-auth/commit/fe16b71a4c0ad775f8de87ca899cfdd1071f11d6))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* bug where embeddedWalletCreated event was fired before listener … ([#7151](https://github.com/dynamic-labs/dynamic-auth/issues/7151)) ([ae9da56](https://github.com/dynamic-labs/dynamic-auth/commit/ae9da56850130491384a2d5f47c1617815dcce5b))
|
|
14
|
+
* edge case where wallet book fails to load ([#7148](https://github.com/dynamic-labs/dynamic-auth/issues/7148)) ([805dc6d](https://github.com/dynamic-labs/dynamic-auth/commit/805dc6d7cc4cdf0b23748d82b3bd8216d88d55b5))
|
|
15
|
+
* issues where native currency icons were incorrect ([#7126](https://github.com/dynamic-labs/dynamic-auth/issues/7126)) ([8b8891a](https://github.com/dynamic-labs/dynamic-auth/commit/8b8891a52397e17cc127ea3a09ade14c4b70a8ee))
|
|
16
|
+
* remove now-unused sessionTimeout from useSocial ([#7123](https://github.com/dynamic-labs/dynamic-auth/issues/7123)) ([7959a8a](https://github.com/dynamic-labs/dynamic-auth/commit/7959a8a4c8ceb76c5c4f1ae91af204bf9c5cae7b))
|
|
17
|
+
* Revert: Update Exodus extension version " ([#7130](https://github.com/dynamic-labs/dynamic-auth/issues/7130)) ([f2274ae](https://github.com/dynamic-labs/dynamic-auth/commit/f2274aefd29bb9f3fb6de8493e4a5f73946a5600)), closes [#7129](https://github.com/dynamic-labs/dynamic-auth/issues/7129)
|
|
18
|
+
* use embedded primaryChain when passing undefined chains list to createTurnkeyWallet ([#7149](https://github.com/dynamic-labs/dynamic-auth/issues/7149)) ([c73a3ae](https://github.com/dynamic-labs/dynamic-auth/commit/c73a3aeeda8045b936d218f7078ad79967c321ef))
|
|
19
|
+
|
|
2
20
|
## [4.0.0-alpha.11](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.10...v4.0.0-alpha.11) (2024-10-15)
|
|
3
21
|
|
|
4
22
|
|
package/package.cjs
CHANGED
package/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/client",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.12",
|
|
4
4
|
"description": "Core package for utilizing Dynamic's sdk",
|
|
5
5
|
"author": "Dynamic Labs, Inc.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
"homepage": "https://www.dynamic.xyz/",
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@vue/reactivity": "3.4.21",
|
|
22
|
-
"@dynamic-labs/assert-package-version": "4.0.0-alpha.
|
|
23
|
-
"@dynamic-labs/logger": "4.0.0-alpha.
|
|
24
|
-
"@dynamic-labs/message-transport": "4.0.0-alpha.
|
|
25
|
-
"@dynamic-labs/types": "4.0.0-alpha.
|
|
22
|
+
"@dynamic-labs/assert-package-version": "4.0.0-alpha.12",
|
|
23
|
+
"@dynamic-labs/logger": "4.0.0-alpha.12",
|
|
24
|
+
"@dynamic-labs/message-transport": "4.0.0-alpha.12",
|
|
25
|
+
"@dynamic-labs/types": "4.0.0-alpha.12",
|
|
26
26
|
"eventemitter3": "5.0.1"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {}
|
package/src/client/client.cjs
CHANGED
|
@@ -10,6 +10,7 @@ var sdkModule = require('../modules/sdkModule/sdkModule.cjs');
|
|
|
10
10
|
var userInterfaceModule = require('../modules/userInterfaceModule/userInterfaceModule.cjs');
|
|
11
11
|
var walletsModule = require('../modules/walletsModule/walletsModule.cjs');
|
|
12
12
|
var Extendable = require('../utils/Extendable/Extendable.cjs');
|
|
13
|
+
var setupFetchHandler = require('../utils/setupFetchHandler/setupFetchHandler.cjs');
|
|
13
14
|
var core = require('./core/core.cjs');
|
|
14
15
|
|
|
15
16
|
const baseClientExtensionName = 'base';
|
|
@@ -23,6 +24,7 @@ const baseClientExtensionName = 'base';
|
|
|
23
24
|
const createClient = (props) => {
|
|
24
25
|
logger.Logger.setEnvironmentId(props.environmentId);
|
|
25
26
|
const core$1 = core.createCore(props);
|
|
27
|
+
setupFetchHandler.setupFetchHandler(core$1);
|
|
26
28
|
const baseExtendable = new Extendable.Extendable(core$1);
|
|
27
29
|
return baseExtendable.extend(() => {
|
|
28
30
|
core$1.declaredExtensionNames.push(baseClientExtensionName);
|
package/src/client/client.js
CHANGED
|
@@ -6,6 +6,7 @@ import { createSdkModule } from '../modules/sdkModule/sdkModule.js';
|
|
|
6
6
|
import { createUserInterfaceModule } from '../modules/userInterfaceModule/userInterfaceModule.js';
|
|
7
7
|
import { createWalletsModule } from '../modules/walletsModule/walletsModule.js';
|
|
8
8
|
import { Extendable } from '../utils/Extendable/Extendable.js';
|
|
9
|
+
import { setupFetchHandler } from '../utils/setupFetchHandler/setupFetchHandler.js';
|
|
9
10
|
import { createCore } from './core/core.js';
|
|
10
11
|
|
|
11
12
|
const baseClientExtensionName = 'base';
|
|
@@ -19,6 +20,7 @@ const baseClientExtensionName = 'base';
|
|
|
19
20
|
const createClient = (props) => {
|
|
20
21
|
Logger.setEnvironmentId(props.environmentId);
|
|
21
22
|
const core = createCore(props);
|
|
23
|
+
setupFetchHandler(core);
|
|
22
24
|
const baseExtendable = new Extendable(core);
|
|
23
25
|
return baseExtendable.extend(() => {
|
|
24
26
|
core.declaredExtensionNames.push(baseClientExtensionName);
|
|
@@ -12,15 +12,30 @@ const createInitializationModule = (messageTransport$1) => {
|
|
|
12
12
|
const state = reactivity.reactive({
|
|
13
13
|
error: null,
|
|
14
14
|
});
|
|
15
|
+
/**
|
|
16
|
+
* Uses regular console.error to log the errors
|
|
17
|
+
* so we dont send the error to the backend twice
|
|
18
|
+
*/
|
|
15
19
|
consoleRequestChannel.handle('error', (serializedError, { severity }) => {
|
|
16
20
|
const error = messageTransport.parseErrorFromTransport(serializedError);
|
|
21
|
+
if (Array.isArray(error)) {
|
|
22
|
+
// Log each item individually because the expo console fails to log complex objects
|
|
23
|
+
// So this way if one item is complex, it doesn't hide the others
|
|
24
|
+
// eslint-disable-next-line no-console
|
|
25
|
+
for (const item of error)
|
|
26
|
+
console.error(item);
|
|
27
|
+
if (severity === 'fatal') {
|
|
28
|
+
state.error = new Error('Unknown error occurred, check your console for more details');
|
|
29
|
+
}
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
17
32
|
if (severity === 'fatal') {
|
|
18
33
|
state.error = error;
|
|
19
34
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
35
|
+
// We also log the message individually in case the error object fails to be logged by the expo console
|
|
36
|
+
// eslint-disable-next-line no-console
|
|
37
|
+
if (error.message)
|
|
38
|
+
console.error(error.message);
|
|
24
39
|
// eslint-disable-next-line no-console
|
|
25
40
|
console.error(error);
|
|
26
41
|
});
|
|
@@ -8,15 +8,30 @@ const createInitializationModule = (messageTransport) => {
|
|
|
8
8
|
const state = reactive({
|
|
9
9
|
error: null,
|
|
10
10
|
});
|
|
11
|
+
/**
|
|
12
|
+
* Uses regular console.error to log the errors
|
|
13
|
+
* so we dont send the error to the backend twice
|
|
14
|
+
*/
|
|
11
15
|
consoleRequestChannel.handle('error', (serializedError, { severity }) => {
|
|
12
16
|
const error = parseErrorFromTransport(serializedError);
|
|
17
|
+
if (Array.isArray(error)) {
|
|
18
|
+
// Log each item individually because the expo console fails to log complex objects
|
|
19
|
+
// So this way if one item is complex, it doesn't hide the others
|
|
20
|
+
// eslint-disable-next-line no-console
|
|
21
|
+
for (const item of error)
|
|
22
|
+
console.error(item);
|
|
23
|
+
if (severity === 'fatal') {
|
|
24
|
+
state.error = new Error('Unknown error occurred, check your console for more details');
|
|
25
|
+
}
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
13
28
|
if (severity === 'fatal') {
|
|
14
29
|
state.error = error;
|
|
15
30
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
31
|
+
// We also log the message individually in case the error object fails to be logged by the expo console
|
|
32
|
+
// eslint-disable-next-line no-console
|
|
33
|
+
if (error.message)
|
|
34
|
+
console.error(error.message);
|
|
20
35
|
// eslint-disable-next-line no-console
|
|
21
36
|
console.error(error);
|
|
22
37
|
});
|
|
@@ -5,8 +5,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
|
|
6
6
|
var _tslib = require('../../../../../_virtual/_tslib.cjs');
|
|
7
7
|
var messageTransport = require('@dynamic-labs/message-transport');
|
|
8
|
-
var logger = require('@dynamic-labs/logger');
|
|
9
|
-
var logger
|
|
8
|
+
var logger$1 = require('@dynamic-labs/logger');
|
|
9
|
+
var logger = require('../../../../utils/logger/logger.cjs');
|
|
10
10
|
var createPartialManifest = require('./createPartialManifest/createPartialManifest.cjs');
|
|
11
11
|
var validateManifest = require('./validateManifest/validateManifest.cjs');
|
|
12
12
|
|
|
@@ -21,7 +21,7 @@ const createManifestModule = (props, messageTransport$1, initializationModule) =
|
|
|
21
21
|
return validateManifest.validateManifest(manifest);
|
|
22
22
|
}
|
|
23
23
|
catch (error) {
|
|
24
|
-
logger
|
|
24
|
+
logger.logger.error(error);
|
|
25
25
|
if (error instanceof Error)
|
|
26
26
|
initializationModule.error = error;
|
|
27
27
|
throw error;
|
|
@@ -30,7 +30,7 @@ const createManifestModule = (props, messageTransport$1, initializationModule) =
|
|
|
30
30
|
return {
|
|
31
31
|
setAppOrigin: (appOrigin) => (manifest.appOrigin = appOrigin),
|
|
32
32
|
setPlatform: (platform) => {
|
|
33
|
-
logger.Logger.globalMetaData.set('platform', platform);
|
|
33
|
+
logger$1.Logger.globalMetaData.set('platform', platform);
|
|
34
34
|
manifest.platform = platform;
|
|
35
35
|
},
|
|
36
36
|
setRedirectUrl: (redirectUrl) => (manifest.redirectUrl = redirectUrl),
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
|
+
var reactivity = require('@vue/reactivity');
|
|
6
7
|
var messageTransport = require('@dynamic-labs/message-transport');
|
|
7
8
|
var pickListenerActions = require('../../utils/pickListenerActions/pickListenerActions.cjs');
|
|
8
9
|
var addProperty = require('../../utils/addProperty/addProperty.cjs');
|
|
@@ -15,7 +16,11 @@ const createSdkModule = (core) => {
|
|
|
15
16
|
key: 'sdk',
|
|
16
17
|
messageTransport: core.messageTransport,
|
|
17
18
|
});
|
|
18
|
-
const
|
|
19
|
+
const eventEmitter = store.eventEmitter;
|
|
20
|
+
const baseModule = Object.assign(store.getters, pickListenerActions.pickListenerActions(eventEmitter));
|
|
21
|
+
reactivity.effect(() => core.initialization.error, {
|
|
22
|
+
scheduler: () => eventEmitter.emit('error', core.initialization.error),
|
|
23
|
+
});
|
|
19
24
|
return addProperty.addProperty(baseModule, 'error', {
|
|
20
25
|
get: () => core.initialization.error,
|
|
21
26
|
});
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import { SdkModuleState, StoreEventListeners } from '@dynamic-labs/message-transport';
|
|
1
|
+
import { PickedEventListeners, SdkModuleState, StoreEventListeners } from '@dynamic-labs/message-transport';
|
|
2
2
|
import { Core } from '../../client/core';
|
|
3
|
-
|
|
3
|
+
type ErrorEvent = {
|
|
4
|
+
error: (error: Error | null) => void;
|
|
5
|
+
};
|
|
6
|
+
export type SdkModule = SdkModuleState & StoreEventListeners<SdkModuleState> & PickedEventListeners<ErrorEvent> & {
|
|
4
7
|
readonly error: Error | null;
|
|
5
8
|
};
|
|
6
9
|
export declare const createSdkModule: (core: Core) => SdkModule;
|
|
10
|
+
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
'use client'
|
|
2
|
+
import { effect } from '@vue/reactivity';
|
|
2
3
|
import { createStore } from '@dynamic-labs/message-transport';
|
|
3
4
|
import { pickListenerActions } from '../../utils/pickListenerActions/pickListenerActions.js';
|
|
4
5
|
import { addProperty } from '../../utils/addProperty/addProperty.js';
|
|
@@ -11,7 +12,11 @@ const createSdkModule = (core) => {
|
|
|
11
12
|
key: 'sdk',
|
|
12
13
|
messageTransport: core.messageTransport,
|
|
13
14
|
});
|
|
14
|
-
const
|
|
15
|
+
const eventEmitter = store.eventEmitter;
|
|
16
|
+
const baseModule = Object.assign(store.getters, pickListenerActions(eventEmitter));
|
|
17
|
+
effect(() => core.initialization.error, {
|
|
18
|
+
scheduler: () => eventEmitter.emit('error', core.initialization.error),
|
|
19
|
+
});
|
|
15
20
|
return addProperty(baseModule, 'error', {
|
|
16
21
|
get: () => core.initialization.error,
|
|
17
22
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { setupFetchHandler } from './setupFetchHandler';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var _tslib = require('../../../_virtual/_tslib.cjs');
|
|
7
|
+
var messageTransport = require('@dynamic-labs/message-transport');
|
|
8
|
+
|
|
9
|
+
const setupFetchHandler = (core) => {
|
|
10
|
+
const fetchRequestChannel = messageTransport.createRequestChannel(core.messageTransport);
|
|
11
|
+
fetchRequestChannel.handle('fetch', (input, init) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
12
|
+
const response = yield fetch(input, init);
|
|
13
|
+
const responseBody = yield response.text();
|
|
14
|
+
return {
|
|
15
|
+
body: responseBody,
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17
|
+
headers: Object.fromEntries(response.headers.entries()),
|
|
18
|
+
status: response.status,
|
|
19
|
+
statusText: response.statusText,
|
|
20
|
+
};
|
|
21
|
+
}));
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
exports.setupFetchHandler = setupFetchHandler;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { __awaiter } from '../../../_virtual/_tslib.js';
|
|
3
|
+
import { createRequestChannel } from '@dynamic-labs/message-transport';
|
|
4
|
+
|
|
5
|
+
const setupFetchHandler = (core) => {
|
|
6
|
+
const fetchRequestChannel = createRequestChannel(core.messageTransport);
|
|
7
|
+
fetchRequestChannel.handle('fetch', (input, init) => __awaiter(void 0, void 0, void 0, function* () {
|
|
8
|
+
const response = yield fetch(input, init);
|
|
9
|
+
const responseBody = yield response.text();
|
|
10
|
+
return {
|
|
11
|
+
body: responseBody,
|
|
12
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
13
|
+
headers: Object.fromEntries(response.headers.entries()),
|
|
14
|
+
status: response.status,
|
|
15
|
+
statusText: response.statusText,
|
|
16
|
+
};
|
|
17
|
+
}));
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export { setupFetchHandler };
|