mmn-client-js 1.0.3 → 1.0.5

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/dist/index.d.ts CHANGED
@@ -57,6 +57,19 @@ interface SignedTx {
57
57
  tx_msg: TxMsg;
58
58
  signature: string;
59
59
  }
60
+ interface SendTransactionRequest {
61
+ sender: string;
62
+ recipient: string;
63
+ amount: string;
64
+ nonce: number;
65
+ timestamp?: number;
66
+ textData?: string;
67
+ extraInfo?: ExtraInfo;
68
+ publicKey: string;
69
+ privateKey: string;
70
+ zkProof: string;
71
+ zkPub: string;
72
+ }
60
73
  interface AddTxResponse {
61
74
  ok: boolean;
62
75
  tx_hash: string;
@@ -181,8 +194,14 @@ declare class MmnClient {
181
194
  */
182
195
  private rawEd25519ToPkcs8Hex;
183
196
  private encodeLength;
197
+ /**
198
+ * Generate secure entropy using multiple sources for maximum compatibility
199
+ * @returns Array of 32 random bytes
200
+ */
201
+ private generateSecureEntropy;
184
202
  /**
185
203
  * Securely generate ephemeral key pair with proper entropy
204
+ * React Native compatible version with multiple fallbacks
186
205
  * @returns Ephemeral key pair with private and public keys
187
206
  * @throws Error if key generation fails
188
207
  */
@@ -211,25 +230,13 @@ declare class MmnClient {
211
230
  /**
212
231
  * Send a transaction (create, sign, and submit)
213
232
  */
214
- sendTransaction(params: {
215
- sender: string;
216
- recipient: string;
217
- amount: string;
218
- nonce: number;
219
- timestamp?: number;
220
- textData?: string;
221
- extraInfo?: ExtraInfo;
222
- publicKey: string;
223
- privateKey: string;
224
- zkProof: string;
225
- zkPub: string;
226
- }): Promise<AddTxResponse>;
233
+ sendTransaction(params: SendTransactionRequest): Promise<AddTxResponse>;
227
234
  /**
228
235
  * Get current nonce for an account
229
236
  */
230
- getCurrentNonce(address: string, tag?: 'latest' | 'pending'): Promise<GetCurrentNonceResponse>;
237
+ getCurrentNonce(userId: string, tag?: 'latest' | 'pending'): Promise<GetCurrentNonceResponse>;
231
238
  getAccountByUserId(userId: string): Promise<GetAccountByAddressResponse>;
232
- scaleAmountToDecimals(originalAmount: string | number, decimals: number): string;
239
+ scaleAmountToDecimals(originalAmount: string | number, decimals?: number): string;
233
240
  }
234
241
  declare function createMmnClient(config: MmnClientConfig): MmnClient;
235
242
 
@@ -247,4 +254,4 @@ declare class ZkClient {
247
254
  }
248
255
 
249
256
  export { ETransferType, IndexerClient, MmnClient, ZkClient, createMmnClient };
250
- export type { AddTxResponse, ExtraInfo, GetAccountByAddressResponse, GetCurrentNonceResponse, IEphemeralKeyPair, IZkProof, IndexerClientConfig, JsonRpcError, JsonRpcRequest, JsonRpcResponse, ListTransactionResponse, Meta, MmnClientConfig, SignedTx, Transaction, TransactionDetailResponse, TxMsg, WalletDetail, WalletDetailResponse, ZkClientConfig };
257
+ export type { AddTxResponse, ExtraInfo, GetAccountByAddressResponse, GetCurrentNonceResponse, IEphemeralKeyPair, IZkProof, IndexerClientConfig, JsonRpcError, JsonRpcRequest, JsonRpcResponse, ListTransactionResponse, Meta, MmnClientConfig, SendTransactionRequest, SignedTx, Transaction, TransactionDetailResponse, TxMsg, WalletDetail, WalletDetailResponse, ZkClientConfig };