@dynamic-labs/client 2.1.0-alpha.2 → 2.1.0-alpha.20

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.
Files changed (60) hide show
  1. package/CHANGELOG.md +168 -0
  2. package/package.cjs +1 -1
  3. package/package.js +1 -1
  4. package/package.json +5 -3
  5. package/src/client/client.cjs +8 -2
  6. package/src/client/client.d.ts +11 -0
  7. package/src/client/client.js +8 -2
  8. package/src/client/core/core.cjs +11 -1
  9. package/src/client/core/core.d.ts +16 -2
  10. package/src/client/core/core.js +11 -1
  11. package/src/client/core/modules/initializationModule/index.d.ts +1 -0
  12. package/src/client/core/modules/initializationModule/initializationModule.cjs +33 -0
  13. package/src/client/core/modules/initializationModule/initializationModule.d.ts +5 -0
  14. package/src/client/core/modules/initializationModule/initializationModule.js +29 -0
  15. package/src/client/core/modules/manifestModule/index.d.ts +1 -0
  16. package/src/client/core/modules/manifestModule/manifestModule.cjs +22 -0
  17. package/src/client/core/modules/manifestModule/manifestModule.d.ts +8 -0
  18. package/src/client/core/modules/manifestModule/manifestModule.js +18 -0
  19. package/src/{modules/sdkModule → client/core/modules/manifestModule/utils}/manifest/manifest.cjs +1 -1
  20. package/src/{modules/sdkModule → client/core/modules/manifestModule/utils}/manifest/manifest.d.ts +1 -1
  21. package/src/{modules/sdkModule → client/core/modules/manifestModule/utils}/manifest/manifest.js +1 -1
  22. package/src/index.d.ts +2 -0
  23. package/src/modules/authModule/authModule.cjs +4 -0
  24. package/src/modules/authModule/authModule.d.ts +8 -1
  25. package/src/modules/authModule/authModule.js +4 -0
  26. package/src/modules/authModule/emailAuthModule/emailAuthModule.cjs +17 -0
  27. package/src/modules/authModule/emailAuthModule/emailAuthModule.d.ts +7 -0
  28. package/src/modules/authModule/emailAuthModule/emailAuthModule.js +13 -0
  29. package/src/modules/authModule/emailAuthModule/index.d.ts +1 -0
  30. package/src/modules/authModule/smsAuthModule/index.d.ts +1 -0
  31. package/src/modules/authModule/smsAuthModule/smsAuthModule.cjs +17 -0
  32. package/src/modules/authModule/smsAuthModule/smsAuthModule.d.ts +8 -0
  33. package/src/modules/authModule/smsAuthModule/smsAuthModule.js +13 -0
  34. package/src/modules/networksModule/index.d.ts +1 -0
  35. package/src/modules/networksModule/networksModule.cjs +18 -0
  36. package/src/modules/networksModule/networksModule.d.ts +3 -0
  37. package/src/modules/networksModule/networksModule.js +14 -0
  38. package/src/modules/sdkModule/sdkModule.cjs +6 -6
  39. package/src/modules/sdkModule/sdkModule.d.ts +4 -3
  40. package/src/modules/sdkModule/sdkModule.js +7 -7
  41. package/src/modules/userInterfaceModule/index.d.ts +1 -0
  42. package/src/modules/userInterfaceModule/userInterfaceModule.cjs +20 -0
  43. package/src/modules/userInterfaceModule/userInterfaceModule.d.ts +9 -0
  44. package/src/modules/userInterfaceModule/userInterfaceModule.js +16 -0
  45. package/src/modules/walletsModule/embeddedWalletsModule/embeddedWalletsModule.cjs +29 -0
  46. package/src/modules/walletsModule/embeddedWalletsModule/embeddedWalletsModule.d.ts +6 -0
  47. package/src/modules/walletsModule/embeddedWalletsModule/embeddedWalletsModule.js +25 -0
  48. package/src/modules/walletsModule/embeddedWalletsModule/index.d.ts +1 -0
  49. package/src/modules/walletsModule/walletsModule.cjs +13 -1
  50. package/src/modules/walletsModule/walletsModule.d.ts +9 -2
  51. package/src/modules/walletsModule/walletsModule.js +14 -2
  52. package/src/utils/addProperty/addProperty.cjs +21 -0
  53. package/src/utils/addProperty/addProperty.d.ts +13 -0
  54. package/src/utils/addProperty/addProperty.js +17 -0
  55. package/src/utils/addProperty/index.d.ts +1 -0
  56. package/src/utils/logger/index.d.ts +1 -0
  57. package/src/utils/logger/logger.cjs +10 -0
  58. package/src/utils/logger/logger.d.ts +2 -0
  59. package/src/utils/logger/logger.js +6 -0
  60. /package/src/{modules/sdkModule → client/core/modules/manifestModule/utils}/manifest/index.d.ts +0 -0
package/CHANGELOG.md CHANGED
@@ -1,4 +1,172 @@
1
1
 
2
+ ## [2.1.0-alpha.20](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.19...v2.1.0-alpha.20) (2024-05-21)
3
+
4
+
5
+ ### Features
6
+
7
+ * adds client.networks module ([#5650](https://github.com/dynamic-labs/DynamicAuth/issues/5650)) ([70f7fe5](https://github.com/dynamic-labs/DynamicAuth/commit/70f7fe5f437756c51e787ac12183be0a23c51b89))
8
+ * user fields supports custom fields ([#5639](https://github.com/dynamic-labs/DynamicAuth/issues/5639)) ([8eb5788](https://github.com/dynamic-labs/DynamicAuth/commit/8eb5788fc3e1286929f5949ecb57736b21b13fb5))
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * add webcredentials to expo ([#5640](https://github.com/dynamic-labs/DynamicAuth/issues/5640)) ([9026fbf](https://github.com/dynamic-labs/DynamicAuth/commit/9026fbf0108537e884588f3adcdb9f0db04a159b))
14
+ * init ethers web3provider without a network if selected network is unsupported ([#5651](https://github.com/dynamic-labs/DynamicAuth/issues/5651)) ([e82040f](https://github.com/dynamic-labs/DynamicAuth/commit/e82040f424b17a70fac4400ab5b85a0dc6c0e35a))
15
+
16
+ ## [2.1.0-alpha.19](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.18...v2.1.0-alpha.19) (2024-05-17)
17
+
18
+
19
+ ### Features
20
+
21
+ * add createUserProfileFromSDKUser ([#5596](https://github.com/dynamic-labs/DynamicAuth/issues/5596)) ([d37a1b4](https://github.com/dynamic-labs/DynamicAuth/commit/d37a1b4119f5ff4fff1e987d157f6d5abf105a8b))
22
+ * add headless social sign-in ([#5439](https://github.com/dynamic-labs/DynamicAuth/issues/5439)) ([e32fdf8](https://github.com/dynamic-labs/DynamicAuth/commit/e32fdf863718d661b90b592c8df734e92386ddf3))
23
+ * fetch custom fields in profile and update user ([#5627](https://github.com/dynamic-labs/DynamicAuth/issues/5627)) ([3940c25](https://github.com/dynamic-labs/DynamicAuth/commit/3940c2542bb330f3ed9a8eb98eed9d05c8fcb03a))
24
+
25
+
26
+ ### Bug Fixes
27
+
28
+ * include applinks details to AASA ([#5635](https://github.com/dynamic-labs/DynamicAuth/issues/5635)) ([ce94fec](https://github.com/dynamic-labs/DynamicAuth/commit/ce94fec80adbb3eb4efcb79d1aa2cc6eb35eab6f))
29
+ * include the appOrigin to every api call to create correct passkey ([#5636](https://github.com/dynamic-labs/DynamicAuth/issues/5636)) ([ee64df3](https://github.com/dynamic-labs/DynamicAuth/commit/ee64df3b90037bd29cca161e601973ef202c58f0))
30
+ * use PromptModal when using the DynamicMultiWalletPromptsWidget for pending connection views ([#5594](https://github.com/dynamic-labs/DynamicAuth/issues/5594)) ([c095b6e](https://github.com/dynamic-labs/DynamicAuth/commit/c095b6e4c974f02cfe632963be92d16bb201dfa5))
31
+
32
+ ## [2.1.0-alpha.18](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.17...v2.1.0-alpha.18) (2024-05-15)
33
+
34
+ ## [2.1.0-alpha.17](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.16...v2.1.0-alpha.17) (2024-05-15)
35
+
36
+
37
+ ### Features
38
+
39
+ * add coinbaseWalletPreference prop ([#5607](https://github.com/dynamic-labs/DynamicAuth/issues/5607)) ([1ac3b2c](https://github.com/dynamic-labs/DynamicAuth/commit/1ac3b2ce7abb136465f4aa88b045dfb70d99aad7))
40
+
41
+ ## [2.1.0-alpha.16](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.15...v2.1.0-alpha.16) (2024-05-14)
42
+
43
+
44
+ ### Features
45
+
46
+ * add client.sdk.error with errors from the webview ([#5520](https://github.com/dynamic-labs/DynamicAuth/issues/5520)) ([a886927](https://github.com/dynamic-labs/DynamicAuth/commit/a8869273bf361c870d6e3cb82a28d9ccec65905b))
47
+ * add setDefaultTabIndex to default the selected wallets tab ([#5593](https://github.com/dynamic-labs/DynamicAuth/issues/5593)) ([6e8ce05](https://github.com/dynamic-labs/DynamicAuth/commit/6e8ce053c4f6f009acc57dac55a8e9c74fbcc73b))
48
+ * add visibility/auth-flow/user-profile to react-native ([#5564](https://github.com/dynamic-labs/DynamicAuth/issues/5564)) ([d93cea8](https://github.com/dynamic-labs/DynamicAuth/commit/d93cea82a123c6ec4d3d594a7dc064f4db2981c2))
49
+
50
+ ## [2.1.0-alpha.15](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.14...v2.1.0-alpha.15) (2024-05-13)
51
+
52
+
53
+ ### Bug Fixes
54
+
55
+ * when a pregen is created, primaryWallet is not being setup ([#5584](https://github.com/dynamic-labs/DynamicAuth/issues/5584)) ([de08721](https://github.com/dynamic-labs/DynamicAuth/commit/de0872151e09f91dcbfaf1d043cf830f9df8d799))
56
+
57
+ ## [2.1.0-alpha.14](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.13...v2.1.0-alpha.14) (2024-05-09)
58
+
59
+
60
+ ### Features
61
+
62
+ * add useSwitchWallet ([#5575](https://github.com/dynamic-labs/DynamicAuth/issues/5575)) ([d3053d9](https://github.com/dynamic-labs/DynamicAuth/commit/d3053d920110c26ef8052e77bf59e07dedc7c683))
63
+
64
+
65
+ ### Bug Fixes
66
+
67
+ * linking phantom wallets in mobile ([#5524](https://github.com/dynamic-labs/DynamicAuth/issues/5524)) ([28d90f5](https://github.com/dynamic-labs/DynamicAuth/commit/28d90f5126b9c22535b63a3797cc060ef089fc63))
68
+ * only show farcaster QR code if Social Login is enabled ([#5559](https://github.com/dynamic-labs/DynamicAuth/issues/5559)) ([fa71aaf](https://github.com/dynamic-labs/DynamicAuth/commit/fa71aaf0f80da31d397600b2fd0cbea99b3689a4))
69
+ * remove goerli testnets and add sepolia ([#5565](https://github.com/dynamic-labs/DynamicAuth/issues/5565)) ([888eb03](https://github.com/dynamic-labs/DynamicAuth/commit/888eb031ef6f4dbbdc3015265cce8647d2c720b0))
70
+
71
+ ## [2.1.0-alpha.13](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.12...v2.1.0-alpha.13) (2024-05-03)
72
+
73
+
74
+ ### Bug Fixes
75
+
76
+ * ensure Farcaster QR uses useSocialAuth hook ([#5550](https://github.com/dynamic-labs/DynamicAuth/issues/5550)) ([57fcd97](https://github.com/dynamic-labs/DynamicAuth/commit/57fcd97c44e3f52065dcf856acf7bca7b24fabc7))
77
+
78
+ ## [2.1.0-alpha.12](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.11...v2.1.0-alpha.12) (2024-05-02)
79
+
80
+
81
+ ### Features
82
+
83
+ * display Farcaster QR code when it is the only login option ([#5514](https://github.com/dynamic-labs/DynamicAuth/issues/5514)) ([7b166d9](https://github.com/dynamic-labs/DynamicAuth/commit/7b166d9a30c581746f0e2edb71c44fc015dc128e))
84
+
85
+ ## [2.1.0-alpha.11](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.10...v2.1.0-alpha.11) (2024-05-02)
86
+
87
+
88
+ ### Features
89
+
90
+ * **GVTY-1050:** add account token balances hook ([#5521](https://github.com/dynamic-labs/DynamicAuth/issues/5521)) ([5a6f937](https://github.com/dynamic-labs/DynamicAuth/commit/5a6f93733019f3b8d5c7a2c7a5537172a1e7eba4))
91
+ * headless reveal embedded wallet key ([#5518](https://github.com/dynamic-labs/DynamicAuth/issues/5518)) ([77c1536](https://github.com/dynamic-labs/DynamicAuth/commit/77c15360b2b28c52cbdeafb3ce8ca7e80dbecf57))
92
+
93
+
94
+ ### Bug Fixes
95
+
96
+ * fallback to walletconnect for zerion on mobile ([#5536](https://github.com/dynamic-labs/DynamicAuth/issues/5536)) ([f0e5bfe](https://github.com/dynamic-labs/DynamicAuth/commit/f0e5bfea0b2ab271fd4c1475c8ce708ecb1a5926))
97
+
98
+ ## [2.1.0-alpha.10](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.9...v2.1.0-alpha.10) (2024-04-30)
99
+
100
+
101
+ ### Features
102
+
103
+ * bump @coinbase/wallet-sdk to latest beta ([#5388](https://github.com/dynamic-labs/DynamicAuth/issues/5388)) ([9225546](https://github.com/dynamic-labs/DynamicAuth/commit/922554630ccf2ef98bc297521309918f922bc671))
104
+
105
+ ## [2.1.0-alpha.9](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.8...v2.1.0-alpha.9) (2024-04-30)
106
+
107
+
108
+ ### Features
109
+
110
+ * headless create embedded wallet with optional passkey data parameter ([#5487](https://github.com/dynamic-labs/DynamicAuth/issues/5487)) ([891c3d7](https://github.com/dynamic-labs/DynamicAuth/commit/891c3d77a02a019140bcb8dd03b62b1afd69710e))
111
+
112
+ ## [2.1.0-alpha.8](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.7...v2.1.0-alpha.8) (2024-04-26)
113
+
114
+
115
+ ### Bug Fixes
116
+
117
+ * display wallet tabs when linking a wallet ([#5491](https://github.com/dynamic-labs/DynamicAuth/issues/5491)) ([10fd6b4](https://github.com/dynamic-labs/DynamicAuth/commit/10fd6b4d9aec7596338c50e17f79f6be534cf2c1))
118
+ * ensure zerodev viem client handles eth_accounts call ([#5477](https://github.com/dynamic-labs/DynamicAuth/issues/5477)) ([1132e1e](https://github.com/dynamic-labs/DynamicAuth/commit/1132e1e8655b58e81cb56789453ba56a059f52ec))
119
+ * network with keplr ([#5485](https://github.com/dynamic-labs/DynamicAuth/issues/5485)) ([b86f2fc](https://github.com/dynamic-labs/DynamicAuth/commit/b86f2fce491f9752e80a86643916da9ac7fb9276))
120
+ * refetch nameservice data and display properly ([#5476](https://github.com/dynamic-labs/DynamicAuth/issues/5476)) ([2aee798](https://github.com/dynamic-labs/DynamicAuth/commit/2aee798846f69496201bec7aa52e7ec1f370b7c3))
121
+ * use embeddedWallet create response authToken in embeddedWalletCreated ([#5478](https://github.com/dynamic-labs/DynamicAuth/issues/5478)) ([51772da](https://github.com/dynamic-labs/DynamicAuth/commit/51772daf557a72984c757efd8301e2b510dc37f1))
122
+
123
+ ## [2.1.0-alpha.7](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.6...v2.1.0-alpha.7) (2024-04-25)
124
+
125
+
126
+ ### Bug Fixes
127
+
128
+ * restore embedded wallet session iframe element conflict ([#5474](https://github.com/dynamic-labs/DynamicAuth/issues/5474)) ([c157477](https://github.com/dynamic-labs/DynamicAuth/commit/c157477ea126b3130b13b711796bdd06215e7af1))
129
+
130
+ ## [2.1.0-alpha.6](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.5...v2.1.0-alpha.6) (2024-04-24)
131
+
132
+
133
+ ### Bug Fixes
134
+
135
+ * embedded wallets headless session control fixes ([#5469](https://github.com/dynamic-labs/DynamicAuth/issues/5469)) ([92e6c35](https://github.com/dynamic-labs/DynamicAuth/commit/92e6c359d2710fd4f5f5a6fedc4acf6c4bab78ba))
136
+
137
+ ## [2.1.0-alpha.5](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.4...v2.1.0-alpha.5) (2024-04-23)
138
+
139
+
140
+ ### Bug Fixes
141
+
142
+ * get embedded wallet checking the wrong chain enum ([#5458](https://github.com/dynamic-labs/DynamicAuth/issues/5458)) ([ed1c523](https://github.com/dynamic-labs/DynamicAuth/commit/ed1c523ca14cd4d21c00181ab40802f876c02b80))
143
+
144
+ ## [2.1.0-alpha.4](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.3...v2.1.0-alpha.4) (2024-04-23)
145
+
146
+
147
+ ### Features
148
+
149
+ * add email and sms to client auth module ([#5436](https://github.com/dynamic-labs/DynamicAuth/issues/5436)) ([5420476](https://github.com/dynamic-labs/DynamicAuth/commit/5420476d1ba38fd4f987f28e9aefbfb3e61ea2bf))
150
+ * headless create passkeys for embedded wallets ([#5395](https://github.com/dynamic-labs/DynamicAuth/issues/5395)) ([0b64099](https://github.com/dynamic-labs/DynamicAuth/commit/0b6409968457f65886248f0a0879e39ec3803fd0))
151
+
152
+
153
+ ### Bug Fixes
154
+
155
+ * prevent wagmi from reconnect when DynamicContextProvider rerender ([#5446](https://github.com/dynamic-labs/DynamicAuth/issues/5446)) ([33337af](https://github.com/dynamic-labs/DynamicAuth/commit/33337af76786963cb3db7fa7c58c1292c529d0ac))
156
+
157
+ ## [2.1.0-alpha.3](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.2...v2.1.0-alpha.3) (2024-04-23)
158
+
159
+
160
+ ### Features
161
+
162
+ * add merge user accounts flow ([#5429](https://github.com/dynamic-labs/DynamicAuth/issues/5429)) ([41d4239](https://github.com/dynamic-labs/DynamicAuth/commit/41d423906625e28004ba8f20baf57847ed8bf5d0))
163
+
164
+
165
+ ### Bug Fixes
166
+
167
+ * disconnect wallet on lock in connect-only ([#5422](https://github.com/dynamic-labs/DynamicAuth/issues/5422)) ([a26f9fe](https://github.com/dynamic-labs/DynamicAuth/commit/a26f9fe93cf8568f1482e10b831de98c77fb2a2d))
168
+ * useReactiveProxy to stop proxing when it finds a reactive value ([#5428](https://github.com/dynamic-labs/DynamicAuth/issues/5428)) ([838dce9](https://github.com/dynamic-labs/DynamicAuth/commit/838dce9ee953361e41772239a91adb1dd8d40234))
169
+
2
170
  ## [2.1.0-alpha.2](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.1...v2.1.0-alpha.2) (2024-04-19)
3
171
 
4
172
 
package/package.cjs CHANGED
@@ -3,6 +3,6 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var version = "2.1.0-alpha.2";
6
+ var version = "2.1.0-alpha.20";
7
7
 
8
8
  exports.version = version;
package/package.js CHANGED
@@ -1,4 +1,4 @@
1
1
  'use client'
2
- var version = "2.1.0-alpha.2";
2
+ var version = "2.1.0-alpha.20";
3
3
 
4
4
  export { version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/client",
3
- "version": "2.1.0-alpha.2",
3
+ "version": "2.1.0-alpha.20",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/dynamic-labs/DynamicAuth.git",
@@ -26,10 +26,12 @@
26
26
  "./package.json": "./package.json"
27
27
  },
28
28
  "dependencies": {
29
- "@dynamic-labs/message-transport": "2.1.0-alpha.2"
29
+ "@dynamic-labs/message-transport": "2.1.0-alpha.20",
30
+ "@vue/reactivity": "3.4.21"
30
31
  },
31
32
  "peerDependencies": {
32
- "@dynamic-labs/types": "2.1.0-alpha.2",
33
+ "@dynamic-labs/logger": "2.1.0-alpha.20",
34
+ "@dynamic-labs/types": "2.1.0-alpha.20",
33
35
  "eventemitter3": "5.0.1"
34
36
  }
35
37
  }
@@ -4,7 +4,9 @@
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
6
  var authModule = require('../modules/authModule/authModule.cjs');
7
+ var networksModule = require('../modules/networksModule/networksModule.cjs');
7
8
  var sdkModule = require('../modules/sdkModule/sdkModule.cjs');
9
+ var userInterfaceModule = require('../modules/userInterfaceModule/userInterfaceModule.cjs');
8
10
  var walletsModule = require('../modules/walletsModule/walletsModule.cjs');
9
11
  var Extendable = require('../utils/Extendable/Extendable.cjs');
10
12
  var core = require('./core/core.cjs');
@@ -17,13 +19,17 @@ var core = require('./core/core.cjs');
17
19
  * it will be used for.
18
20
  */
19
21
  const createClient = (props) => {
20
- const core$1 = core.createCore();
22
+ const core$1 = core.createCore(props);
21
23
  const baseExtendable = new Extendable.Extendable(core$1);
22
24
  return baseExtendable.extend(() => ({
23
25
  /** Module that gives access over authentication state, such as the auth token and user */
24
26
  auth: authModule.createAuthModule(core$1),
27
+ /** Module that provides all the networks configured */
28
+ networks: networksModule.createNetworksModule(core$1),
25
29
  /** Module that gives insight over the state of the SDK */
26
- sdk: sdkModule.createSdkModule(core$1, props),
30
+ sdk: sdkModule.createSdkModule(core$1),
31
+ /** Module that provide access to UI features */
32
+ ui: userInterfaceModule.createUserInterfaceModule(core$1),
27
33
  /** Module that provides access to user's wallets */
28
34
  wallets: walletsModule.createWalletsModule(core$1),
29
35
  }));
@@ -17,8 +17,19 @@ export type ClientProps = {
17
17
  export declare const createClient: (props: ClientProps) => {
18
18
  /** Module that gives access over authentication state, such as the auth token and user */
19
19
  auth: import("../modules/authModule").AuthModule;
20
+ /** Module that provides all the networks configured */
21
+ networks: import("dist/packages/message-transport/src").StoreStateGetters<import("dist/packages/message-transport/src").NetworksModuleState> & Pick<import("eventemitter3").EventEmitter<import("dist/packages/message-transport/src").StoreStateEvents<import("dist/packages/message-transport/src").NetworksModuleState>, any>, "on" | "off" | "once">;
20
22
  /** Module that gives insight over the state of the SDK */
21
23
  sdk: import("../modules/sdkModule").SdkModule;
24
+ /** Module that provide access to UI features */
25
+ ui: {
26
+ auth: {
27
+ show: () => void;
28
+ };
29
+ userProfile: {
30
+ show: () => void;
31
+ };
32
+ };
22
33
  /** Module that provides access to user's wallets */
23
34
  wallets: import("../modules/walletsModule").WalletsModule;
24
35
  } & Extendable;
@@ -1,6 +1,8 @@
1
1
  'use client'
2
2
  import { createAuthModule } from '../modules/authModule/authModule.js';
3
+ import { createNetworksModule } from '../modules/networksModule/networksModule.js';
3
4
  import { createSdkModule } from '../modules/sdkModule/sdkModule.js';
5
+ import { createUserInterfaceModule } from '../modules/userInterfaceModule/userInterfaceModule.js';
4
6
  import { createWalletsModule } from '../modules/walletsModule/walletsModule.js';
5
7
  import { Extendable } from '../utils/Extendable/Extendable.js';
6
8
  import { createCore } from './core/core.js';
@@ -13,13 +15,17 @@ import { createCore } from './core/core.js';
13
15
  * it will be used for.
14
16
  */
15
17
  const createClient = (props) => {
16
- const core = createCore();
18
+ const core = createCore(props);
17
19
  const baseExtendable = new Extendable(core);
18
20
  return baseExtendable.extend(() => ({
19
21
  /** Module that gives access over authentication state, such as the auth token and user */
20
22
  auth: createAuthModule(core),
23
+ /** Module that provides all the networks configured */
24
+ networks: createNetworksModule(core),
21
25
  /** Module that gives insight over the state of the SDK */
22
- sdk: createSdkModule(core, props),
26
+ sdk: createSdkModule(core),
27
+ /** Module that provide access to UI features */
28
+ ui: createUserInterfaceModule(core),
23
29
  /** Module that provides access to user's wallets */
24
30
  wallets: createWalletsModule(core),
25
31
  }));
@@ -4,6 +4,8 @@
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
6
  var messageTransport$1 = require('@dynamic-labs/message-transport');
7
+ var initializationModule = require('./modules/initializationModule/initializationModule.cjs');
8
+ var manifestModule = require('./modules/manifestModule/manifestModule.cjs');
7
9
 
8
10
  const messageTransport = messageTransport$1.applyDefaultMessageOrigin({
9
11
  defaultOrigin: 'host',
@@ -17,7 +19,7 @@ const messageTransport = messageTransport$1.applyDefaultMessageOrigin({
17
19
  // messageTransport.on((message) =>
18
20
  // console.log('message', JSON.stringify(message, null, 2)),
19
21
  // );
20
- const createCore = () => ({
22
+ const createCore = (props) => ({
21
23
  /**
22
24
  * Allows an extension to add its name to the list, such that
23
25
  * other extensions are able to detect if it is present.
@@ -26,6 +28,14 @@ const createCore = () => ({
26
28
  * checks this list and throws an error if it doesn't find "viem" there.
27
29
  */
28
30
  declaredExtensionNames: [],
31
+ /**
32
+ * SDK initialization module handles the initialization error
33
+ */
34
+ initialization: initializationModule.createInitializationModule(messageTransport),
35
+ /**
36
+ * Manages the manifest of the host
37
+ */
38
+ manifest: manifestModule.createManifestModule(props, messageTransport),
29
39
  /**
30
40
  * Message transport that will be used to send and receive messages to the webview.
31
41
  * Should preferably be used with createRequestChannel, rather than used directly.
@@ -1,9 +1,10 @@
1
+ import { ClientProps } from '../client';
1
2
  /**
2
3
  * Holds properties and methods used by client extensions, but that we don't
3
4
  * want users to have access to.
4
5
  */
5
6
  export type Core = ReturnType<typeof createCore>;
6
- export declare const createCore: () => {
7
+ export declare const createCore: (props: ClientProps) => {
7
8
  /**
8
9
  * Allows an extension to add its name to the list, such that
9
10
  * other extensions are able to detect if it is present.
@@ -12,6 +13,19 @@ export declare const createCore: () => {
12
13
  * checks this list and throws an error if it doesn't find "viem" there.
13
14
  */
14
15
  declaredExtensionNames: string[];
16
+ /**
17
+ * SDK initialization module handles the initialization error
18
+ */
19
+ initialization: {
20
+ get error(): Error | null;
21
+ set error(error: Error);
22
+ };
23
+ /**
24
+ * Manages the manifest of the host
25
+ */
26
+ manifest: {
27
+ setAppOrigin: (appOrigin: string) => string;
28
+ };
15
29
  /**
16
30
  * Message transport that will be used to send and receive messages to the webview.
17
31
  * Should preferably be used with createRequestChannel, rather than used directly.
@@ -25,7 +39,7 @@ export declare const createCore: () => {
25
39
  off: (callback: import("@dynamic-labs/message-transport").MessageTransportCallback) => void;
26
40
  on: (callback: import("@dynamic-labs/message-transport").MessageTransportCallback) => void;
27
41
  } & {
28
- defaultOrigin: "host" | "webview";
42
+ defaultOrigin: "webview" | "host";
29
43
  emit: (message: import("@dynamic-labs/message-transport").MessageTransportDataOptionalOrigin) => void;
30
44
  };
31
45
  };
@@ -1,5 +1,7 @@
1
1
  'use client'
2
2
  import { applyDefaultMessageOrigin, makeWaitForInitEvent, sdkHasLoadedEventName, createMessageTransport } from '@dynamic-labs/message-transport';
3
+ import { createInitializationModule } from './modules/initializationModule/initializationModule.js';
4
+ import { createManifestModule } from './modules/manifestModule/manifestModule.js';
3
5
 
4
6
  const messageTransport = applyDefaultMessageOrigin({
5
7
  defaultOrigin: 'host',
@@ -13,7 +15,7 @@ const messageTransport = applyDefaultMessageOrigin({
13
15
  // messageTransport.on((message) =>
14
16
  // console.log('message', JSON.stringify(message, null, 2)),
15
17
  // );
16
- const createCore = () => ({
18
+ const createCore = (props) => ({
17
19
  /**
18
20
  * Allows an extension to add its name to the list, such that
19
21
  * other extensions are able to detect if it is present.
@@ -22,6 +24,14 @@ const createCore = () => ({
22
24
  * checks this list and throws an error if it doesn't find "viem" there.
23
25
  */
24
26
  declaredExtensionNames: [],
27
+ /**
28
+ * SDK initialization module handles the initialization error
29
+ */
30
+ initialization: createInitializationModule(messageTransport),
31
+ /**
32
+ * Manages the manifest of the host
33
+ */
34
+ manifest: createManifestModule(props, messageTransport),
25
35
  /**
26
36
  * Message transport that will be used to send and receive messages to the webview.
27
37
  * Should preferably be used with createRequestChannel, rather than used directly.
@@ -0,0 +1 @@
1
+ export { createInitializationModule } from './initializationModule';
@@ -0,0 +1,33 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var reactivity = require('@vue/reactivity');
7
+ var messageTransport = require('@dynamic-labs/message-transport');
8
+ var logger = require('../../../../utils/logger/logger.cjs');
9
+
10
+ const createInitializationModule = (messageTransport$1) => {
11
+ const consoleRequestChannel = messageTransport.createRequestChannel(messageTransport$1);
12
+ const state = reactivity.reactive({
13
+ error: null,
14
+ });
15
+ consoleRequestChannel.handle('error', (serializedError, { severity }) => {
16
+ const error = messageTransport.parseErrorFromTransport(serializedError);
17
+ if (severity === 'fatal') {
18
+ state.error = error;
19
+ }
20
+ logger.logger.error(error);
21
+ });
22
+ return {
23
+ get error() {
24
+ return state.error;
25
+ },
26
+ set error(error) {
27
+ state.error = error;
28
+ logger.logger.error(state.error);
29
+ },
30
+ };
31
+ };
32
+
33
+ exports.createInitializationModule = createInitializationModule;
@@ -0,0 +1,5 @@
1
+ import { MessageTransportWithDefaultOrigin } from '@dynamic-labs/message-transport';
2
+ export declare const createInitializationModule: (messageTransport: MessageTransportWithDefaultOrigin) => {
3
+ get error(): Error | null;
4
+ set error(error: Error);
5
+ };
@@ -0,0 +1,29 @@
1
+ 'use client'
2
+ import { reactive } from '@vue/reactivity';
3
+ import { createRequestChannel, parseErrorFromTransport } from '@dynamic-labs/message-transport';
4
+ import { logger } from '../../../../utils/logger/logger.js';
5
+
6
+ const createInitializationModule = (messageTransport) => {
7
+ const consoleRequestChannel = createRequestChannel(messageTransport);
8
+ const state = reactive({
9
+ error: null,
10
+ });
11
+ consoleRequestChannel.handle('error', (serializedError, { severity }) => {
12
+ const error = parseErrorFromTransport(serializedError);
13
+ if (severity === 'fatal') {
14
+ state.error = error;
15
+ }
16
+ logger.error(error);
17
+ });
18
+ return {
19
+ get error() {
20
+ return state.error;
21
+ },
22
+ set error(error) {
23
+ state.error = error;
24
+ logger.error(state.error);
25
+ },
26
+ };
27
+ };
28
+
29
+ export { createInitializationModule };
@@ -0,0 +1 @@
1
+ export { createManifestModule } from './manifestModule';
@@ -0,0 +1,22 @@
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
+ var manifest = require('./utils/manifest/manifest.cjs');
9
+
10
+ /**
11
+ * Manifest module handles the client manifest that will be requested by the webview
12
+ */
13
+ const createManifestModule = (props, messageTransport$1) => {
14
+ const requestChannel = messageTransport.createRequestChannel(messageTransport$1);
15
+ const manifest$1 = manifest.createManifest(props);
16
+ requestChannel.handle('manifest', () => _tslib.__awaiter(void 0, void 0, void 0, function* () { return manifest$1; }));
17
+ return {
18
+ setAppOrigin: (appOrigin) => (manifest$1.appOrigin = appOrigin),
19
+ };
20
+ };
21
+
22
+ exports.createManifestModule = createManifestModule;
@@ -0,0 +1,8 @@
1
+ import { MessageTransportWithDefaultOrigin } from '@dynamic-labs/message-transport';
2
+ import { ClientProps } from '../../../client';
3
+ /**
4
+ * Manifest module handles the client manifest that will be requested by the webview
5
+ */
6
+ export declare const createManifestModule: (props: ClientProps, messageTransport: MessageTransportWithDefaultOrigin) => {
7
+ setAppOrigin: (appOrigin: string) => string;
8
+ };
@@ -0,0 +1,18 @@
1
+ 'use client'
2
+ import { __awaiter } from '../../../../../_virtual/_tslib.js';
3
+ import { createRequestChannel } from '@dynamic-labs/message-transport';
4
+ import { createManifest } from './utils/manifest/manifest.js';
5
+
6
+ /**
7
+ * Manifest module handles the client manifest that will be requested by the webview
8
+ */
9
+ const createManifestModule = (props, messageTransport) => {
10
+ const requestChannel = createRequestChannel(messageTransport);
11
+ const manifest = createManifest(props);
12
+ requestChannel.handle('manifest', () => __awaiter(void 0, void 0, void 0, function* () { return manifest; }));
13
+ return {
14
+ setAppOrigin: (appOrigin) => (manifest.appOrigin = appOrigin),
15
+ };
16
+ };
17
+
18
+ export { createManifestModule };
@@ -3,7 +3,7 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var _package = require('../../../../package.cjs');
6
+ var _package = require('../../../../../../../package.cjs');
7
7
 
8
8
  const createManifest = ({ apiBaseUrl, environmentId, appLogoUrl, appName, cssOverrides, }) => ({
9
9
  apiBaseUrl,
@@ -1,3 +1,3 @@
1
1
  import type { ClientManifest } from '@dynamic-labs/message-transport';
2
- import type { ClientProps } from '../../../client';
2
+ import type { ClientProps } from '../../../../..';
3
3
  export declare const createManifest: ({ apiBaseUrl, environmentId, appLogoUrl, appName, cssOverrides, }: ClientProps) => ClientManifest;
@@ -1,5 +1,5 @@
1
1
  'use client'
2
- import { version } from '../../../../package.js';
2
+ import { version } from '../../../../../../../package.js';
3
3
 
4
4
  const createManifest = ({ apiBaseUrl, environmentId, appLogoUrl, appName, cssOverrides, }) => ({
5
5
  apiBaseUrl,
package/src/index.d.ts CHANGED
@@ -1,6 +1,8 @@
1
+ import { BaseWallet } from '@dynamic-labs/types';
1
2
  export { type Core } from './client/core';
2
3
  export { Extendable, type Extension } from './utils/Extendable';
3
4
  export { createClient, type BaseClient, type ClientProps } from './client';
4
5
  export type { AuthModule } from './modules/authModule';
5
6
  export type { SdkModule } from './modules/sdkModule';
6
7
  export type { WalletsModule } from './modules/walletsModule';
8
+ export type Wallet = BaseWallet;
@@ -5,6 +5,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
6
  var messageTransport = require('@dynamic-labs/message-transport');
7
7
  var pickListenerActions = require('../../utils/pickListenerActions/pickListenerActions.cjs');
8
+ var smsAuthModule = require('./smsAuthModule/smsAuthModule.cjs');
9
+ var emailAuthModule = require('./emailAuthModule/emailAuthModule.cjs');
8
10
 
9
11
  const createAuthModule = (core) => {
10
12
  const store = messageTransport.createStore({
@@ -22,7 +24,9 @@ const createAuthModule = (core) => {
22
24
  });
23
25
  const requestChannel = messageTransport.createRequestChannel(core.messageTransport);
24
26
  return Object.assign(store.getters, pickListenerActions.pickListenerActions(messageEvents), {
27
+ email: emailAuthModule.createEmailAuthModule(core),
25
28
  logout: () => requestChannel.request('logout'),
29
+ sms: smsAuthModule.createSmsAuthModule(core),
26
30
  });
27
31
  };
28
32
 
@@ -1,4 +1,11 @@
1
1
  import { AuthModuleMessages, AuthModuleState, StoreEventListeners } from '@dynamic-labs/message-transport';
2
2
  import { Core } from '../../client/core';
3
- export type AuthModule = AuthModuleState & StoreEventListeners<AuthModuleState> & Pick<AuthModuleMessages, 'logout'>;
3
+ import { SmsAuthModule } from './smsAuthModule';
4
+ import { EmailAuthModule } from './emailAuthModule';
5
+ type PublicAuthModuleMessages = Pick<AuthModuleMessages, 'logout'>;
6
+ export type AuthModule = AuthModuleState & StoreEventListeners<AuthModuleState> & PublicAuthModuleMessages & {
7
+ sms: SmsAuthModule;
8
+ email: EmailAuthModule;
9
+ };
4
10
  export declare const createAuthModule: (core: Core) => AuthModule;
11
+ export {};
@@ -1,6 +1,8 @@
1
1
  'use client'
2
2
  import { createStore, createEventEmitterForMessages, createRequestChannel } from '@dynamic-labs/message-transport';
3
3
  import { pickListenerActions } from '../../utils/pickListenerActions/pickListenerActions.js';
4
+ import { createSmsAuthModule } from './smsAuthModule/smsAuthModule.js';
5
+ import { createEmailAuthModule } from './emailAuthModule/emailAuthModule.js';
4
6
 
5
7
  const createAuthModule = (core) => {
6
8
  const store = createStore({
@@ -18,7 +20,9 @@ const createAuthModule = (core) => {
18
20
  });
19
21
  const requestChannel = createRequestChannel(core.messageTransport);
20
22
  return Object.assign(store.getters, pickListenerActions(messageEvents), {
23
+ email: createEmailAuthModule(core),
21
24
  logout: () => requestChannel.request('logout'),
25
+ sms: createSmsAuthModule(core),
22
26
  });
23
27
  };
24
28
 
@@ -0,0 +1,17 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var messageTransport = require('@dynamic-labs/message-transport');
7
+
8
+ const createEmailAuthModule = (core) => {
9
+ const requestChannel = messageTransport.createRequestChannel(core.messageTransport);
10
+ return {
11
+ resendOTP: () => requestChannel.request('resendOTP'),
12
+ sendOTP: (target) => requestChannel.request('sendOTP', { destination: 'email', target }),
13
+ verifyOTP: (token) => requestChannel.request('verifyOTP', token),
14
+ };
15
+ };
16
+
17
+ exports.createEmailAuthModule = createEmailAuthModule;
@@ -0,0 +1,7 @@
1
+ import { Core } from '../../../client/core';
2
+ export declare const createEmailAuthModule: (core: Core) => {
3
+ resendOTP: () => Promise<void>;
4
+ sendOTP: (target: string) => Promise<void>;
5
+ verifyOTP: (token: string) => Promise<void>;
6
+ };
7
+ export type EmailAuthModule = ReturnType<typeof createEmailAuthModule>;
@@ -0,0 +1,13 @@
1
+ 'use client'
2
+ import { createRequestChannel } from '@dynamic-labs/message-transport';
3
+
4
+ const createEmailAuthModule = (core) => {
5
+ const requestChannel = createRequestChannel(core.messageTransport);
6
+ return {
7
+ resendOTP: () => requestChannel.request('resendOTP'),
8
+ sendOTP: (target) => requestChannel.request('sendOTP', { destination: 'email', target }),
9
+ verifyOTP: (token) => requestChannel.request('verifyOTP', token),
10
+ };
11
+ };
12
+
13
+ export { createEmailAuthModule };
@@ -0,0 +1 @@
1
+ export { createEmailAuthModule, type EmailAuthModule } from './emailAuthModule';
@@ -0,0 +1 @@
1
+ export { createSmsAuthModule, type SmsAuthModule } from './smsAuthModule';
@@ -0,0 +1,17 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var messageTransport = require('@dynamic-labs/message-transport');
7
+
8
+ const createSmsAuthModule = (core) => {
9
+ const requestChannel = messageTransport.createRequestChannel(core.messageTransport);
10
+ return {
11
+ resendOTP: () => requestChannel.request('resendOTP'),
12
+ sendOTP: (target) => requestChannel.request('sendOTP', { destination: 'sms', target }),
13
+ verifyOTP: (token) => requestChannel.request('verifyOTP', token),
14
+ };
15
+ };
16
+
17
+ exports.createSmsAuthModule = createSmsAuthModule;
@@ -0,0 +1,8 @@
1
+ import { PhoneData } from '@dynamic-labs/types';
2
+ import { Core } from '../../../client/core';
3
+ export declare const createSmsAuthModule: (core: Core) => {
4
+ resendOTP: () => Promise<void>;
5
+ sendOTP: (target: PhoneData) => Promise<void>;
6
+ verifyOTP: (token: string) => Promise<void>;
7
+ };
8
+ export type SmsAuthModule = ReturnType<typeof createSmsAuthModule>;
@@ -0,0 +1,13 @@
1
+ 'use client'
2
+ import { createRequestChannel } from '@dynamic-labs/message-transport';
3
+
4
+ const createSmsAuthModule = (core) => {
5
+ const requestChannel = createRequestChannel(core.messageTransport);
6
+ return {
7
+ resendOTP: () => requestChannel.request('resendOTP'),
8
+ sendOTP: (target) => requestChannel.request('sendOTP', { destination: 'sms', target }),
9
+ verifyOTP: (token) => requestChannel.request('verifyOTP', token),
10
+ };
11
+ };
12
+
13
+ export { createSmsAuthModule };
@@ -0,0 +1 @@
1
+ export { createNetworksModule } from './networksModule';
@@ -0,0 +1,18 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var messageTransport = require('@dynamic-labs/message-transport');
7
+ var pickListenerActions = require('../../utils/pickListenerActions/pickListenerActions.cjs');
8
+
9
+ const createNetworksModule = (core) => {
10
+ const store = messageTransport.createStore({
11
+ initialState: { evm: [] },
12
+ key: 'networks',
13
+ messageTransport: core.messageTransport,
14
+ });
15
+ return Object.assign(store.getters, pickListenerActions.pickListenerActions(store.eventEmitter));
16
+ };
17
+
18
+ exports.createNetworksModule = createNetworksModule;
@@ -0,0 +1,3 @@
1
+ import { NetworksModuleState } from '@dynamic-labs/message-transport';
2
+ import { Core } from '../../client/core';
3
+ export declare const createNetworksModule: (core: Core) => import("@dynamic-labs/message-transport").StoreStateGetters<NetworksModuleState> & Pick<import("eventemitter3").EventEmitter<import("@dynamic-labs/message-transport").StoreStateEvents<NetworksModuleState>, any>, "on" | "off" | "once">;
@@ -0,0 +1,14 @@
1
+ 'use client'
2
+ import { createStore } from '@dynamic-labs/message-transport';
3
+ import { pickListenerActions } from '../../utils/pickListenerActions/pickListenerActions.js';
4
+
5
+ const createNetworksModule = (core) => {
6
+ const store = createStore({
7
+ initialState: { evm: [] },
8
+ key: 'networks',
9
+ messageTransport: core.messageTransport,
10
+ });
11
+ return Object.assign(store.getters, pickListenerActions(store.eventEmitter));
12
+ };
13
+
14
+ export { createNetworksModule };
@@ -3,14 +3,11 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var _tslib = require('../../../_virtual/_tslib.cjs');
7
6
  var messageTransport = require('@dynamic-labs/message-transport');
8
7
  var pickListenerActions = require('../../utils/pickListenerActions/pickListenerActions.cjs');
9
- var manifest = require('./manifest/manifest.cjs');
8
+ var addProperty = require('../../utils/addProperty/addProperty.cjs');
10
9
 
11
- const createSdkModule = (core, props) => {
12
- const requestChannel = messageTransport.createRequestChannel(core.messageTransport);
13
- requestChannel.handle('manifest', () => _tslib.__awaiter(void 0, void 0, void 0, function* () { return manifest.createManifest(props); }));
10
+ const createSdkModule = (core) => {
14
11
  const store = messageTransport.createStore({
15
12
  initialState: {
16
13
  loaded: false,
@@ -18,7 +15,10 @@ const createSdkModule = (core, props) => {
18
15
  key: 'sdk',
19
16
  messageTransport: core.messageTransport,
20
17
  });
21
- return Object.assign(store.getters, pickListenerActions.pickListenerActions(store.eventEmitter));
18
+ const baseModule = Object.assign(store.getters, pickListenerActions.pickListenerActions(store.eventEmitter));
19
+ return addProperty.addProperty(baseModule, 'error', {
20
+ get: () => core.initialization.error,
21
+ });
22
22
  };
23
23
 
24
24
  exports.createSdkModule = createSdkModule;
@@ -1,5 +1,6 @@
1
1
  import { SdkModuleState, StoreEventListeners } from '@dynamic-labs/message-transport';
2
- import type { ClientProps } from '../../client';
3
2
  import { Core } from '../../client/core';
4
- export type SdkModule = SdkModuleState & StoreEventListeners<SdkModuleState>;
5
- export declare const createSdkModule: (core: Core, props: ClientProps) => SdkModule;
3
+ export type SdkModule = SdkModuleState & StoreEventListeners<SdkModuleState> & {
4
+ readonly error: Error | null;
5
+ };
6
+ export declare const createSdkModule: (core: Core) => SdkModule;
@@ -1,12 +1,9 @@
1
1
  'use client'
2
- import { __awaiter } from '../../../_virtual/_tslib.js';
3
- import { createRequestChannel, createStore } from '@dynamic-labs/message-transport';
2
+ import { createStore } from '@dynamic-labs/message-transport';
4
3
  import { pickListenerActions } from '../../utils/pickListenerActions/pickListenerActions.js';
5
- import { createManifest } from './manifest/manifest.js';
4
+ import { addProperty } from '../../utils/addProperty/addProperty.js';
6
5
 
7
- const createSdkModule = (core, props) => {
8
- const requestChannel = createRequestChannel(core.messageTransport);
9
- requestChannel.handle('manifest', () => __awaiter(void 0, void 0, void 0, function* () { return createManifest(props); }));
6
+ const createSdkModule = (core) => {
10
7
  const store = createStore({
11
8
  initialState: {
12
9
  loaded: false,
@@ -14,7 +11,10 @@ const createSdkModule = (core, props) => {
14
11
  key: 'sdk',
15
12
  messageTransport: core.messageTransport,
16
13
  });
17
- return Object.assign(store.getters, pickListenerActions(store.eventEmitter));
14
+ const baseModule = Object.assign(store.getters, pickListenerActions(store.eventEmitter));
15
+ return addProperty(baseModule, 'error', {
16
+ get: () => core.initialization.error,
17
+ });
18
18
  };
19
19
 
20
20
  export { createSdkModule };
@@ -0,0 +1 @@
1
+ export { createUserInterfaceModule } from './userInterfaceModule';
@@ -0,0 +1,20 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var messageTransport = require('@dynamic-labs/message-transport');
7
+
8
+ const createUserInterfaceModule = (core) => {
9
+ const userInterfaceRequestChannel = messageTransport.createRequestChannel(core.messageTransport);
10
+ return {
11
+ auth: {
12
+ show: () => userInterfaceRequestChannel.emit('openAuthFlow'),
13
+ },
14
+ userProfile: {
15
+ show: () => userInterfaceRequestChannel.emit('openUserProfile'),
16
+ },
17
+ };
18
+ };
19
+
20
+ exports.createUserInterfaceModule = createUserInterfaceModule;
@@ -0,0 +1,9 @@
1
+ import { Core } from '../../client/core';
2
+ export declare const createUserInterfaceModule: (core: Core) => {
3
+ auth: {
4
+ show: () => void;
5
+ };
6
+ userProfile: {
7
+ show: () => void;
8
+ };
9
+ };
@@ -0,0 +1,16 @@
1
+ 'use client'
2
+ import { createRequestChannel } from '@dynamic-labs/message-transport';
3
+
4
+ const createUserInterfaceModule = (core) => {
5
+ const userInterfaceRequestChannel = createRequestChannel(core.messageTransport);
6
+ return {
7
+ auth: {
8
+ show: () => userInterfaceRequestChannel.emit('openAuthFlow'),
9
+ },
10
+ userProfile: {
11
+ show: () => userInterfaceRequestChannel.emit('openUserProfile'),
12
+ },
13
+ };
14
+ };
15
+
16
+ export { createUserInterfaceModule };
@@ -0,0 +1,29 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var messageTransport = require('@dynamic-labs/message-transport');
7
+ var pickListenerActions = require('../../../utils/pickListenerActions/pickListenerActions.cjs');
8
+
9
+ const createEmbeddedWalletsModule = (core) => {
10
+ const store = messageTransport.createStore({
11
+ initialState: {
12
+ hasWallet: false,
13
+ },
14
+ key: 'embeddedWallets',
15
+ messageTransport: core.messageTransport,
16
+ });
17
+ const messageEvents = messageTransport.createEventEmitterForMessages({
18
+ initialEventEmitter: store.eventEmitter,
19
+ key: 'embeddedWallets',
20
+ messageTransport: core.messageTransport,
21
+ });
22
+ const requestChannel = messageTransport.createRequestChannel(core.messageTransport);
23
+ return Object.assign(store.getters, pickListenerActions.pickListenerActions(messageEvents), {
24
+ createWallet: () => requestChannel.request('createWallet'),
25
+ getWallet: () => requestChannel.request('getWallet'),
26
+ });
27
+ };
28
+
29
+ exports.createEmbeddedWalletsModule = createEmbeddedWalletsModule;
@@ -0,0 +1,6 @@
1
+ import { EmbeddedWalletsModuleMessages, EmbeddedWalletsModuleState, StoreEventListeners } from '@dynamic-labs/message-transport';
2
+ import { Core } from '../../../client/core';
3
+ type PublicEmbeddedWalletsModuleMessages = Pick<EmbeddedWalletsModuleMessages, 'createWallet' | 'getWallet'>;
4
+ export type EmbeddedWalletsModule = EmbeddedWalletsModuleState & StoreEventListeners<EmbeddedWalletsModuleState> & PublicEmbeddedWalletsModuleMessages;
5
+ export declare const createEmbeddedWalletsModule: (core: Core) => EmbeddedWalletsModule;
6
+ export {};
@@ -0,0 +1,25 @@
1
+ 'use client'
2
+ import { createStore, createEventEmitterForMessages, createRequestChannel } from '@dynamic-labs/message-transport';
3
+ import { pickListenerActions } from '../../../utils/pickListenerActions/pickListenerActions.js';
4
+
5
+ const createEmbeddedWalletsModule = (core) => {
6
+ const store = createStore({
7
+ initialState: {
8
+ hasWallet: false,
9
+ },
10
+ key: 'embeddedWallets',
11
+ messageTransport: core.messageTransport,
12
+ });
13
+ const messageEvents = createEventEmitterForMessages({
14
+ initialEventEmitter: store.eventEmitter,
15
+ key: 'embeddedWallets',
16
+ messageTransport: core.messageTransport,
17
+ });
18
+ const requestChannel = createRequestChannel(core.messageTransport);
19
+ return Object.assign(store.getters, pickListenerActions(messageEvents), {
20
+ createWallet: () => requestChannel.request('createWallet'),
21
+ getWallet: () => requestChannel.request('getWallet'),
22
+ });
23
+ };
24
+
25
+ export { createEmbeddedWalletsModule };
@@ -0,0 +1 @@
1
+ export * from './embeddedWalletsModule';
@@ -5,14 +5,26 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
6
  var messageTransport = require('@dynamic-labs/message-transport');
7
7
  var pickListenerActions = require('../../utils/pickListenerActions/pickListenerActions.cjs');
8
+ var embeddedWalletsModule = require('./embeddedWalletsModule/embeddedWalletsModule.cjs');
8
9
 
9
10
  const createWalletsModule = (core) => {
11
+ const requestChannel = messageTransport.createRequestChannel(core.messageTransport);
10
12
  const store = messageTransport.createStore({
11
13
  initialState: { primary: undefined, userWallets: [] },
12
14
  key: 'wallets',
13
15
  messageTransport: core.messageTransport,
14
16
  });
15
- return Object.assign(store.getters, pickListenerActions.pickListenerActions(store.eventEmitter));
17
+ const signMessage = (params) => requestChannel.request('signMessage', params);
18
+ const getBalance = (params) => requestChannel.request('getBalance', params);
19
+ const switchNetwork = (params) => requestChannel.request('switchNetwork', params);
20
+ const getNetwork = (params) => requestChannel.request('getNetwork', params);
21
+ return Object.assign(store.getters, pickListenerActions.pickListenerActions(store.eventEmitter), {
22
+ embedded: embeddedWalletsModule.createEmbeddedWalletsModule(core),
23
+ getBalance,
24
+ getNetwork,
25
+ signMessage,
26
+ switchNetwork,
27
+ });
16
28
  };
17
29
 
18
30
  exports.createWalletsModule = createWalletsModule;
@@ -1,4 +1,11 @@
1
- import { StoreEventListeners, WalletsModuleState } from '@dynamic-labs/message-transport';
1
+ import { StoreEventListeners, WalletsModuleMessages, WalletsModuleState } from '@dynamic-labs/message-transport';
2
2
  import { Core } from '../../client/core';
3
- export type WalletsModule = WalletsModuleState & StoreEventListeners<WalletsModuleState>;
3
+ import { EmbeddedWalletsModule } from './embeddedWalletsModule';
4
+ export type WalletsModule = WalletsModuleState & {
5
+ embedded: EmbeddedWalletsModule;
6
+ signMessage: WalletsModuleMessages['signMessage'];
7
+ switchNetwork: WalletsModuleMessages['switchNetwork'];
8
+ getBalance: WalletsModuleMessages['getBalance'];
9
+ getNetwork: WalletsModuleMessages['getNetwork'];
10
+ } & StoreEventListeners<WalletsModuleState>;
4
11
  export declare const createWalletsModule: (core: Core) => WalletsModule;
@@ -1,14 +1,26 @@
1
1
  'use client'
2
- import { createStore } from '@dynamic-labs/message-transport';
2
+ import { createRequestChannel, createStore } from '@dynamic-labs/message-transport';
3
3
  import { pickListenerActions } from '../../utils/pickListenerActions/pickListenerActions.js';
4
+ import { createEmbeddedWalletsModule } from './embeddedWalletsModule/embeddedWalletsModule.js';
4
5
 
5
6
  const createWalletsModule = (core) => {
7
+ const requestChannel = createRequestChannel(core.messageTransport);
6
8
  const store = createStore({
7
9
  initialState: { primary: undefined, userWallets: [] },
8
10
  key: 'wallets',
9
11
  messageTransport: core.messageTransport,
10
12
  });
11
- return Object.assign(store.getters, pickListenerActions(store.eventEmitter));
13
+ const signMessage = (params) => requestChannel.request('signMessage', params);
14
+ const getBalance = (params) => requestChannel.request('getBalance', params);
15
+ const switchNetwork = (params) => requestChannel.request('switchNetwork', params);
16
+ const getNetwork = (params) => requestChannel.request('getNetwork', params);
17
+ return Object.assign(store.getters, pickListenerActions(store.eventEmitter), {
18
+ embedded: createEmbeddedWalletsModule(core),
19
+ getBalance,
20
+ getNetwork,
21
+ signMessage,
22
+ switchNetwork,
23
+ });
12
24
  };
13
25
 
14
26
  export { createWalletsModule };
@@ -0,0 +1,21 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ /**
7
+ * Adds a new property to an object with a specified key and value.
8
+ * @template T - The type of the object.
9
+ * @param {T} obj - The object to add the property to.
10
+ * @param {string} key - The key of the new property.
11
+ * @param {PropertyDescriptor} descriptor - The property descriptor.
12
+ * @returns {T & Record<K, V>} The object with the added property.
13
+ * @template K - The key type.
14
+ * @template V - The value type.
15
+ */
16
+ const addProperty = (obj, key, descriptor) => {
17
+ Object.defineProperty(obj, key, descriptor);
18
+ return obj;
19
+ };
20
+
21
+ exports.addProperty = addProperty;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Adds a new property to an object with a specified key and value.
3
+ * @template T - The type of the object.
4
+ * @param {T} obj - The object to add the property to.
5
+ * @param {string} key - The key of the new property.
6
+ * @param {PropertyDescriptor} descriptor - The property descriptor.
7
+ * @returns {T & Record<K, V>} The object with the added property.
8
+ * @template K - The key type.
9
+ * @template V - The value type.
10
+ */
11
+ export declare const addProperty: <T extends object, K extends string, V>(obj: T, key: K, descriptor: {
12
+ get: () => V;
13
+ }) => T & Record<K, V>;
@@ -0,0 +1,17 @@
1
+ 'use client'
2
+ /**
3
+ * Adds a new property to an object with a specified key and value.
4
+ * @template T - The type of the object.
5
+ * @param {T} obj - The object to add the property to.
6
+ * @param {string} key - The key of the new property.
7
+ * @param {PropertyDescriptor} descriptor - The property descriptor.
8
+ * @returns {T & Record<K, V>} The object with the added property.
9
+ * @template K - The key type.
10
+ * @template V - The value type.
11
+ */
12
+ const addProperty = (obj, key, descriptor) => {
13
+ Object.defineProperty(obj, key, descriptor);
14
+ return obj;
15
+ };
16
+
17
+ export { addProperty };
@@ -0,0 +1 @@
1
+ export { addProperty } from './addProperty';
@@ -0,0 +1 @@
1
+ export { logger } from './logger';
@@ -0,0 +1,10 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var logger$1 = require('@dynamic-labs/logger');
7
+
8
+ const logger = new logger$1.Logger('@dynamic-labs/client');
9
+
10
+ exports.logger = logger;
@@ -0,0 +1,2 @@
1
+ import { Logger } from '@dynamic-labs/logger';
2
+ export declare const logger: Logger;
@@ -0,0 +1,6 @@
1
+ 'use client'
2
+ import { Logger } from '@dynamic-labs/logger';
3
+
4
+ const logger = new Logger('@dynamic-labs/client');
5
+
6
+ export { logger };