privacycash 1.1.21 → 1.1.22
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 +6 -5
- package/package.json +1 -1
- package/src/deposit.ts +6 -5
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
|
-
|
|
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
|
-
|
|
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;
|
package/package.json
CHANGED
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
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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 =
|
|
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
|
|