privacycash 1.0.11 → 1.0.12
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/getUtxos.js +3 -0
- package/dist/withdraw.js +4 -0
- package/package.json +1 -1
- package/src/getUtxos.ts +3 -0
- package/src/withdraw.ts +4 -1
package/dist/getUtxos.js
CHANGED
|
@@ -60,6 +60,7 @@ export async function getUtxos({ publicKey, connection, encryptionService, stora
|
|
|
60
60
|
const spentFlags = await areUtxosSpent(connection, nonZeroUtxos);
|
|
61
61
|
for (let i = 0; i < nonZeroUtxos.length; i++) {
|
|
62
62
|
if (!spentFlags[i]) {
|
|
63
|
+
logger.debug(`found unspent encrypted_output ${nonZeroEncrypted[i]}`);
|
|
63
64
|
am += nonZeroUtxos[i].amount.toNumber();
|
|
64
65
|
valid_utxos.push(nonZeroUtxos[i]);
|
|
65
66
|
valid_strings.push(nonZeroEncrypted[i]);
|
|
@@ -80,7 +81,9 @@ export async function getUtxos({ publicKey, connection, encryptionService, stora
|
|
|
80
81
|
getMyUtxosPromise = null;
|
|
81
82
|
}
|
|
82
83
|
// store valid strings
|
|
84
|
+
logger.debug(`valid_strings len before set: ${valid_strings.length}`);
|
|
83
85
|
valid_strings = [...new Set(valid_strings)];
|
|
86
|
+
logger.debug(`valid_strings len after set: ${valid_strings.length}`);
|
|
84
87
|
storage.setItem(LSK_ENCRYPTED_OUTPUTS + localstorageKey(publicKey), JSON.stringify(valid_strings));
|
|
85
88
|
return valid_utxos;
|
|
86
89
|
})();
|
package/dist/withdraw.js
CHANGED
|
@@ -74,6 +74,8 @@ export async function withdraw({ recipient, lightWasm, storage, publicKey, conne
|
|
|
74
74
|
amount: '0'
|
|
75
75
|
});
|
|
76
76
|
const inputs = [firstInput, secondInput];
|
|
77
|
+
logger.debug(`firstInput index: ${firstInput.index}, commitment: ${firstInput.getCommitment()}`);
|
|
78
|
+
logger.debug(`secondInput index: ${secondInput.index}, commitment: ${secondInput.getCommitment()}`);
|
|
77
79
|
const totalInputAmount = firstInput.amount.add(secondInput.amount);
|
|
78
80
|
logger.debug(`Using UTXO with amount: ${firstInput.amount.toString()} and ${secondInput.amount.gt(new BN(0)) ? 'second UTXO with amount: ' + secondInput.amount.toString() : 'dummy UTXO'}`);
|
|
79
81
|
if (totalInputAmount.toNumber() === 0) {
|
|
@@ -146,6 +148,8 @@ export async function withdraw({ recipient, lightWasm, storage, publicKey, conne
|
|
|
146
148
|
await outputs[0].log();
|
|
147
149
|
logger.debug(`\nOutput[1] (empty):`);
|
|
148
150
|
await outputs[1].log();
|
|
151
|
+
logger.debug(`Encrypted output 1: ${encryptedOutput1.toString('hex')}`);
|
|
152
|
+
logger.debug(`Encrypted output 2: ${encryptedOutput2.toString('hex')}`);
|
|
149
153
|
logger.debug(`\nEncrypted output 1 size: ${encryptedOutput1.length} bytes`);
|
|
150
154
|
logger.debug(`Encrypted output 2 size: ${encryptedOutput2.length} bytes`);
|
|
151
155
|
logger.debug(`Total encrypted outputs size: ${encryptedOutput1.length + encryptedOutput2.length} bytes`);
|
package/package.json
CHANGED
package/src/getUtxos.ts
CHANGED
|
@@ -90,6 +90,7 @@ export async function getUtxos({ publicKey, connection, encryptionService, stora
|
|
|
90
90
|
const spentFlags = await areUtxosSpent(connection, nonZeroUtxos);
|
|
91
91
|
for (let i = 0; i < nonZeroUtxos.length; i++) {
|
|
92
92
|
if (!spentFlags[i]) {
|
|
93
|
+
logger.debug(`found unspent encrypted_output ${nonZeroEncrypted[i]}`)
|
|
93
94
|
am += nonZeroUtxos[i].amount.toNumber();
|
|
94
95
|
valid_utxos.push(nonZeroUtxos[i]);
|
|
95
96
|
valid_strings.push(nonZeroEncrypted[i]);
|
|
@@ -108,7 +109,9 @@ export async function getUtxos({ publicKey, connection, encryptionService, stora
|
|
|
108
109
|
getMyUtxosPromise = null
|
|
109
110
|
}
|
|
110
111
|
// store valid strings
|
|
112
|
+
logger.debug(`valid_strings len before set: ${valid_strings.length}`)
|
|
111
113
|
valid_strings = [...new Set(valid_strings)];
|
|
114
|
+
logger.debug(`valid_strings len after set: ${valid_strings.length}`)
|
|
112
115
|
storage.setItem(LSK_ENCRYPTED_OUTPUTS + localstorageKey(publicKey), JSON.stringify(valid_strings))
|
|
113
116
|
return valid_utxos
|
|
114
117
|
})()
|
package/src/withdraw.ts
CHANGED
|
@@ -107,6 +107,8 @@ export async function withdraw({ recipient, lightWasm, storage, publicKey, conne
|
|
|
107
107
|
});
|
|
108
108
|
|
|
109
109
|
const inputs = [firstInput, secondInput];
|
|
110
|
+
logger.debug(`firstInput index: ${firstInput.index}, commitment: ${firstInput.getCommitment()}`)
|
|
111
|
+
logger.debug(`secondInput index: ${secondInput.index}, commitment: ${secondInput.getCommitment()}`)
|
|
110
112
|
const totalInputAmount = firstInput.amount.add(secondInput.amount);
|
|
111
113
|
logger.debug(`Using UTXO with amount: ${firstInput.amount.toString()} and ${secondInput.amount.gt(new BN(0)) ? 'second UTXO with amount: ' + secondInput.amount.toString() : 'dummy UTXO'}`);
|
|
112
114
|
if (totalInputAmount.toNumber() === 0) {
|
|
@@ -192,7 +194,8 @@ export async function withdraw({ recipient, lightWasm, storage, publicKey, conne
|
|
|
192
194
|
await outputs[0].log();
|
|
193
195
|
logger.debug(`\nOutput[1] (empty):`);
|
|
194
196
|
await outputs[1].log();
|
|
195
|
-
|
|
197
|
+
logger.debug(`Encrypted output 1: ${encryptedOutput1.toString('hex')}`)
|
|
198
|
+
logger.debug(`Encrypted output 2: ${encryptedOutput2.toString('hex')}`)
|
|
196
199
|
logger.debug(`\nEncrypted output 1 size: ${encryptedOutput1.length} bytes`);
|
|
197
200
|
logger.debug(`Encrypted output 2 size: ${encryptedOutput2.length} bytes`);
|
|
198
201
|
logger.debug(`Total encrypted outputs size: ${encryptedOutput1.length + encryptedOutput2.length} bytes`);
|