@fairblock/stabletrust 1.0.19 → 1.0.20

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/client.js +5 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fairblock/stabletrust",
3
- "version": "1.0.19",
3
+ "version": "1.0.20",
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
@@ -327,7 +327,7 @@ export class ConfidentialTransferClient {
327
327
  tokenAddress,
328
328
  );
329
329
 
330
- if (pendingBalance.amount > 0) {
330
+ if (pendingBalance.amount > 0n) {
331
331
  try {
332
332
  await this._applyPending(wallet, { waitForFinalization: true });
333
333
  } catch (error) {
@@ -387,7 +387,7 @@ export class ConfidentialTransferClient {
387
387
  );
388
388
  }
389
389
 
390
- if (allowance < amount) {
390
+ if (allowance < BigInt(amount)) {
391
391
  const approveTx = await tokenContract
392
392
  .connect(wallet)
393
393
  .approve(this.config.contractAddress, ethers.MaxUint256);
@@ -452,7 +452,7 @@ export class ConfidentialTransferClient {
452
452
  if (!tokenAddress || !ethers.isAddress(tokenAddress)) {
453
453
  throw new Error(`Invalid token address: ${tokenAddress}`);
454
454
  }
455
- if (!amount || amount <= 0) {
455
+ if (!amount || BigInt(amount) <= 0n) {
456
456
  throw new Error("Transfer amount must be greater than 0");
457
457
  }
458
458
  const tokenContract = this._getTokenContract(tokenAddress);
@@ -632,7 +632,7 @@ export class ConfidentialTransferClient {
632
632
  if (!tokenAddress || !ethers.isAddress(tokenAddress)) {
633
633
  throw new Error(`Invalid token address: ${tokenAddress}`);
634
634
  }
635
- if (!amount || amount <= 0) {
635
+ if (!amount || BigInt(amount) <= 0n) {
636
636
  throw new Error("Withdrawal amount must be greater than 0");
637
637
  }
638
638
 
@@ -865,7 +865,7 @@ export class ConfidentialTransferClient {
865
865
  tokenAddress,
866
866
  );
867
867
 
868
- if (pending.amount > 0) {
868
+ if (pending.amount > 0n) {
869
869
  return pending;
870
870
  }
871
871