@cmdoss/memwal-sdk 0.6.0 → 0.6.1

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 (224) hide show
  1. package/ARCHITECTURE.md +86 -2
  2. package/BENCHMARKS.md +2 -2
  3. package/README.md +43 -4
  4. package/dist/ai-sdk/types.d.ts +2 -2
  5. package/dist/ai-sdk/types.d.ts.map +1 -1
  6. package/dist/browser.d.ts +9 -9
  7. package/dist/browser.d.ts.map +1 -1
  8. package/dist/browser.js +16 -11
  9. package/dist/browser.js.map +1 -1
  10. package/dist/client/PersonalDataWallet.d.ts.map +1 -1
  11. package/dist/client/SimplePDWClient.d.ts.map +1 -1
  12. package/dist/client/SimplePDWClient.js +4 -4
  13. package/dist/client/SimplePDWClient.js.map +1 -1
  14. package/dist/client/namespaces/BatchNamespace.js +2 -2
  15. package/dist/client/namespaces/BatchNamespace.js.map +1 -1
  16. package/dist/client/namespaces/MemoryNamespace.js +3 -3
  17. package/dist/client/namespaces/MemoryNamespace.js.map +1 -1
  18. package/dist/client/namespaces/StorageNamespace.js +4 -4
  19. package/dist/client/namespaces/StorageNamespace.js.map +1 -1
  20. package/dist/client/namespaces/consolidated/StorageNamespace.js +2 -2
  21. package/dist/client/namespaces/consolidated/StorageNamespace.js.map +1 -1
  22. package/dist/client/signers/DappKitSigner.d.ts +136 -0
  23. package/dist/client/signers/DappKitSigner.d.ts.map +1 -0
  24. package/dist/client/signers/DappKitSigner.js +128 -0
  25. package/dist/client/signers/DappKitSigner.js.map +1 -0
  26. package/dist/client/signers/KeypairSigner.d.ts +4 -0
  27. package/dist/client/signers/KeypairSigner.d.ts.map +1 -1
  28. package/dist/client/signers/KeypairSigner.js +6 -0
  29. package/dist/client/signers/KeypairSigner.js.map +1 -1
  30. package/dist/client/signers/UnifiedSigner.d.ts +10 -0
  31. package/dist/client/signers/UnifiedSigner.d.ts.map +1 -1
  32. package/dist/client/signers/WalletAdapterSigner.d.ts +7 -0
  33. package/dist/client/signers/WalletAdapterSigner.d.ts.map +1 -1
  34. package/dist/client/signers/WalletAdapterSigner.js +9 -0
  35. package/dist/client/signers/WalletAdapterSigner.js.map +1 -1
  36. package/dist/client/signers/index.d.ts +3 -0
  37. package/dist/client/signers/index.d.ts.map +1 -1
  38. package/dist/client/signers/index.js +2 -0
  39. package/dist/client/signers/index.js.map +1 -1
  40. package/dist/generated/utils/index.js +1 -1
  41. package/dist/generated/utils/index.js.map +1 -1
  42. package/dist/index.d.ts +2 -0
  43. package/dist/index.d.ts.map +1 -1
  44. package/dist/index.js +2 -0
  45. package/dist/index.js.map +1 -1
  46. package/dist/services/CapabilityService.js +1 -1
  47. package/dist/services/CapabilityService.js.map +1 -1
  48. package/dist/services/EncryptionService.js +1 -1
  49. package/dist/services/EncryptionService.js.map +1 -1
  50. package/dist/services/StorageService.d.ts +8 -8
  51. package/dist/services/StorageService.d.ts.map +1 -1
  52. package/dist/services/StorageService.js.map +1 -1
  53. package/dist/services/VectorService.js +2 -2
  54. package/dist/services/VectorService.js.map +1 -1
  55. package/dist/services/storage/BlobAttributesManager.d.ts +4 -4
  56. package/dist/services/storage/BlobAttributesManager.d.ts.map +1 -1
  57. package/dist/services/storage/BlobAttributesManager.js +6 -15
  58. package/dist/services/storage/BlobAttributesManager.js.map +1 -1
  59. package/dist/services/storage/QuiltBatchManager.d.ts +23 -5
  60. package/dist/services/storage/QuiltBatchManager.d.ts.map +1 -1
  61. package/dist/services/storage/QuiltBatchManager.js +118 -35
  62. package/dist/services/storage/QuiltBatchManager.js.map +1 -1
  63. package/dist/services/storage/WalrusMetadataManager.d.ts +2 -2
  64. package/dist/services/storage/WalrusMetadataManager.d.ts.map +1 -1
  65. package/dist/services/storage/WalrusMetadataManager.js +2 -5
  66. package/dist/services/storage/WalrusMetadataManager.js.map +1 -1
  67. package/dist/services/storage/WalrusStorageManager.d.ts +2 -2
  68. package/dist/services/storage/WalrusStorageManager.d.ts.map +1 -1
  69. package/dist/services/storage/WalrusStorageManager.js +7 -11
  70. package/dist/services/storage/WalrusStorageManager.js.map +1 -1
  71. package/dist/wallet/MainWalletService.js +1 -1
  72. package/dist/wallet/MainWalletService.js.map +1 -1
  73. package/package.json +10 -3
  74. package/src/ai-sdk/types.ts +2 -2
  75. package/src/browser.ts +19 -20
  76. package/src/client/SimplePDWClient.ts +18 -14
  77. package/src/client/namespaces/BatchNamespace.ts +2 -2
  78. package/src/client/namespaces/MemoryNamespace.ts +3 -3
  79. package/src/client/namespaces/StorageNamespace.ts +4 -4
  80. package/src/client/namespaces/consolidated/StorageNamespace.ts +2 -2
  81. package/src/client/signers/DappKitSigner.ts +207 -0
  82. package/src/client/signers/KeypairSigner.ts +7 -0
  83. package/src/client/signers/UnifiedSigner.ts +11 -0
  84. package/src/client/signers/WalletAdapterSigner.ts +10 -0
  85. package/src/client/signers/index.ts +7 -0
  86. package/src/generated/pdw/deps/sui/object.ts +12 -12
  87. package/src/generated/pdw/deps/sui/vec_map.ts +32 -32
  88. package/src/generated/pdw/memory.ts +1087 -1087
  89. package/src/generated/pdw/wallet.ts +123 -123
  90. package/src/generated/utils/index.ts +159 -159
  91. package/src/index.ts +16 -0
  92. package/src/services/CapabilityService.ts +1 -1
  93. package/src/services/EncryptionService.ts +1 -1
  94. package/src/services/StorageService.ts +8 -8
  95. package/src/services/VectorService.ts +2 -2
  96. package/src/services/storage/BlobAttributesManager.ts +10 -19
  97. package/src/services/storage/QuiltBatchManager.ts +139 -37
  98. package/src/services/storage/WalrusMetadataManager.ts +4 -7
  99. package/src/services/storage/WalrusStorageManager.ts +10 -13
  100. package/src/wallet/MainWalletService.ts +1 -1
  101. package/dist/api/client.d.ts +0 -43
  102. package/dist/api/client.d.ts.map +0 -1
  103. package/dist/api/client.js +0 -136
  104. package/dist/api/client.js.map +0 -1
  105. package/dist/chat/index.d.ts +0 -13
  106. package/dist/chat/index.d.ts.map +0 -1
  107. package/dist/chat/index.js +0 -14
  108. package/dist/chat/index.js.map +0 -1
  109. package/dist/client/namespaces/ChatNamespace.d.ts +0 -110
  110. package/dist/client/namespaces/ChatNamespace.d.ts.map +0 -1
  111. package/dist/client/namespaces/ChatNamespace.js +0 -123
  112. package/dist/client/namespaces/ChatNamespace.js.map +0 -1
  113. package/dist/encryption/index.d.ts +0 -14
  114. package/dist/encryption/index.d.ts.map +0 -1
  115. package/dist/encryption/index.js +0 -14
  116. package/dist/encryption/index.js.map +0 -1
  117. package/dist/graph/BrowserKnowledgeGraphManager.d.ts +0 -101
  118. package/dist/graph/BrowserKnowledgeGraphManager.d.ts.map +0 -1
  119. package/dist/graph/BrowserKnowledgeGraphManager.js +0 -411
  120. package/dist/graph/BrowserKnowledgeGraphManager.js.map +0 -1
  121. package/dist/hooks.wip/index.d.ts +0 -55
  122. package/dist/hooks.wip/index.d.ts.map +0 -1
  123. package/dist/hooks.wip/index.js +0 -58
  124. package/dist/hooks.wip/index.js.map +0 -1
  125. package/dist/hooks.wip/useCreateMemory.d.ts +0 -111
  126. package/dist/hooks.wip/useCreateMemory.d.ts.map +0 -1
  127. package/dist/hooks.wip/useCreateMemory.js +0 -149
  128. package/dist/hooks.wip/useCreateMemory.js.map +0 -1
  129. package/dist/hooks.wip/useCreateMemoryBatch.d.ts +0 -122
  130. package/dist/hooks.wip/useCreateMemoryBatch.d.ts.map +0 -1
  131. package/dist/hooks.wip/useCreateMemoryBatch.js +0 -221
  132. package/dist/hooks.wip/useCreateMemoryBatch.js.map +0 -1
  133. package/dist/hooks.wip/useKnowledgeGraph.d.ts +0 -66
  134. package/dist/hooks.wip/useKnowledgeGraph.d.ts.map +0 -1
  135. package/dist/hooks.wip/useKnowledgeGraph.js +0 -229
  136. package/dist/hooks.wip/useKnowledgeGraph.js.map +0 -1
  137. package/dist/hooks.wip/useMemoryChat.d.ts +0 -106
  138. package/dist/hooks.wip/useMemoryChat.d.ts.map +0 -1
  139. package/dist/hooks.wip/useMemoryChat.js +0 -284
  140. package/dist/hooks.wip/useMemoryChat.js.map +0 -1
  141. package/dist/hooks.wip/useMemoryIndex.d.ts +0 -90
  142. package/dist/hooks.wip/useMemoryIndex.d.ts.map +0 -1
  143. package/dist/hooks.wip/useMemoryIndex.js +0 -218
  144. package/dist/hooks.wip/useMemoryIndex.js.map +0 -1
  145. package/dist/hooks.wip/useMemoryManager.d.ts +0 -35
  146. package/dist/hooks.wip/useMemoryManager.d.ts.map +0 -1
  147. package/dist/hooks.wip/useMemoryManager.js +0 -86
  148. package/dist/hooks.wip/useMemoryManager.js.map +0 -1
  149. package/dist/hooks.wip/useMemorySearch.d.ts +0 -100
  150. package/dist/hooks.wip/useMemorySearch.d.ts.map +0 -1
  151. package/dist/hooks.wip/useMemorySearch.js +0 -278
  152. package/dist/hooks.wip/useMemorySearch.js.map +0 -1
  153. package/dist/hooks.wip/useMemoryServices.d.ts +0 -80
  154. package/dist/hooks.wip/useMemoryServices.d.ts.map +0 -1
  155. package/dist/hooks.wip/useMemoryServices.js +0 -264
  156. package/dist/hooks.wip/useMemoryServices.js.map +0 -1
  157. package/dist/hooks.wip/usePDWRAG.d.ts +0 -112
  158. package/dist/hooks.wip/usePDWRAG.d.ts.map +0 -1
  159. package/dist/hooks.wip/usePDWRAG.js +0 -121
  160. package/dist/hooks.wip/usePDWRAG.js.map +0 -1
  161. package/dist/hooks.wip/usePDWVectorStore.d.ts +0 -68
  162. package/dist/hooks.wip/usePDWVectorStore.d.ts.map +0 -1
  163. package/dist/hooks.wip/usePDWVectorStore.js +0 -102
  164. package/dist/hooks.wip/usePDWVectorStore.js.map +0 -1
  165. package/dist/hooks.wip/useRetrieveEmbedding.d.ts +0 -138
  166. package/dist/hooks.wip/useRetrieveEmbedding.d.ts.map +0 -1
  167. package/dist/hooks.wip/useRetrieveEmbedding.js +0 -121
  168. package/dist/hooks.wip/useRetrieveEmbedding.js.map +0 -1
  169. package/dist/hooks.wip/useSearchMemories.d.ts +0 -103
  170. package/dist/hooks.wip/useSearchMemories.d.ts.map +0 -1
  171. package/dist/hooks.wip/useSearchMemories.js +0 -146
  172. package/dist/hooks.wip/useSearchMemories.js.map +0 -1
  173. package/dist/hooks.wip/useStoreEmbedding.d.ts +0 -174
  174. package/dist/hooks.wip/useStoreEmbedding.d.ts.map +0 -1
  175. package/dist/hooks.wip/useStoreEmbedding.js +0 -167
  176. package/dist/hooks.wip/useStoreEmbedding.js.map +0 -1
  177. package/dist/hooks.wip/useWalletMemories.d.ts +0 -119
  178. package/dist/hooks.wip/useWalletMemories.d.ts.map +0 -1
  179. package/dist/hooks.wip/useWalletMemories.js +0 -166
  180. package/dist/hooks.wip/useWalletMemories.js.map +0 -1
  181. package/dist/hooks.wip/utils/cache.d.ts +0 -25
  182. package/dist/hooks.wip/utils/cache.d.ts.map +0 -1
  183. package/dist/hooks.wip/utils/cache.js +0 -38
  184. package/dist/hooks.wip/utils/cache.js.map +0 -1
  185. package/dist/hooks.wip/utils/types.d.ts +0 -138
  186. package/dist/hooks.wip/utils/types.d.ts.map +0 -1
  187. package/dist/hooks.wip/utils/types.js +0 -5
  188. package/dist/hooks.wip/utils/types.js.map +0 -1
  189. package/dist/infrastructure/ai/EmbeddingService.d.ts +0 -101
  190. package/dist/infrastructure/ai/EmbeddingService.d.ts.map +0 -1
  191. package/dist/infrastructure/ai/EmbeddingService.js +0 -242
  192. package/dist/infrastructure/ai/EmbeddingService.js.map +0 -1
  193. package/dist/infrastructure/ai/GeminiAIService.d.ts +0 -84
  194. package/dist/infrastructure/ai/GeminiAIService.d.ts.map +0 -1
  195. package/dist/infrastructure/ai/GeminiAIService.js +0 -300
  196. package/dist/infrastructure/ai/GeminiAIService.js.map +0 -1
  197. package/dist/infrastructure/ai/index.d.ts +0 -8
  198. package/dist/infrastructure/ai/index.d.ts.map +0 -1
  199. package/dist/infrastructure/ai/index.js +0 -8
  200. package/dist/infrastructure/ai/index.js.map +0 -1
  201. package/dist/memory/index.d.ts +0 -13
  202. package/dist/memory/index.d.ts.map +0 -1
  203. package/dist/memory/index.js +0 -14
  204. package/dist/memory/index.js.map +0 -1
  205. package/dist/services/ChatService.d.ts +0 -89
  206. package/dist/services/ChatService.d.ts.map +0 -1
  207. package/dist/services/ChatService.js +0 -319
  208. package/dist/services/ChatService.js.map +0 -1
  209. package/dist/transactions/index.d.ts +0 -13
  210. package/dist/transactions/index.d.ts.map +0 -1
  211. package/dist/transactions/index.js +0 -14
  212. package/dist/transactions/index.js.map +0 -1
  213. package/dist/types/wallet.d.ts +0 -12
  214. package/dist/types/wallet.d.ts.map +0 -1
  215. package/dist/types/wallet.js +0 -13
  216. package/dist/types/wallet.js.map +0 -1
  217. package/dist/view/ViewService.d.ts +0 -136
  218. package/dist/view/ViewService.d.ts.map +0 -1
  219. package/dist/view/ViewService.js +0 -325
  220. package/dist/view/ViewService.js.map +0 -1
  221. package/dist/view/index.d.ts +0 -7
  222. package/dist/view/index.d.ts.map +0 -1
  223. package/dist/view/index.js +0 -7
  224. package/dist/view/index.js.map +0 -1
@@ -1,124 +1,124 @@
1
- /**************************************************************
2
- * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
- **************************************************************/
4
-
5
-
6
- /**
7
- * @deprecated This module is DEPRECATED - use pdw::capability instead
8
- *
9
- * MIGRATION NOTICE: ================= This module used dynamic fields for context
10
- * management. The new pdw::capability module uses standalone MemoryCap objects.
11
- *
12
- * Benefits of new architecture:
13
- *
14
- * - No MainWallet object management needed
15
- * - Standard Sui object ownership
16
- * - SEAL-compliant PrivateData pattern
17
- * - Simpler cross-dApp data sharing
18
- *
19
- * See CAPABILITY-ARCHITECTURE-SUMMARY.md for details.
20
- *
21
- * @deprecated Use pdw::capability::MemoryCap instead
22
- */
23
-
24
- import { MoveStruct, normalizeMoveArguments, type RawTransactionArgument } from '../utils/index.js';
25
- import { bcs } from '@mysten/sui/bcs';
26
- import { type Transaction } from '@mysten/sui/transactions';
27
- import * as object from './deps/sui/object.js';
28
- const $moduleName = '@local-pkg/pdw::wallet';
29
- export const UserProfile = new MoveStruct({ name: `${$moduleName}::UserProfile`, fields: {
30
- id: object.UID,
31
- owner: bcs.Address,
32
- created_at: bcs.u64()
33
- } });
34
- export const UserProfileCreated = new MoveStruct({ name: `${$moduleName}::UserProfileCreated`, fields: {
35
- profile_id: bcs.Address,
36
- owner: bcs.Address,
37
- created_at: bcs.u64()
38
- } });
39
- export interface CreateUserProfileOptions {
40
- package?: string;
41
- arguments?: [
42
- ];
43
- }
44
- /**
45
- * @deprecated Use pdw::capability::create_memory_cap instead Create a simple user
46
- * profile (for backward compatibility)
47
- */
48
- export function createUserProfile(options: CreateUserProfileOptions = {}) {
49
- const packageAddress = options.package ?? '@local-pkg/pdw';
50
- return (tx: Transaction) => tx.moveCall({
51
- package: packageAddress,
52
- module: 'wallet',
53
- function: 'create_user_profile',
54
- });
55
- }
56
- export interface GetOwnerArguments {
57
- profile: RawTransactionArgument<string>;
58
- }
59
- export interface GetOwnerOptions {
60
- package?: string;
61
- arguments: GetOwnerArguments | [
62
- profile: RawTransactionArgument<string>
63
- ];
64
- }
65
- /** Get profile owner */
66
- export function getOwner(options: GetOwnerOptions) {
67
- const packageAddress = options.package ?? '@local-pkg/pdw';
68
- const argumentsTypes = [
69
- `${packageAddress}::wallet::UserProfile`
70
- ] satisfies string[];
71
- const parameterNames = ["profile"];
72
- return (tx: Transaction) => tx.moveCall({
73
- package: packageAddress,
74
- module: 'wallet',
75
- function: 'get_owner',
76
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
77
- });
78
- }
79
- export interface GetProfileIdArguments {
80
- profile: RawTransactionArgument<string>;
81
- }
82
- export interface GetProfileIdOptions {
83
- package?: string;
84
- arguments: GetProfileIdArguments | [
85
- profile: RawTransactionArgument<string>
86
- ];
87
- }
88
- /** Get profile ID */
89
- export function getProfileId(options: GetProfileIdOptions) {
90
- const packageAddress = options.package ?? '@local-pkg/pdw';
91
- const argumentsTypes = [
92
- `${packageAddress}::wallet::UserProfile`
93
- ] satisfies string[];
94
- const parameterNames = ["profile"];
95
- return (tx: Transaction) => tx.moveCall({
96
- package: packageAddress,
97
- module: 'wallet',
98
- function: 'get_profile_id',
99
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
100
- });
101
- }
102
- export interface DeleteProfileArguments {
103
- profile: RawTransactionArgument<string>;
104
- }
105
- export interface DeleteProfileOptions {
106
- package?: string;
107
- arguments: DeleteProfileArguments | [
108
- profile: RawTransactionArgument<string>
109
- ];
110
- }
111
- /** Delete user profile */
112
- export function deleteProfile(options: DeleteProfileOptions) {
113
- const packageAddress = options.package ?? '@local-pkg/pdw';
114
- const argumentsTypes = [
115
- `${packageAddress}::wallet::UserProfile`
116
- ] satisfies string[];
117
- const parameterNames = ["profile"];
118
- return (tx: Transaction) => tx.moveCall({
119
- package: packageAddress,
120
- module: 'wallet',
121
- function: 'delete_profile',
122
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
123
- });
1
+ /**************************************************************
2
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
+ **************************************************************/
4
+
5
+
6
+ /**
7
+ * @deprecated This module is DEPRECATED - use pdw::capability instead
8
+ *
9
+ * MIGRATION NOTICE: ================= This module used dynamic fields for context
10
+ * management. The new pdw::capability module uses standalone MemoryCap objects.
11
+ *
12
+ * Benefits of new architecture:
13
+ *
14
+ * - No MainWallet object management needed
15
+ * - Standard Sui object ownership
16
+ * - SEAL-compliant PrivateData pattern
17
+ * - Simpler cross-dApp data sharing
18
+ *
19
+ * See CAPABILITY-ARCHITECTURE-SUMMARY.md for details.
20
+ *
21
+ * @deprecated Use pdw::capability::MemoryCap instead
22
+ */
23
+
24
+ import { MoveStruct, normalizeMoveArguments, type RawTransactionArgument } from '../utils/index.js';
25
+ import { bcs } from '@mysten/sui/bcs';
26
+ import { type Transaction } from '@mysten/sui/transactions';
27
+ import * as object from './deps/sui/object.js';
28
+ const $moduleName = '@local-pkg/pdw::wallet';
29
+ export const UserProfile = new MoveStruct({ name: `${$moduleName}::UserProfile`, fields: {
30
+ id: object.UID,
31
+ owner: bcs.Address,
32
+ created_at: bcs.u64()
33
+ } });
34
+ export const UserProfileCreated = new MoveStruct({ name: `${$moduleName}::UserProfileCreated`, fields: {
35
+ profile_id: bcs.Address,
36
+ owner: bcs.Address,
37
+ created_at: bcs.u64()
38
+ } });
39
+ export interface CreateUserProfileOptions {
40
+ package?: string;
41
+ arguments?: [
42
+ ];
43
+ }
44
+ /**
45
+ * @deprecated Use pdw::capability::create_memory_cap instead Create a simple user
46
+ * profile (for backward compatibility)
47
+ */
48
+ export function createUserProfile(options: CreateUserProfileOptions = {}) {
49
+ const packageAddress = options.package ?? '@local-pkg/pdw';
50
+ return (tx: Transaction) => tx.moveCall({
51
+ package: packageAddress,
52
+ module: 'wallet',
53
+ function: 'create_user_profile',
54
+ });
55
+ }
56
+ export interface GetOwnerArguments {
57
+ profile: RawTransactionArgument<string>;
58
+ }
59
+ export interface GetOwnerOptions {
60
+ package?: string;
61
+ arguments: GetOwnerArguments | [
62
+ profile: RawTransactionArgument<string>
63
+ ];
64
+ }
65
+ /** Get profile owner */
66
+ export function getOwner(options: GetOwnerOptions) {
67
+ const packageAddress = options.package ?? '@local-pkg/pdw';
68
+ const argumentsTypes = [
69
+ `${packageAddress}::wallet::UserProfile`
70
+ ] satisfies string[];
71
+ const parameterNames = ["profile"];
72
+ return (tx: Transaction) => tx.moveCall({
73
+ package: packageAddress,
74
+ module: 'wallet',
75
+ function: 'get_owner',
76
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
77
+ });
78
+ }
79
+ export interface GetProfileIdArguments {
80
+ profile: RawTransactionArgument<string>;
81
+ }
82
+ export interface GetProfileIdOptions {
83
+ package?: string;
84
+ arguments: GetProfileIdArguments | [
85
+ profile: RawTransactionArgument<string>
86
+ ];
87
+ }
88
+ /** Get profile ID */
89
+ export function getProfileId(options: GetProfileIdOptions) {
90
+ const packageAddress = options.package ?? '@local-pkg/pdw';
91
+ const argumentsTypes = [
92
+ `${packageAddress}::wallet::UserProfile`
93
+ ] satisfies string[];
94
+ const parameterNames = ["profile"];
95
+ return (tx: Transaction) => tx.moveCall({
96
+ package: packageAddress,
97
+ module: 'wallet',
98
+ function: 'get_profile_id',
99
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
100
+ });
101
+ }
102
+ export interface DeleteProfileArguments {
103
+ profile: RawTransactionArgument<string>;
104
+ }
105
+ export interface DeleteProfileOptions {
106
+ package?: string;
107
+ arguments: DeleteProfileArguments | [
108
+ profile: RawTransactionArgument<string>
109
+ ];
110
+ }
111
+ /** Delete user profile */
112
+ export function deleteProfile(options: DeleteProfileOptions) {
113
+ const packageAddress = options.package ?? '@local-pkg/pdw';
114
+ const argumentsTypes = [
115
+ `${packageAddress}::wallet::UserProfile`
116
+ ] satisfies string[];
117
+ const parameterNames = ["profile"];
118
+ return (tx: Transaction) => tx.moveCall({
119
+ package: packageAddress,
120
+ module: 'wallet',
121
+ function: 'delete_profile',
122
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
123
+ });
124
124
  }
@@ -1,159 +1,159 @@
1
-
2
- import { bcs, BcsType, TypeTag, TypeTagSerializer, BcsStruct, BcsEnum, BcsTuple } from '@mysten/sui/bcs';
3
- import { normalizeSuiAddress } from '@mysten/sui/utils';
4
- import { TransactionArgument, isArgument } from '@mysten/sui/transactions';
5
-
6
- const MOVE_STDLIB_ADDRESS = normalizeSuiAddress('0x1');
7
- const SUI_FRAMEWORK_ADDRESS = normalizeSuiAddress('0x2');
8
- const SUI_SYSTEM_ADDRESS = normalizeSuiAddress('0x3');
9
-
10
- export type RawTransactionArgument<T> = T | TransactionArgument;
11
-
12
- export function getPureBcsSchema(typeTag: string | TypeTag): BcsType<any> | null {
13
- const parsedTag = typeof typeTag === 'string' ? TypeTagSerializer.parseFromStr(typeTag) : typeTag;
14
-
15
- if ('u8' in parsedTag) {
16
- return bcs.U8;
17
- } else if ('u16' in parsedTag) {
18
- return bcs.U16;
19
- } else if ('u32' in parsedTag) {
20
- return bcs.U32;
21
- } else if ('u64' in parsedTag) {
22
- return bcs.U64;
23
- } else if ('u128' in parsedTag) {
24
- return bcs.U128;
25
- } else if ('u256' in parsedTag) {
26
- return bcs.U256;
27
- } else if ('address' in parsedTag) {
28
- return bcs.Address;
29
- } else if ('bool' in parsedTag) {
30
- return bcs.Bool;
31
- } else if ('vector' in parsedTag) {
32
- const type = getPureBcsSchema(parsedTag.vector);
33
- return type ? bcs.vector(type) : null;
34
- } else if ('struct' in parsedTag) {
35
- const structTag = parsedTag.struct;
36
- const pkg = normalizeSuiAddress(parsedTag.struct.address);
37
-
38
- if (pkg === MOVE_STDLIB_ADDRESS) {
39
- if (
40
- (structTag.module === 'ascii' || structTag.module === 'string') &&
41
- structTag.name === 'String'
42
- ) {
43
- return bcs.String;
44
- }
45
-
46
- if (structTag.module === 'option' && structTag.name === 'Option') {
47
- const type = getPureBcsSchema(structTag.typeParams[0]!);
48
- return type ? bcs.option(type) : null;
49
- }
50
- }
51
-
52
- if (pkg === SUI_FRAMEWORK_ADDRESS && structTag.module === 'Object' && structTag.name === 'ID') {
53
- return bcs.Address;
54
- }
55
- }
56
-
57
- return null;
58
- }
59
-
60
- export function normalizeMoveArguments(args: unknown[] | object, argTypes: string[], parameterNames?: string[]) {
61
- const argLen = Array.isArray(args) ? args.length : Object.keys(args).length;
62
- if (parameterNames && argLen !== parameterNames.length) {
63
- throw new Error(
64
- `Invalid number of arguments, expected ${parameterNames.length}, got ${argLen}`,
65
- );
66
- }
67
-
68
- const normalizedArgs: TransactionArgument[] = [];
69
-
70
- let index = 0;
71
- for (const [i, argType] of argTypes.entries()) {
72
- if (argType === `${SUI_FRAMEWORK_ADDRESS}::deny_list::DenyList`) {
73
- normalizedArgs.push((tx) => tx.object.denyList());
74
- continue;
75
- }
76
-
77
- if (argType === `${SUI_FRAMEWORK_ADDRESS}::random::Random`) {
78
- normalizedArgs.push((tx) => tx.object.random());
79
- continue;
80
- }
81
-
82
- if (argType === `${SUI_FRAMEWORK_ADDRESS}::clock::Clock`) {
83
- normalizedArgs.push((tx) => tx.object.clock());
84
- continue;
85
- }
86
-
87
- if (argType === `${SUI_SYSTEM_ADDRESS}::sui_system::SuiSystemState`) {
88
- normalizedArgs.push((tx) => tx.object.system());
89
- continue;
90
- }
91
-
92
- let arg
93
- if (Array.isArray(args)) {
94
- if (index >= args.length) {
95
- throw new Error(`Invalid number of arguments, expected at least ${index + 1}, got ${args.length}`);
96
- }
97
- arg = args[index];
98
- } else {
99
- if (!parameterNames) {
100
- throw new Error(`Expected arguments to be passed as an array`);
101
- }
102
- const name = parameterNames[index];
103
- arg = args[name as keyof typeof args];
104
-
105
- if (arg == null) {
106
- throw new Error(`Parameter ${name} is required`);
107
- }
108
- }
109
-
110
- index += 1;
111
-
112
- if (typeof arg === 'function' || isArgument(arg)) {
113
- normalizedArgs.push(arg as TransactionArgument);
114
- continue;
115
- }
116
-
117
- const type = argTypes[i]!;
118
- const bcsType = getPureBcsSchema(type);
119
-
120
- if (bcsType) {
121
- const bytes = bcsType.serialize(arg as never);
122
- normalizedArgs.push((tx) => tx.pure(bytes));
123
- continue;
124
- } else if (typeof arg === 'string') {
125
- normalizedArgs.push((tx) => tx.object(arg));
126
- continue;
127
- }
128
-
129
- throw new Error(`Invalid argument ${stringify(arg)} for type ${type}`);
130
- }
131
-
132
- return normalizedArgs;
133
- }
134
-
135
- export class MoveStruct<
136
- T extends Record<string, BcsType<any>>,
137
- const Name extends string = string,
138
- > extends BcsStruct<T, Name> {}
139
-
140
- export class MoveEnum<
141
- T extends Record<string, BcsType<any> | null>,
142
- const Name extends string,
143
- > extends BcsEnum<T, Name> {}
144
-
145
- export class MoveTuple<
146
- T extends readonly BcsType<any>[],
147
- const Name extends string,
148
- > extends BcsTuple<T, Name> {}
149
-
150
- function stringify(val: unknown) {
151
- if (typeof val === 'object') {
152
- return JSON.stringify(val, (val: unknown) => val);
153
- }
154
- if (typeof val === 'bigint') {
155
- return val.toString();
156
- }
157
-
158
- return val;
159
- }
1
+
2
+ import { bcs, BcsType, TypeTag, TypeTagSerializer, BcsStruct, BcsEnum, BcsTuple } from '@mysten/sui/bcs';
3
+ import { normalizeSuiAddress } from '@mysten/sui/utils';
4
+ import { TransactionArgument, isArgument } from '@mysten/sui/transactions';
5
+
6
+ const MOVE_STDLIB_ADDRESS = normalizeSuiAddress('0x1');
7
+ const SUI_FRAMEWORK_ADDRESS = normalizeSuiAddress('0x2');
8
+ const SUI_SYSTEM_ADDRESS = normalizeSuiAddress('0x3');
9
+
10
+ export type RawTransactionArgument<T> = T | TransactionArgument;
11
+
12
+ export function getPureBcsSchema(typeTag: string | TypeTag): BcsType<any> | null {
13
+ const parsedTag = typeof typeTag === 'string' ? TypeTagSerializer.parseFromStr(typeTag) : typeTag;
14
+
15
+ if ('u8' in parsedTag) {
16
+ return bcs.U8;
17
+ } else if ('u16' in parsedTag) {
18
+ return bcs.U16;
19
+ } else if ('u32' in parsedTag) {
20
+ return bcs.U32;
21
+ } else if ('u64' in parsedTag) {
22
+ return bcs.U64;
23
+ } else if ('u128' in parsedTag) {
24
+ return bcs.U128;
25
+ } else if ('u256' in parsedTag) {
26
+ return bcs.U256;
27
+ } else if ('address' in parsedTag) {
28
+ return bcs.Address;
29
+ } else if ('bool' in parsedTag) {
30
+ return bcs.Bool;
31
+ } else if ('vector' in parsedTag) {
32
+ const type = getPureBcsSchema(parsedTag.vector);
33
+ return type ? bcs.vector(type) : null;
34
+ } else if ('struct' in parsedTag) {
35
+ const structTag = parsedTag.struct;
36
+ const pkg = normalizeSuiAddress(parsedTag.struct.address);
37
+
38
+ if (pkg === MOVE_STDLIB_ADDRESS) {
39
+ if (
40
+ (structTag.module === 'ascii' || structTag.module === 'string') &&
41
+ structTag.name === 'String'
42
+ ) {
43
+ return bcs.String;
44
+ }
45
+
46
+ if (structTag.module === 'option' && structTag.name === 'Option') {
47
+ const type = getPureBcsSchema(structTag.typeParams[0]!);
48
+ return type ? bcs.option(type) : null;
49
+ }
50
+ }
51
+
52
+ if (pkg === SUI_FRAMEWORK_ADDRESS && structTag.module === 'Object' && structTag.name === 'ID') {
53
+ return bcs.Address;
54
+ }
55
+ }
56
+
57
+ return null;
58
+ }
59
+
60
+ export function normalizeMoveArguments(args: unknown[] | object, argTypes: string[], parameterNames?: string[]) {
61
+ const argLen = Array.isArray(args) ? args.length : Object.keys(args).length;
62
+ if (parameterNames && argLen !== parameterNames.length) {
63
+ throw new Error(
64
+ `Invalid number of arguments, expected ${parameterNames.length}, got ${argLen}`,
65
+ );
66
+ }
67
+
68
+ const normalizedArgs: TransactionArgument[] = [];
69
+
70
+ let index = 0;
71
+ for (const [i, argType] of argTypes.entries()) {
72
+ if (argType === `${SUI_FRAMEWORK_ADDRESS}::deny_list::DenyList`) {
73
+ normalizedArgs.push((tx) => tx.object.denyList());
74
+ continue;
75
+ }
76
+
77
+ if (argType === `${SUI_FRAMEWORK_ADDRESS}::random::Random`) {
78
+ normalizedArgs.push((tx) => tx.object.random());
79
+ continue;
80
+ }
81
+
82
+ if (argType === `${SUI_FRAMEWORK_ADDRESS}::clock::Clock`) {
83
+ normalizedArgs.push((tx) => tx.object.clock());
84
+ continue;
85
+ }
86
+
87
+ if (argType === `${SUI_SYSTEM_ADDRESS}::sui_system::SuiSystemState`) {
88
+ normalizedArgs.push((tx) => tx.object.system());
89
+ continue;
90
+ }
91
+
92
+ let arg
93
+ if (Array.isArray(args)) {
94
+ if (index >= args.length) {
95
+ throw new Error(`Invalid number of arguments, expected at least ${index + 1}, got ${args.length}`);
96
+ }
97
+ arg = args[index];
98
+ } else {
99
+ if (!parameterNames) {
100
+ throw new Error(`Expected arguments to be passed as an array`);
101
+ }
102
+ const name = parameterNames[index];
103
+ arg = args[name as keyof typeof args];
104
+
105
+ if (arg === undefined) {
106
+ throw new Error(`Parameter ${name} is required`);
107
+ }
108
+ }
109
+
110
+ index += 1;
111
+
112
+ if (typeof arg === 'function' || isArgument(arg)) {
113
+ normalizedArgs.push(arg as TransactionArgument);
114
+ continue;
115
+ }
116
+
117
+ const type = argTypes[i]!;
118
+ const bcsType = getPureBcsSchema(type);
119
+
120
+ if (bcsType) {
121
+ const bytes = bcsType.serialize(arg as never);
122
+ normalizedArgs.push((tx) => tx.pure(bytes));
123
+ continue;
124
+ } else if (typeof arg === 'string') {
125
+ normalizedArgs.push((tx) => tx.object(arg));
126
+ continue;
127
+ }
128
+
129
+ throw new Error(`Invalid argument ${stringify(arg)} for type ${type}`);
130
+ }
131
+
132
+ return normalizedArgs;
133
+ }
134
+
135
+ export class MoveStruct<
136
+ T extends Record<string, BcsType<any>>,
137
+ const Name extends string = string,
138
+ > extends BcsStruct<T, Name> {}
139
+
140
+ export class MoveEnum<
141
+ T extends Record<string, BcsType<any> | null>,
142
+ const Name extends string,
143
+ > extends BcsEnum<T, Name> {}
144
+
145
+ export class MoveTuple<
146
+ T extends readonly BcsType<any>[],
147
+ const Name extends string,
148
+ > extends BcsTuple<T, Name> {}
149
+
150
+ function stringify(val: unknown) {
151
+ if (typeof val === 'object') {
152
+ return JSON.stringify(val, (val: unknown) => val);
153
+ }
154
+ if (typeof val === 'bigint') {
155
+ return val.toString();
156
+ }
157
+
158
+ return val;
159
+ }
package/src/index.ts CHANGED
@@ -389,6 +389,22 @@ export { ClientMemoryManager } from './client/ClientMemoryManager';
389
389
  export { PersonalDataWallet } from './client/PersonalDataWallet';
390
390
  export { SimplePDWClient } from './client/SimplePDWClient';
391
391
  export type { SimplePDWConfig, ServiceContainer } from './client/SimplePDWClient';
392
+
393
+ // Signer abstractions for different environments
394
+ export {
395
+ KeypairSigner,
396
+ WalletAdapterSigner,
397
+ DappKitSigner
398
+ } from './client/signers';
399
+ export type {
400
+ UnifiedSigner,
401
+ SignAndExecuteResult,
402
+ SignPersonalMessageResult,
403
+ WalletAdapter,
404
+ DappKitSignerConfig,
405
+ DappKitSignAndExecuteFn,
406
+ DappKitSignPersonalMessageFn
407
+ } from './client/signers';
392
408
  export type {
393
409
  ClientMemoryManagerConfig,
394
410
  CreateMemoryOptions as ClientCreateMemoryOptions,
@@ -16,7 +16,7 @@
16
16
 
17
17
  import { SuiClient } from '@mysten/sui/client';
18
18
  import { Transaction } from '@mysten/sui/transactions';
19
- import { sha3_256 } from '@noble/hashes/sha3';
19
+ import { sha3_256 } from '@noble/hashes/sha3.js';
20
20
  import { bcs } from '@mysten/sui/bcs';
21
21
  import type {
22
22
  MemoryCap,
@@ -8,7 +8,7 @@
8
8
  import { SessionKey } from '@mysten/seal';
9
9
  import { Transaction } from '@mysten/sui/transactions';
10
10
  import { fromHex, toHex } from '@mysten/sui/utils';
11
- import { keccak_256 } from '@noble/hashes/sha3';
11
+ import { keccak_256 } from '@noble/hashes/sha3.js';
12
12
  import { SealService } from '../infrastructure/seal/SealService';
13
13
  import { CrossContextPermissionService } from './CrossContextPermissionService';
14
14
  import type {