@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.
- package/ARCHITECTURE.md +86 -2
- package/BENCHMARKS.md +2 -2
- package/README.md +43 -4
- package/dist/ai-sdk/types.d.ts +2 -2
- package/dist/ai-sdk/types.d.ts.map +1 -1
- package/dist/browser.d.ts +9 -9
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +16 -11
- package/dist/browser.js.map +1 -1
- package/dist/client/PersonalDataWallet.d.ts.map +1 -1
- package/dist/client/SimplePDWClient.d.ts.map +1 -1
- package/dist/client/SimplePDWClient.js +4 -4
- package/dist/client/SimplePDWClient.js.map +1 -1
- package/dist/client/namespaces/BatchNamespace.js +2 -2
- package/dist/client/namespaces/BatchNamespace.js.map +1 -1
- package/dist/client/namespaces/MemoryNamespace.js +3 -3
- package/dist/client/namespaces/MemoryNamespace.js.map +1 -1
- package/dist/client/namespaces/StorageNamespace.js +4 -4
- package/dist/client/namespaces/StorageNamespace.js.map +1 -1
- package/dist/client/namespaces/consolidated/StorageNamespace.js +2 -2
- package/dist/client/namespaces/consolidated/StorageNamespace.js.map +1 -1
- package/dist/client/signers/DappKitSigner.d.ts +136 -0
- package/dist/client/signers/DappKitSigner.d.ts.map +1 -0
- package/dist/client/signers/DappKitSigner.js +128 -0
- package/dist/client/signers/DappKitSigner.js.map +1 -0
- package/dist/client/signers/KeypairSigner.d.ts +4 -0
- package/dist/client/signers/KeypairSigner.d.ts.map +1 -1
- package/dist/client/signers/KeypairSigner.js +6 -0
- package/dist/client/signers/KeypairSigner.js.map +1 -1
- package/dist/client/signers/UnifiedSigner.d.ts +10 -0
- package/dist/client/signers/UnifiedSigner.d.ts.map +1 -1
- package/dist/client/signers/WalletAdapterSigner.d.ts +7 -0
- package/dist/client/signers/WalletAdapterSigner.d.ts.map +1 -1
- package/dist/client/signers/WalletAdapterSigner.js +9 -0
- package/dist/client/signers/WalletAdapterSigner.js.map +1 -1
- package/dist/client/signers/index.d.ts +3 -0
- package/dist/client/signers/index.d.ts.map +1 -1
- package/dist/client/signers/index.js +2 -0
- package/dist/client/signers/index.js.map +1 -1
- package/dist/generated/utils/index.js +1 -1
- package/dist/generated/utils/index.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/services/CapabilityService.js +1 -1
- package/dist/services/CapabilityService.js.map +1 -1
- package/dist/services/EncryptionService.js +1 -1
- package/dist/services/EncryptionService.js.map +1 -1
- package/dist/services/StorageService.d.ts +8 -8
- package/dist/services/StorageService.d.ts.map +1 -1
- package/dist/services/StorageService.js.map +1 -1
- package/dist/services/VectorService.js +2 -2
- package/dist/services/VectorService.js.map +1 -1
- package/dist/services/storage/BlobAttributesManager.d.ts +4 -4
- package/dist/services/storage/BlobAttributesManager.d.ts.map +1 -1
- package/dist/services/storage/BlobAttributesManager.js +6 -15
- package/dist/services/storage/BlobAttributesManager.js.map +1 -1
- package/dist/services/storage/QuiltBatchManager.d.ts +23 -5
- package/dist/services/storage/QuiltBatchManager.d.ts.map +1 -1
- package/dist/services/storage/QuiltBatchManager.js +118 -35
- package/dist/services/storage/QuiltBatchManager.js.map +1 -1
- package/dist/services/storage/WalrusMetadataManager.d.ts +2 -2
- package/dist/services/storage/WalrusMetadataManager.d.ts.map +1 -1
- package/dist/services/storage/WalrusMetadataManager.js +2 -5
- package/dist/services/storage/WalrusMetadataManager.js.map +1 -1
- package/dist/services/storage/WalrusStorageManager.d.ts +2 -2
- package/dist/services/storage/WalrusStorageManager.d.ts.map +1 -1
- package/dist/services/storage/WalrusStorageManager.js +7 -11
- package/dist/services/storage/WalrusStorageManager.js.map +1 -1
- package/dist/wallet/MainWalletService.js +1 -1
- package/dist/wallet/MainWalletService.js.map +1 -1
- package/package.json +10 -3
- package/src/ai-sdk/types.ts +2 -2
- package/src/browser.ts +19 -20
- package/src/client/SimplePDWClient.ts +18 -14
- package/src/client/namespaces/BatchNamespace.ts +2 -2
- package/src/client/namespaces/MemoryNamespace.ts +3 -3
- package/src/client/namespaces/StorageNamespace.ts +4 -4
- package/src/client/namespaces/consolidated/StorageNamespace.ts +2 -2
- package/src/client/signers/DappKitSigner.ts +207 -0
- package/src/client/signers/KeypairSigner.ts +7 -0
- package/src/client/signers/UnifiedSigner.ts +11 -0
- package/src/client/signers/WalletAdapterSigner.ts +10 -0
- package/src/client/signers/index.ts +7 -0
- package/src/generated/pdw/deps/sui/object.ts +12 -12
- package/src/generated/pdw/deps/sui/vec_map.ts +32 -32
- package/src/generated/pdw/memory.ts +1087 -1087
- package/src/generated/pdw/wallet.ts +123 -123
- package/src/generated/utils/index.ts +159 -159
- package/src/index.ts +16 -0
- package/src/services/CapabilityService.ts +1 -1
- package/src/services/EncryptionService.ts +1 -1
- package/src/services/StorageService.ts +8 -8
- package/src/services/VectorService.ts +2 -2
- package/src/services/storage/BlobAttributesManager.ts +10 -19
- package/src/services/storage/QuiltBatchManager.ts +139 -37
- package/src/services/storage/WalrusMetadataManager.ts +4 -7
- package/src/services/storage/WalrusStorageManager.ts +10 -13
- package/src/wallet/MainWalletService.ts +1 -1
- package/dist/api/client.d.ts +0 -43
- package/dist/api/client.d.ts.map +0 -1
- package/dist/api/client.js +0 -136
- package/dist/api/client.js.map +0 -1
- package/dist/chat/index.d.ts +0 -13
- package/dist/chat/index.d.ts.map +0 -1
- package/dist/chat/index.js +0 -14
- package/dist/chat/index.js.map +0 -1
- package/dist/client/namespaces/ChatNamespace.d.ts +0 -110
- package/dist/client/namespaces/ChatNamespace.d.ts.map +0 -1
- package/dist/client/namespaces/ChatNamespace.js +0 -123
- package/dist/client/namespaces/ChatNamespace.js.map +0 -1
- package/dist/encryption/index.d.ts +0 -14
- package/dist/encryption/index.d.ts.map +0 -1
- package/dist/encryption/index.js +0 -14
- package/dist/encryption/index.js.map +0 -1
- package/dist/graph/BrowserKnowledgeGraphManager.d.ts +0 -101
- package/dist/graph/BrowserKnowledgeGraphManager.d.ts.map +0 -1
- package/dist/graph/BrowserKnowledgeGraphManager.js +0 -411
- package/dist/graph/BrowserKnowledgeGraphManager.js.map +0 -1
- package/dist/hooks.wip/index.d.ts +0 -55
- package/dist/hooks.wip/index.d.ts.map +0 -1
- package/dist/hooks.wip/index.js +0 -58
- package/dist/hooks.wip/index.js.map +0 -1
- package/dist/hooks.wip/useCreateMemory.d.ts +0 -111
- package/dist/hooks.wip/useCreateMemory.d.ts.map +0 -1
- package/dist/hooks.wip/useCreateMemory.js +0 -149
- package/dist/hooks.wip/useCreateMemory.js.map +0 -1
- package/dist/hooks.wip/useCreateMemoryBatch.d.ts +0 -122
- package/dist/hooks.wip/useCreateMemoryBatch.d.ts.map +0 -1
- package/dist/hooks.wip/useCreateMemoryBatch.js +0 -221
- package/dist/hooks.wip/useCreateMemoryBatch.js.map +0 -1
- package/dist/hooks.wip/useKnowledgeGraph.d.ts +0 -66
- package/dist/hooks.wip/useKnowledgeGraph.d.ts.map +0 -1
- package/dist/hooks.wip/useKnowledgeGraph.js +0 -229
- package/dist/hooks.wip/useKnowledgeGraph.js.map +0 -1
- package/dist/hooks.wip/useMemoryChat.d.ts +0 -106
- package/dist/hooks.wip/useMemoryChat.d.ts.map +0 -1
- package/dist/hooks.wip/useMemoryChat.js +0 -284
- package/dist/hooks.wip/useMemoryChat.js.map +0 -1
- package/dist/hooks.wip/useMemoryIndex.d.ts +0 -90
- package/dist/hooks.wip/useMemoryIndex.d.ts.map +0 -1
- package/dist/hooks.wip/useMemoryIndex.js +0 -218
- package/dist/hooks.wip/useMemoryIndex.js.map +0 -1
- package/dist/hooks.wip/useMemoryManager.d.ts +0 -35
- package/dist/hooks.wip/useMemoryManager.d.ts.map +0 -1
- package/dist/hooks.wip/useMemoryManager.js +0 -86
- package/dist/hooks.wip/useMemoryManager.js.map +0 -1
- package/dist/hooks.wip/useMemorySearch.d.ts +0 -100
- package/dist/hooks.wip/useMemorySearch.d.ts.map +0 -1
- package/dist/hooks.wip/useMemorySearch.js +0 -278
- package/dist/hooks.wip/useMemorySearch.js.map +0 -1
- package/dist/hooks.wip/useMemoryServices.d.ts +0 -80
- package/dist/hooks.wip/useMemoryServices.d.ts.map +0 -1
- package/dist/hooks.wip/useMemoryServices.js +0 -264
- package/dist/hooks.wip/useMemoryServices.js.map +0 -1
- package/dist/hooks.wip/usePDWRAG.d.ts +0 -112
- package/dist/hooks.wip/usePDWRAG.d.ts.map +0 -1
- package/dist/hooks.wip/usePDWRAG.js +0 -121
- package/dist/hooks.wip/usePDWRAG.js.map +0 -1
- package/dist/hooks.wip/usePDWVectorStore.d.ts +0 -68
- package/dist/hooks.wip/usePDWVectorStore.d.ts.map +0 -1
- package/dist/hooks.wip/usePDWVectorStore.js +0 -102
- package/dist/hooks.wip/usePDWVectorStore.js.map +0 -1
- package/dist/hooks.wip/useRetrieveEmbedding.d.ts +0 -138
- package/dist/hooks.wip/useRetrieveEmbedding.d.ts.map +0 -1
- package/dist/hooks.wip/useRetrieveEmbedding.js +0 -121
- package/dist/hooks.wip/useRetrieveEmbedding.js.map +0 -1
- package/dist/hooks.wip/useSearchMemories.d.ts +0 -103
- package/dist/hooks.wip/useSearchMemories.d.ts.map +0 -1
- package/dist/hooks.wip/useSearchMemories.js +0 -146
- package/dist/hooks.wip/useSearchMemories.js.map +0 -1
- package/dist/hooks.wip/useStoreEmbedding.d.ts +0 -174
- package/dist/hooks.wip/useStoreEmbedding.d.ts.map +0 -1
- package/dist/hooks.wip/useStoreEmbedding.js +0 -167
- package/dist/hooks.wip/useStoreEmbedding.js.map +0 -1
- package/dist/hooks.wip/useWalletMemories.d.ts +0 -119
- package/dist/hooks.wip/useWalletMemories.d.ts.map +0 -1
- package/dist/hooks.wip/useWalletMemories.js +0 -166
- package/dist/hooks.wip/useWalletMemories.js.map +0 -1
- package/dist/hooks.wip/utils/cache.d.ts +0 -25
- package/dist/hooks.wip/utils/cache.d.ts.map +0 -1
- package/dist/hooks.wip/utils/cache.js +0 -38
- package/dist/hooks.wip/utils/cache.js.map +0 -1
- package/dist/hooks.wip/utils/types.d.ts +0 -138
- package/dist/hooks.wip/utils/types.d.ts.map +0 -1
- package/dist/hooks.wip/utils/types.js +0 -5
- package/dist/hooks.wip/utils/types.js.map +0 -1
- package/dist/infrastructure/ai/EmbeddingService.d.ts +0 -101
- package/dist/infrastructure/ai/EmbeddingService.d.ts.map +0 -1
- package/dist/infrastructure/ai/EmbeddingService.js +0 -242
- package/dist/infrastructure/ai/EmbeddingService.js.map +0 -1
- package/dist/infrastructure/ai/GeminiAIService.d.ts +0 -84
- package/dist/infrastructure/ai/GeminiAIService.d.ts.map +0 -1
- package/dist/infrastructure/ai/GeminiAIService.js +0 -300
- package/dist/infrastructure/ai/GeminiAIService.js.map +0 -1
- package/dist/infrastructure/ai/index.d.ts +0 -8
- package/dist/infrastructure/ai/index.d.ts.map +0 -1
- package/dist/infrastructure/ai/index.js +0 -8
- package/dist/infrastructure/ai/index.js.map +0 -1
- package/dist/memory/index.d.ts +0 -13
- package/dist/memory/index.d.ts.map +0 -1
- package/dist/memory/index.js +0 -14
- package/dist/memory/index.js.map +0 -1
- package/dist/services/ChatService.d.ts +0 -89
- package/dist/services/ChatService.d.ts.map +0 -1
- package/dist/services/ChatService.js +0 -319
- package/dist/services/ChatService.js.map +0 -1
- package/dist/transactions/index.d.ts +0 -13
- package/dist/transactions/index.d.ts.map +0 -1
- package/dist/transactions/index.js +0 -14
- package/dist/transactions/index.js.map +0 -1
- package/dist/types/wallet.d.ts +0 -12
- package/dist/types/wallet.d.ts.map +0 -1
- package/dist/types/wallet.js +0 -13
- package/dist/types/wallet.js.map +0 -1
- package/dist/view/ViewService.d.ts +0 -136
- package/dist/view/ViewService.d.ts.map +0 -1
- package/dist/view/ViewService.js +0 -325
- package/dist/view/ViewService.js.map +0 -1
- package/dist/view/index.d.ts +0 -7
- package/dist/view/index.d.ts.map +0 -1
- package/dist/view/index.js +0 -7
- package/dist/view/index.js.map +0 -1
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DappKit Signer Implementation
|
|
3
|
+
*
|
|
4
|
+
* Adapter for @mysten/dapp-kit hooks to work with SimplePDWClient.
|
|
5
|
+
* Bridges dApp-kit's hook-based API with SDK's UnifiedSigner interface.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { DappKitSigner, createSimplePDWClient } from '@cmdoss/memwal-sdk';
|
|
10
|
+
* import { useCurrentAccount, useSignAndExecuteTransaction, useSuiClient } from '@mysten/dapp-kit';
|
|
11
|
+
*
|
|
12
|
+
* function MyComponent() {
|
|
13
|
+
* const account = useCurrentAccount();
|
|
14
|
+
* const client = useSuiClient();
|
|
15
|
+
* const { mutateAsync: signAndExecute } = useSignAndExecuteTransaction();
|
|
16
|
+
*
|
|
17
|
+
* const signer = useMemo(() => {
|
|
18
|
+
* if (!account) return null;
|
|
19
|
+
* return new DappKitSigner({
|
|
20
|
+
* address: account.address,
|
|
21
|
+
* client,
|
|
22
|
+
* signAndExecuteTransaction: signAndExecute,
|
|
23
|
+
* });
|
|
24
|
+
* }, [account, client, signAndExecute]);
|
|
25
|
+
*
|
|
26
|
+
* // Now use signer with SDK
|
|
27
|
+
* const pdw = await createSimplePDWClient({ signer, network: 'testnet' });
|
|
28
|
+
* }
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @module client/signers
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
import type { Transaction } from '@mysten/sui/transactions';
|
|
35
|
+
import type { SuiClient } from '@mysten/sui/client';
|
|
36
|
+
import type { Signer } from '@mysten/sui/cryptography';
|
|
37
|
+
import type {
|
|
38
|
+
UnifiedSigner,
|
|
39
|
+
SignAndExecuteResult,
|
|
40
|
+
SignPersonalMessageResult
|
|
41
|
+
} from './UnifiedSigner';
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Function signature for dApp-kit's signAndExecuteTransaction
|
|
45
|
+
* Compatible with useSignAndExecuteTransaction().mutateAsync
|
|
46
|
+
*/
|
|
47
|
+
export interface DappKitSignAndExecuteFn {
|
|
48
|
+
(params: { transaction: Transaction }): Promise<{
|
|
49
|
+
digest: string;
|
|
50
|
+
effects?: any;
|
|
51
|
+
events?: any[];
|
|
52
|
+
objectChanges?: any[];
|
|
53
|
+
}>;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Function signature for dApp-kit's signPersonalMessage
|
|
58
|
+
* Compatible with useSignPersonalMessage().mutateAsync
|
|
59
|
+
*/
|
|
60
|
+
export interface DappKitSignPersonalMessageFn {
|
|
61
|
+
(params: { message: Uint8Array }): Promise<{
|
|
62
|
+
signature: string;
|
|
63
|
+
bytes?: Uint8Array;
|
|
64
|
+
}>;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Configuration for DappKitSigner
|
|
69
|
+
*/
|
|
70
|
+
export interface DappKitSignerConfig {
|
|
71
|
+
/**
|
|
72
|
+
* User's Sui address (from useCurrentAccount().address)
|
|
73
|
+
*/
|
|
74
|
+
address: string;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* SuiClient instance (from useSuiClient())
|
|
78
|
+
*/
|
|
79
|
+
client: SuiClient;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* signAndExecuteTransaction function (from useSignAndExecuteTransaction().mutateAsync)
|
|
83
|
+
*/
|
|
84
|
+
signAndExecuteTransaction: DappKitSignAndExecuteFn;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* signPersonalMessage function (from useSignPersonalMessage().mutateAsync)
|
|
88
|
+
* Optional - only required for operations that need message signing
|
|
89
|
+
*/
|
|
90
|
+
signPersonalMessage?: DappKitSignPersonalMessageFn;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Public key bytes (optional, from useCurrentAccount().publicKey)
|
|
94
|
+
*/
|
|
95
|
+
publicKey?: Uint8Array;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* DappKitSigner - Adapter for @mysten/dapp-kit hooks
|
|
100
|
+
*
|
|
101
|
+
* Wraps dApp-kit's useSignAndExecuteTransaction and useSignPersonalMessage hooks
|
|
102
|
+
* to provide a UnifiedSigner interface compatible with SDK managers.
|
|
103
|
+
*
|
|
104
|
+
* This adapter does NOT depend on React - it accepts function references
|
|
105
|
+
* that can come from dApp-kit hooks or any other source with compatible signatures.
|
|
106
|
+
*/
|
|
107
|
+
export class DappKitSigner implements UnifiedSigner {
|
|
108
|
+
private config: DappKitSignerConfig;
|
|
109
|
+
|
|
110
|
+
constructor(config: DappKitSignerConfig) {
|
|
111
|
+
if (!config.address) {
|
|
112
|
+
throw new Error('DappKitSigner requires an address');
|
|
113
|
+
}
|
|
114
|
+
if (!config.client) {
|
|
115
|
+
throw new Error('DappKitSigner requires a SuiClient');
|
|
116
|
+
}
|
|
117
|
+
if (!config.signAndExecuteTransaction) {
|
|
118
|
+
throw new Error('DappKitSigner requires signAndExecuteTransaction function');
|
|
119
|
+
}
|
|
120
|
+
this.config = config;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Sign and execute transaction using dApp-kit hook
|
|
125
|
+
*
|
|
126
|
+
* Wraps the dApp-kit signAndExecuteTransaction function and waits for
|
|
127
|
+
* transaction finalization to prevent gas coin version conflicts.
|
|
128
|
+
*/
|
|
129
|
+
async signAndExecuteTransaction(transaction: Transaction): Promise<SignAndExecuteResult> {
|
|
130
|
+
const result = await this.config.signAndExecuteTransaction({ transaction });
|
|
131
|
+
|
|
132
|
+
// Wait for transaction to be finalized (important for gas coin versioning)
|
|
133
|
+
if (result.digest) {
|
|
134
|
+
try {
|
|
135
|
+
await this.config.client.waitForTransaction({ digest: result.digest });
|
|
136
|
+
} catch (waitError) {
|
|
137
|
+
console.warn('DappKitSigner: waitForTransaction failed:', waitError);
|
|
138
|
+
// Continue anyway - transaction was submitted
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
return {
|
|
143
|
+
digest: result.digest,
|
|
144
|
+
effects: result.effects,
|
|
145
|
+
events: result.events,
|
|
146
|
+
objectChanges: result.objectChanges,
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Sign personal message using dApp-kit hook
|
|
152
|
+
*
|
|
153
|
+
* Required for SEAL encryption identity and other message signing operations.
|
|
154
|
+
*/
|
|
155
|
+
async signPersonalMessage(message: Uint8Array): Promise<SignPersonalMessageResult> {
|
|
156
|
+
if (!this.config.signPersonalMessage) {
|
|
157
|
+
throw new Error(
|
|
158
|
+
'DappKitSigner: signPersonalMessage not configured. ' +
|
|
159
|
+
'Pass signPersonalMessage function from useSignPersonalMessage().mutateAsync'
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
const result = await this.config.signPersonalMessage({ message });
|
|
164
|
+
|
|
165
|
+
return {
|
|
166
|
+
signature: result.signature,
|
|
167
|
+
bytes: result.bytes || message,
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Get Sui address
|
|
173
|
+
*/
|
|
174
|
+
getAddress(): string {
|
|
175
|
+
return this.config.address;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Get public key (if available)
|
|
180
|
+
*/
|
|
181
|
+
getPublicKey(): Uint8Array | null {
|
|
182
|
+
return this.config.publicKey || null;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Get underlying Signer
|
|
187
|
+
*
|
|
188
|
+
* Note: dApp-kit does not expose the underlying Signer for security reasons.
|
|
189
|
+
* Use KeypairSigner for backend/Node.js environments that need raw Signer access.
|
|
190
|
+
*/
|
|
191
|
+
getSigner(): Signer {
|
|
192
|
+
throw new Error(
|
|
193
|
+
'DappKitSigner does not expose underlying Signer. ' +
|
|
194
|
+
'Browser wallets do not provide raw Signer access for security. ' +
|
|
195
|
+
'Use KeypairSigner for backend/Node.js environments.'
|
|
196
|
+
);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Get SuiClient
|
|
201
|
+
*
|
|
202
|
+
* Returns the SuiClient instance for managers that need to build transactions.
|
|
203
|
+
*/
|
|
204
|
+
getClient(): SuiClient {
|
|
205
|
+
return this.config.client;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
import type { Transaction } from '@mysten/sui/transactions';
|
|
14
14
|
import type { Signer } from '@mysten/sui/cryptography';
|
|
15
|
+
import type { SuiClient } from '@mysten/sui/client';
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
18
|
* Result of signing and executing a transaction
|
|
@@ -96,4 +97,14 @@ export interface UnifiedSigner {
|
|
|
96
97
|
* @returns Signer instance or throws error if not available
|
|
97
98
|
*/
|
|
98
99
|
getSigner(): Signer;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Get the SuiClient instance (optional)
|
|
103
|
+
*
|
|
104
|
+
* Used by managers that need to build transactions or wait for confirmations.
|
|
105
|
+
* Returns null if not available (e.g., WalletAdapterSigner).
|
|
106
|
+
*
|
|
107
|
+
* @returns SuiClient instance or null
|
|
108
|
+
*/
|
|
109
|
+
getClient?(): SuiClient | null;
|
|
99
110
|
}
|
|
@@ -146,4 +146,14 @@ export class WalletAdapterSigner implements UnifiedSigner {
|
|
|
146
146
|
'Use KeypairSigner for backend/Node.js environments.'
|
|
147
147
|
);
|
|
148
148
|
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Get SuiClient instance
|
|
152
|
+
*
|
|
153
|
+
* Note: WalletAdapter doesn't provide SuiClient.
|
|
154
|
+
* Use DappKitSigner if you need client access.
|
|
155
|
+
*/
|
|
156
|
+
getClient(): null {
|
|
157
|
+
return null;
|
|
158
|
+
}
|
|
149
159
|
}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* Unified signer interface supporting multiple signing methods:
|
|
5
5
|
* - Keypair (Node.js, backend, CLI)
|
|
6
6
|
* - WalletAdapter (Browser, React dApps)
|
|
7
|
+
* - DappKit (Browser, @mysten/dapp-kit hooks)
|
|
7
8
|
*
|
|
8
9
|
* @module client/signers
|
|
9
10
|
*/
|
|
@@ -17,3 +18,9 @@ export type {
|
|
|
17
18
|
export { KeypairSigner } from './KeypairSigner';
|
|
18
19
|
export { WalletAdapterSigner } from './WalletAdapterSigner';
|
|
19
20
|
export type { WalletAdapter } from './WalletAdapterSigner';
|
|
21
|
+
export { DappKitSigner } from './DappKitSigner';
|
|
22
|
+
export type {
|
|
23
|
+
DappKitSignerConfig,
|
|
24
|
+
DappKitSignAndExecuteFn,
|
|
25
|
+
DappKitSignPersonalMessageFn
|
|
26
|
+
} from './DappKitSigner';
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
/**************************************************************
|
|
2
|
-
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
-
**************************************************************/
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
/** Sui object identifiers */
|
|
7
|
-
|
|
8
|
-
import { MoveStruct } from '../../../utils/index.js';
|
|
9
|
-
import { bcs } from '@mysten/sui/bcs';
|
|
10
|
-
const $moduleName = '0x2::object';
|
|
11
|
-
export const UID = new MoveStruct({ name: `${$moduleName}::UID`, fields: {
|
|
12
|
-
id: bcs.Address
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
/** Sui object identifiers */
|
|
7
|
+
|
|
8
|
+
import { MoveStruct } from '../../../utils/index.js';
|
|
9
|
+
import { bcs } from '@mysten/sui/bcs';
|
|
10
|
+
const $moduleName = '0x2::object';
|
|
11
|
+
export const UID = new MoveStruct({ name: `${$moduleName}::UID`, fields: {
|
|
12
|
+
id: bcs.Address
|
|
13
13
|
} });
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
/**************************************************************
|
|
2
|
-
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
-
**************************************************************/
|
|
4
|
-
import { type BcsType, bcs } from '@mysten/sui/bcs';
|
|
5
|
-
import { MoveStruct } from '../../../utils/index.js';
|
|
6
|
-
const $moduleName = '0x2::vec_map';
|
|
7
|
-
/** An entry in the map */
|
|
8
|
-
export function Entry<K extends BcsType<any>, V extends BcsType<any>>(...typeParameters: [
|
|
9
|
-
K,
|
|
10
|
-
V
|
|
11
|
-
]) {
|
|
12
|
-
return new MoveStruct({ name: `${$moduleName}::Entry<${typeParameters[0].name as K['name']}, ${typeParameters[1].name as V['name']}>`, fields: {
|
|
13
|
-
key: typeParameters[0],
|
|
14
|
-
value: typeParameters[1]
|
|
15
|
-
} });
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* A map data structure backed by a vector. The map is guaranteed not to contain
|
|
19
|
-
* duplicate keys, but entries are _not_ sorted by key--entries are included in
|
|
20
|
-
* insertion order. All operations are O(N) in the size of the map--the intention
|
|
21
|
-
* of this data structure is only to provide the convenience of programming against
|
|
22
|
-
* a map API. Large maps should use handwritten parent/child relationships instead.
|
|
23
|
-
* Maps that need sorted iteration rather than insertion order iteration should
|
|
24
|
-
* also be handwritten.
|
|
25
|
-
*/
|
|
26
|
-
export function VecMap<K extends BcsType<any>, V extends BcsType<any>>(...typeParameters: [
|
|
27
|
-
K,
|
|
28
|
-
V
|
|
29
|
-
]) {
|
|
30
|
-
return new MoveStruct({ name: `${$moduleName}::VecMap<${typeParameters[0].name as K['name']}, ${typeParameters[1].name as V['name']}>`, fields: {
|
|
31
|
-
contents: bcs.vector(Entry(typeParameters[0], typeParameters[1]))
|
|
32
|
-
} });
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
import { type BcsType, bcs } from '@mysten/sui/bcs';
|
|
5
|
+
import { MoveStruct } from '../../../utils/index.js';
|
|
6
|
+
const $moduleName = '0x2::vec_map';
|
|
7
|
+
/** An entry in the map */
|
|
8
|
+
export function Entry<K extends BcsType<any>, V extends BcsType<any>>(...typeParameters: [
|
|
9
|
+
K,
|
|
10
|
+
V
|
|
11
|
+
]) {
|
|
12
|
+
return new MoveStruct({ name: `${$moduleName}::Entry<${typeParameters[0].name as K['name']}, ${typeParameters[1].name as V['name']}>`, fields: {
|
|
13
|
+
key: typeParameters[0],
|
|
14
|
+
value: typeParameters[1]
|
|
15
|
+
} });
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* A map data structure backed by a vector. The map is guaranteed not to contain
|
|
19
|
+
* duplicate keys, but entries are _not_ sorted by key--entries are included in
|
|
20
|
+
* insertion order. All operations are O(N) in the size of the map--the intention
|
|
21
|
+
* of this data structure is only to provide the convenience of programming against
|
|
22
|
+
* a map API. Large maps should use handwritten parent/child relationships instead.
|
|
23
|
+
* Maps that need sorted iteration rather than insertion order iteration should
|
|
24
|
+
* also be handwritten.
|
|
25
|
+
*/
|
|
26
|
+
export function VecMap<K extends BcsType<any>, V extends BcsType<any>>(...typeParameters: [
|
|
27
|
+
K,
|
|
28
|
+
V
|
|
29
|
+
]) {
|
|
30
|
+
return new MoveStruct({ name: `${$moduleName}::VecMap<${typeParameters[0].name as K['name']}, ${typeParameters[1].name as V['name']}>`, fields: {
|
|
31
|
+
contents: bcs.vector(Entry(typeParameters[0], typeParameters[1]))
|
|
32
|
+
} });
|
|
33
33
|
}
|