@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fairblock/stabletrust",
3
- "version": "1.0.18",
3
+ "version": "1.0.19",
4
4
  "description": "SDK for confidential transfers using homomorphic encryption and zero-knowledge proofs",
5
5
  "main": "src/index.js",
6
6
  "types": "src/index.d.ts",
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 < depositAmount) {
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.address.toLowerCase();
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("REACT_APP_PINATA_JWT is not set");
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("REACT_APP_PINATA_JWT is not set");
135
+ throw new Error("PINATA_JWT is not set");
136
136
  }
137
137
 
138
138
  const uint8 = bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes);