@dynamic-labs/client 2.0.0-alpha.29 → 2.0.0-alpha.30
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 +11 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +4 -2
- package/src/client/client.cjs +3 -0
- package/src/client/client.d.ts +3 -3
- package/src/client/client.js +3 -0
- package/src/modules/sdkModule/sdkModule.cjs +7 -10
- package/src/modules/sdkModule/sdkModule.d.ts +2 -3
- package/src/modules/sdkModule/sdkModule.js +8 -11
- package/src/modules/walletsModule/index.d.ts +1 -0
- package/src/modules/walletsModule/walletsModule.cjs +17 -0
- package/src/modules/walletsModule/walletsModule.d.ts +4 -0
- package/src/modules/walletsModule/walletsModule.js +13 -0
- package/src/utils/pickListenerActions/index.d.ts +1 -0
- package/src/utils/pickListenerActions/pickListenerActions.cjs +16 -0
- package/src/utils/pickListenerActions/pickListenerActions.d.ts +6 -0
- package/src/utils/pickListenerActions/pickListenerActions.js +12 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
|
|
2
|
+
## [2.0.0-alpha.30](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.29...v2.0.0-alpha.30) (2024-04-11)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### ⚠ BREAKING CHANGES
|
|
6
|
+
|
|
7
|
+
* add headless sms sign-in (#5274)
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* add headless sms sign-in ([#5274](https://github.com/dynamic-labs/DynamicAuth/issues/5274)) ([fffc293](https://github.com/dynamic-labs/DynamicAuth/commit/fffc293f85447a784e8c728d1586f3555ab1fbfa))
|
|
12
|
+
|
|
2
13
|
## [2.0.0-alpha.29](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.28...v2.0.0-alpha.29) (2024-04-10)
|
|
3
14
|
|
|
4
15
|
|
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": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.30",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/dynamic-labs/DynamicAuth.git",
|
|
@@ -26,6 +26,8 @@
|
|
|
26
26
|
"./package.json": "./package.json"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
|
-
"@dynamic-labs/message-transport": "2.0.0-alpha.
|
|
29
|
+
"@dynamic-labs/message-transport": "2.0.0-alpha.30",
|
|
30
|
+
"@dynamic-labs/types": "2.0.0-alpha.30",
|
|
31
|
+
"eventemitter3": "5.0.1"
|
|
30
32
|
}
|
|
31
33
|
}
|
package/src/client/client.cjs
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var sdkModule = require('../modules/sdkModule/sdkModule.cjs');
|
|
6
|
+
var walletsModule = require('../modules/walletsModule/walletsModule.cjs');
|
|
6
7
|
var Extendable = require('../utils/Extendable/Extendable.cjs');
|
|
7
8
|
var core = require('./core/core.cjs');
|
|
8
9
|
|
|
@@ -19,6 +20,8 @@ const createClient = (props) => {
|
|
|
19
20
|
return baseExtendable.extend(() => ({
|
|
20
21
|
/** Module that gives insight over the state of the SDK */
|
|
21
22
|
sdk: sdkModule.createSdkModule(core$1, props),
|
|
23
|
+
/** Module that provides access to user's wallets */
|
|
24
|
+
wallets: walletsModule.createWalletsModule(core$1),
|
|
22
25
|
}));
|
|
23
26
|
};
|
|
24
27
|
|
package/src/client/client.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export type ClientProps = {
|
|
|
16
16
|
*/
|
|
17
17
|
export declare const createClient: (props: ClientProps) => {
|
|
18
18
|
/** Module that gives insight over the state of the SDK */
|
|
19
|
-
sdk:
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
sdk: import("dist/packages/message-transport/src").StoreStateGetters<import("dist/packages/message-transport/src").SdkModuleState>;
|
|
20
|
+
/** Module that provides access to user's wallets */
|
|
21
|
+
wallets: import("dist/packages/message-transport/src").StoreStateGetters<import("dist/packages/message-transport/src").WalletsModuleState> & Pick<import("eventemitter3").EventEmitter<import("dist/packages/message-transport/src").StoreStateEvents<import("dist/packages/message-transport/src").WalletsModuleState>, any>, "on" | "off" | "once">;
|
|
22
22
|
} & Extendable;
|
package/src/client/client.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createSdkModule } from '../modules/sdkModule/sdkModule.js';
|
|
2
|
+
import { createWalletsModule } from '../modules/walletsModule/walletsModule.js';
|
|
2
3
|
import { Extendable } from '../utils/Extendable/Extendable.js';
|
|
3
4
|
import { createCore } from './core/core.js';
|
|
4
5
|
|
|
@@ -15,6 +16,8 @@ const createClient = (props) => {
|
|
|
15
16
|
return baseExtendable.extend(() => ({
|
|
16
17
|
/** Module that gives insight over the state of the SDK */
|
|
17
18
|
sdk: createSdkModule(core, props),
|
|
19
|
+
/** Module that provides access to user's wallets */
|
|
20
|
+
wallets: createWalletsModule(core),
|
|
18
21
|
}));
|
|
19
22
|
};
|
|
20
23
|
|
|
@@ -8,18 +8,15 @@ var manifest = require('./manifest/manifest.cjs');
|
|
|
8
8
|
|
|
9
9
|
const createSdkModule = (core, props) => {
|
|
10
10
|
const requestChannel = messageTransport.createRequestChannel(core.messageTransport);
|
|
11
|
-
const state = {
|
|
12
|
-
loaded: false,
|
|
13
|
-
};
|
|
14
11
|
requestChannel.handle('manifest', () => _tslib.__awaiter(void 0, void 0, void 0, function* () { return manifest.createManifest(props); }));
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return {
|
|
19
|
-
get loaded() {
|
|
20
|
-
return state.loaded;
|
|
12
|
+
const store = messageTransport.createStore({
|
|
13
|
+
initialState: {
|
|
14
|
+
loaded: false,
|
|
21
15
|
},
|
|
22
|
-
|
|
16
|
+
key: 'sdk',
|
|
17
|
+
messageTransport: core.messageTransport,
|
|
18
|
+
});
|
|
19
|
+
return store.getters;
|
|
23
20
|
};
|
|
24
21
|
|
|
25
22
|
exports.createSdkModule = createSdkModule;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
+
import { SdkModuleState } from '@dynamic-labs/message-transport';
|
|
1
2
|
import type { ClientProps } from '../../client';
|
|
2
3
|
import { Core } from '../../client/core';
|
|
3
|
-
export declare const createSdkModule: (core: Core, props: ClientProps) =>
|
|
4
|
-
readonly loaded: boolean;
|
|
5
|
-
};
|
|
4
|
+
export declare const createSdkModule: (core: Core, props: ClientProps) => import("@dynamic-labs/message-transport").StoreStateGetters<SdkModuleState>;
|
|
@@ -1,21 +1,18 @@
|
|
|
1
1
|
import { __awaiter } from '../../../_virtual/_tslib.js';
|
|
2
|
-
import { createRequestChannel } from '@dynamic-labs/message-transport';
|
|
2
|
+
import { createRequestChannel, createStore } from '@dynamic-labs/message-transport';
|
|
3
3
|
import { createManifest } from './manifest/manifest.js';
|
|
4
4
|
|
|
5
5
|
const createSdkModule = (core, props) => {
|
|
6
6
|
const requestChannel = createRequestChannel(core.messageTransport);
|
|
7
|
-
const state = {
|
|
8
|
-
loaded: false,
|
|
9
|
-
};
|
|
10
7
|
requestChannel.handle('manifest', () => __awaiter(void 0, void 0, void 0, function* () { return createManifest(props); }));
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return {
|
|
15
|
-
get loaded() {
|
|
16
|
-
return state.loaded;
|
|
8
|
+
const store = createStore({
|
|
9
|
+
initialState: {
|
|
10
|
+
loaded: false,
|
|
17
11
|
},
|
|
18
|
-
|
|
12
|
+
key: 'sdk',
|
|
13
|
+
messageTransport: core.messageTransport,
|
|
14
|
+
});
|
|
15
|
+
return store.getters;
|
|
19
16
|
};
|
|
20
17
|
|
|
21
18
|
export { createSdkModule };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './walletsModule';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var messageTransport = require('@dynamic-labs/message-transport');
|
|
6
|
+
var pickListenerActions = require('../../utils/pickListenerActions/pickListenerActions.cjs');
|
|
7
|
+
|
|
8
|
+
const createWalletsModule = (core) => {
|
|
9
|
+
const store = messageTransport.createStore({
|
|
10
|
+
initialState: { primaryWallet: undefined, userWallets: [] },
|
|
11
|
+
key: 'wallets',
|
|
12
|
+
messageTransport: core.messageTransport,
|
|
13
|
+
});
|
|
14
|
+
return Object.assign(store.getters, pickListenerActions.pickListenerActions(store.eventEmitter));
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
exports.createWalletsModule = createWalletsModule;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { WalletsModuleState } from '@dynamic-labs/message-transport';
|
|
2
|
+
import { Core } from '../../client/core';
|
|
3
|
+
export type WalletsModule = ReturnType<typeof createWalletsModule>;
|
|
4
|
+
export declare const createWalletsModule: (core: Core) => import("@dynamic-labs/message-transport").StoreStateGetters<WalletsModuleState> & Pick<import("eventemitter3").EventEmitter<import("@dynamic-labs/message-transport").StoreStateEvents<WalletsModuleState>, any>, "on" | "off" | "once">;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createStore } from '@dynamic-labs/message-transport';
|
|
2
|
+
import { pickListenerActions } from '../../utils/pickListenerActions/pickListenerActions.js';
|
|
3
|
+
|
|
4
|
+
const createWalletsModule = (core) => {
|
|
5
|
+
const store = createStore({
|
|
6
|
+
initialState: { primaryWallet: undefined, userWallets: [] },
|
|
7
|
+
key: 'wallets',
|
|
8
|
+
messageTransport: core.messageTransport,
|
|
9
|
+
});
|
|
10
|
+
return Object.assign(store.getters, pickListenerActions(store.eventEmitter));
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export { createWalletsModule };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './pickListenerActions';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* This only serves to limit the methods of an event emitter to
|
|
7
|
+
* only the ones necessary for event listening
|
|
8
|
+
*/
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10
|
+
const pickListenerActions = (emitter) => ({
|
|
11
|
+
off: emitter.off.bind(emitter),
|
|
12
|
+
on: emitter.on.bind(emitter),
|
|
13
|
+
once: emitter.once.bind(emitter),
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
exports.pickListenerActions = pickListenerActions;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import EventEmitter from 'eventemitter3';
|
|
2
|
+
/**
|
|
3
|
+
* This only serves to limit the methods of an event emitter to
|
|
4
|
+
* only the ones necessary for event listening
|
|
5
|
+
*/
|
|
6
|
+
export declare const pickListenerActions: <T extends EventEmitter<any, any>>(emitter: T) => Pick<T, "on" | "off" | "once">;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This only serves to limit the methods of an event emitter to
|
|
3
|
+
* only the ones necessary for event listening
|
|
4
|
+
*/
|
|
5
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6
|
+
const pickListenerActions = (emitter) => ({
|
|
7
|
+
off: emitter.off.bind(emitter),
|
|
8
|
+
on: emitter.on.bind(emitter),
|
|
9
|
+
once: emitter.once.bind(emitter),
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export { pickListenerActions };
|