@fairblock/stabletrust 1.0.18 → 1.0.19
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/package.json +1 -1
- package/src/client.js +1 -2
- package/src/crypto.js +1 -1
- package/src/utils.js +2 -2
package/package.json
CHANGED
package/src/client.js
CHANGED
|
@@ -381,7 +381,7 @@ export class ConfidentialTransferClient {
|
|
|
381
381
|
tokenContract.balanceOf(address),
|
|
382
382
|
tokenContract.allowance(address, this.config.contractAddress),
|
|
383
383
|
]);
|
|
384
|
-
if (tokenBalance <
|
|
384
|
+
if (tokenBalance < BigInt(amount)) {
|
|
385
385
|
throw new Error(
|
|
386
386
|
`Insufficient token balance. Required: ${amount}, Available: ${tokenBalance}`,
|
|
387
387
|
);
|
|
@@ -648,7 +648,6 @@ export class ConfidentialTransferClient {
|
|
|
648
648
|
}
|
|
649
649
|
|
|
650
650
|
const address = await wallet.getAddress();
|
|
651
|
-
|
|
652
651
|
// Fetch balance first — only apply pending if available is insufficient
|
|
653
652
|
let balanceSummary = await this.getConfidentialBalance(
|
|
654
653
|
address,
|
package/src/crypto.js
CHANGED
|
@@ -31,7 +31,7 @@ export async function deriveKeys(wallet, config, generateKeypair) {
|
|
|
31
31
|
[config.chainId, config.contractAddress, ethers.ZeroAddress, "main"],
|
|
32
32
|
),
|
|
33
33
|
);
|
|
34
|
-
const userAddress = wallet.
|
|
34
|
+
const userAddress = (await wallet.getAddress()).toLowerCase();
|
|
35
35
|
const message = {
|
|
36
36
|
purpose: "homomorphic-key-derive-v1",
|
|
37
37
|
user: userAddress,
|
package/src/utils.js
CHANGED
|
@@ -95,7 +95,7 @@ export async function waitForCondition(
|
|
|
95
95
|
*/
|
|
96
96
|
export async function uploadJsonToIpfs(data) {
|
|
97
97
|
if (!PINATA_JWT) {
|
|
98
|
-
throw new Error("
|
|
98
|
+
throw new Error("PINATA_JWT is not set");
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
const json = JSON.stringify(data);
|
|
@@ -132,7 +132,7 @@ export async function uploadJsonToIpfs(data) {
|
|
|
132
132
|
*/
|
|
133
133
|
export async function uploadBytesToIpfs(bytes, name = "proof.bin") {
|
|
134
134
|
if (!PINATA_JWT) {
|
|
135
|
-
throw new Error("
|
|
135
|
+
throw new Error("PINATA_JWT is not set");
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
const uint8 = bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes);
|