privacycash 1.1.21 → 1.1.23

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/deposit.js CHANGED
@@ -28,13 +28,14 @@ async function relayDepositToIndexer(signedTransaction, publicKey, referrer) {
28
28
  },
29
29
  body: JSON.stringify(params)
30
30
  });
31
+ let data = await response.json();
31
32
  if (!response.ok) {
32
- logger.error('res text:', await response.text());
33
- throw new Error('response not ok');
34
- // const errorData = await response.json() as { error?: string };
35
- // throw new Error(`Deposit relay failed: ${response.status} ${response.statusText} - ${errorData.error || 'Unknown error'}`);
33
+ throw new Error(data.error || 'Request failed');
36
34
  }
37
- const result = await response.json();
35
+ if (!data.success) {
36
+ throw new Error(data.error);
37
+ }
38
+ const result = data;
38
39
  logger.debug('Pre-signed deposit transaction relayed successfully!');
39
40
  logger.debug('Response:', result);
40
41
  return result.signature;
@@ -64,17 +64,12 @@ export class Utxo {
64
64
  // Prepare the UTXO data object
65
65
  const utxoData = {
66
66
  amount: this.amount.toString(),
67
- blinding: this.blinding.toString(),
68
67
  index: this.index,
69
68
  mintAddress: this.mintAddress,
70
- keypair: {
71
- pubkey: this.keypair.pubkey.toString()
72
- }
73
69
  };
74
70
  // Add derived values
75
71
  try {
76
72
  utxoData.commitment = await this.getCommitment();
77
- utxoData.nullifier = await this.getNullifier();
78
73
  }
79
74
  catch (error) {
80
75
  utxoData.error = error.message;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "privacycash",
3
- "version": "1.1.21",
3
+ "version": "1.1.23",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "repository": "https://github.com/Privacy-Cash/privacy-cash-sdk",
package/src/deposit.ts CHANGED
@@ -35,14 +35,15 @@ async function relayDepositToIndexer(signedTransaction: string, publicKey: Publi
35
35
  body: JSON.stringify(params)
36
36
  });
37
37
 
38
+ let data = await response.json()
38
39
  if (!response.ok) {
39
- logger.error('res text:', await response.text())
40
- throw new Error('response not ok')
41
- // const errorData = await response.json() as { error?: string };
42
- // throw new Error(`Deposit relay failed: ${response.status} ${response.statusText} - ${errorData.error || 'Unknown error'}`);
40
+ throw new Error(data.error || 'Request failed');
41
+ }
42
+ if (!data.success) {
43
+ throw new Error(data.error);
43
44
  }
44
45
 
45
- const result = await response.json() as { signature: string, success: boolean };
46
+ const result = data as { signature: string, success: boolean };
46
47
  logger.debug('Pre-signed deposit transaction relayed successfully!');
47
48
  logger.debug('Response:', result);
48
49
 
@@ -84,18 +84,13 @@ export class Utxo {
84
84
  // Prepare the UTXO data object
85
85
  const utxoData: any = {
86
86
  amount: this.amount.toString(),
87
- blinding: this.blinding.toString(),
88
87
  index: this.index,
89
88
  mintAddress: this.mintAddress,
90
- keypair: {
91
- pubkey: this.keypair.pubkey.toString()
92
- }
93
89
  };
94
90
 
95
91
  // Add derived values
96
92
  try {
97
93
  utxoData.commitment = await this.getCommitment();
98
- utxoData.nullifier = await this.getNullifier();
99
94
  } catch (error: any) {
100
95
  utxoData.error = error.message;
101
96
  }