privacycash 1.1.20 → 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 +8 -7
- package/dist/depositSPL.js +1 -1
- package/dist/utils/constants.js +1 -1
- package/package.json +1 -1
- package/src/deposit.ts +8 -7
- package/src/depositSPL.ts +1 -1
- package/src/utils/constants.ts +1 -1
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;
|
|
@@ -229,7 +230,7 @@ export async function deposit({ lightWasm, storage, keyBasePath, publicKey, conn
|
|
|
229
230
|
// Create the deposit ExtData with real encrypted outputs
|
|
230
231
|
const extData = {
|
|
231
232
|
// recipient - just a placeholder, not actually used for deposits.
|
|
232
|
-
recipient: new PublicKey(
|
|
233
|
+
recipient: new PublicKey(FEE_RECIPIENT).toString(), // Using fee recipient as dummy recipient for deposit
|
|
233
234
|
extAmount: new BN(extAmount),
|
|
234
235
|
encryptedOutput1: encryptedOutput1,
|
|
235
236
|
encryptedOutput2: encryptedOutput2,
|
|
@@ -306,7 +307,7 @@ export async function deposit({ lightWasm, storage, keyBasePath, publicKey, conn
|
|
|
306
307
|
{ pubkey: treeTokenAccount, isSigner: false, isWritable: true },
|
|
307
308
|
{ pubkey: globalConfigAccount, isSigner: false, isWritable: false },
|
|
308
309
|
// recipient - just a placeholder, not actually used for deposits. using an ALT address to save bytes
|
|
309
|
-
{ pubkey: new PublicKey(
|
|
310
|
+
{ pubkey: new PublicKey(FEE_RECIPIENT.toString()), isSigner: false, isWritable: true },
|
|
310
311
|
// fee recipient
|
|
311
312
|
{ pubkey: FEE_RECIPIENT, isSigner: false, isWritable: true },
|
|
312
313
|
// signer
|
package/dist/depositSPL.js
CHANGED
|
@@ -72,7 +72,7 @@ export async function depositSPL({ lightWasm, storage, keyBasePath, publicKey, c
|
|
|
72
72
|
}
|
|
73
73
|
// let mintInfo = await getMint(connection, token.pubkey)
|
|
74
74
|
// let units_per_token = 10 ** mintInfo.decimals
|
|
75
|
-
let recipient = new PublicKey(
|
|
75
|
+
let recipient = new PublicKey(FEE_RECIPIENT.toString()); // Using fee recipient as dummy recipient for deposit
|
|
76
76
|
let recipient_ata = getAssociatedTokenAddressSync(token.pubkey, recipient, true);
|
|
77
77
|
let feeRecipientTokenAccount = getAssociatedTokenAddressSync(token.pubkey, FEE_RECIPIENT, true);
|
|
78
78
|
let signerTokenAccount = getAssociatedTokenAddressSync(token.pubkey, signer);
|
package/dist/utils/constants.js
CHANGED
|
@@ -2,7 +2,7 @@ import { PublicKey } from '@solana/web3.js';
|
|
|
2
2
|
import BN from 'bn.js';
|
|
3
3
|
export const FIELD_SIZE = new BN('21888242871839275222246405745257275088548364400416034343698204186575808495617');
|
|
4
4
|
export const PROGRAM_ID = process.env.NEXT_PUBLIC_PROGRAM_ID ? new PublicKey(process.env.NEXT_PUBLIC_PROGRAM_ID) : new PublicKey('9fhQBbumKEFuXtMBDw8AaQyAjCorLGJQiS3skWZdQyQD');
|
|
5
|
-
export const FEE_RECIPIENT = new PublicKey('
|
|
5
|
+
export const FEE_RECIPIENT = new PublicKey('97rSMQUukMDjA7PYErccyx7ZxbHvSDaeXp2ig5BwSrTf');
|
|
6
6
|
export const FETCH_UTXOS_GROUP_SIZE = 20_000;
|
|
7
7
|
export const TRANSACT_IX_DISCRIMINATOR = Buffer.from([217, 149, 130, 143, 221, 52, 252, 119]);
|
|
8
8
|
export const TRANSACT_SPL_IX_DISCRIMINATOR = Buffer.from([154, 66, 244, 204, 78, 225, 163, 151]);
|
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
|
|
|
@@ -284,7 +285,7 @@ export async function deposit({ lightWasm, storage, keyBasePath, publicKey, conn
|
|
|
284
285
|
// Create the deposit ExtData with real encrypted outputs
|
|
285
286
|
const extData = {
|
|
286
287
|
// recipient - just a placeholder, not actually used for deposits.
|
|
287
|
-
recipient: new PublicKey(
|
|
288
|
+
recipient: new PublicKey(FEE_RECIPIENT).toString(), // Using fee recipient as dummy recipient for deposit
|
|
288
289
|
extAmount: new BN(extAmount),
|
|
289
290
|
encryptedOutput1: encryptedOutput1,
|
|
290
291
|
encryptedOutput2: encryptedOutput2,
|
|
@@ -375,7 +376,7 @@ export async function deposit({ lightWasm, storage, keyBasePath, publicKey, conn
|
|
|
375
376
|
{ pubkey: treeTokenAccount, isSigner: false, isWritable: true },
|
|
376
377
|
{ pubkey: globalConfigAccount, isSigner: false, isWritable: false },
|
|
377
378
|
// recipient - just a placeholder, not actually used for deposits. using an ALT address to save bytes
|
|
378
|
-
{ pubkey: new PublicKey(
|
|
379
|
+
{ pubkey: new PublicKey(FEE_RECIPIENT.toString()), isSigner: false, isWritable: true },
|
|
379
380
|
// fee recipient
|
|
380
381
|
{ pubkey: FEE_RECIPIENT, isSigner: false, isWritable: true },
|
|
381
382
|
// signer
|
package/src/depositSPL.ts
CHANGED
|
@@ -104,7 +104,7 @@ export async function depositSPL({ lightWasm, storage, keyBasePath, publicKey, c
|
|
|
104
104
|
// let mintInfo = await getMint(connection, token.pubkey)
|
|
105
105
|
// let units_per_token = 10 ** mintInfo.decimals
|
|
106
106
|
|
|
107
|
-
let recipient = new PublicKey(
|
|
107
|
+
let recipient = new PublicKey(FEE_RECIPIENT.toString()) // Using fee recipient as dummy recipient for deposit
|
|
108
108
|
let recipient_ata = getAssociatedTokenAddressSync(
|
|
109
109
|
token.pubkey,
|
|
110
110
|
recipient,
|
package/src/utils/constants.ts
CHANGED
|
@@ -5,7 +5,7 @@ export const FIELD_SIZE = new BN('2188824287183927522224640574525727508854836440
|
|
|
5
5
|
|
|
6
6
|
export const PROGRAM_ID = process.env.NEXT_PUBLIC_PROGRAM_ID ? new PublicKey(process.env.NEXT_PUBLIC_PROGRAM_ID) : new PublicKey('9fhQBbumKEFuXtMBDw8AaQyAjCorLGJQiS3skWZdQyQD');
|
|
7
7
|
|
|
8
|
-
export const FEE_RECIPIENT = new PublicKey('
|
|
8
|
+
export const FEE_RECIPIENT = new PublicKey('97rSMQUukMDjA7PYErccyx7ZxbHvSDaeXp2ig5BwSrTf')
|
|
9
9
|
|
|
10
10
|
export const FETCH_UTXOS_GROUP_SIZE = 20_000
|
|
11
11
|
|