zkenclave-sdk 0.1.0 → 0.1.1

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/index.d.mts CHANGED
@@ -85,6 +85,7 @@ declare class PrivacyVaultSDK {
85
85
  private provider;
86
86
  private signer;
87
87
  private vault;
88
+ private readVault;
88
89
  private _aspRegistry;
89
90
  private zkClient;
90
91
  private config;
package/dist/index.d.ts CHANGED
@@ -85,6 +85,7 @@ declare class PrivacyVaultSDK {
85
85
  private provider;
86
86
  private signer;
87
87
  private vault;
88
+ private readVault;
88
89
  private _aspRegistry;
89
90
  private zkClient;
90
91
  private config;
package/dist/index.js CHANGED
@@ -482,6 +482,7 @@ var PrivacyVaultSDK = class {
482
482
  provider;
483
483
  signer = null;
484
484
  vault;
485
+ readVault;
485
486
  _aspRegistry;
486
487
  zkClient;
487
488
  config;
@@ -497,6 +498,11 @@ var PrivacyVaultSDK = class {
497
498
  PRIVACY_VAULT_ABI,
498
499
  this.signer ?? this.provider
499
500
  );
501
+ this.readVault = new import_ethers3.ethers.Contract(
502
+ config.vaultAddress,
503
+ PRIVACY_VAULT_ABI,
504
+ this.provider
505
+ );
500
506
  this._aspRegistry = new import_ethers3.ethers.Contract(
501
507
  config.aspRegistryAddress,
502
508
  ASP_REGISTRY_ABI,
@@ -589,15 +595,15 @@ var PrivacyVaultSDK = class {
589
595
  };
590
596
  }
591
597
  async getLatestRoot() {
592
- const root = await this.vault.getLatestRoot();
598
+ const root = await this.readVault.getLatestRoot();
593
599
  return hexToBytes(root);
594
600
  }
595
601
  async getNextLeafIndex() {
596
- const index = await this.vault.getNextLeafIndex();
602
+ const index = await this.readVault.getNextLeafIndex();
597
603
  return Number(index);
598
604
  }
599
605
  async isNullifierUsed(nullifier) {
600
- return await this.vault.isNullifierUsed(bytesToHex(nullifier));
606
+ return await this.readVault.isNullifierUsed(bytesToHex(nullifier));
601
607
  }
602
608
  async isKnownRoot(root) {
603
609
  return await this.vault.isKnownRoot(bytesToHex(root));
package/dist/index.mjs CHANGED
@@ -428,6 +428,7 @@ var PrivacyVaultSDK = class {
428
428
  provider;
429
429
  signer = null;
430
430
  vault;
431
+ readVault;
431
432
  _aspRegistry;
432
433
  zkClient;
433
434
  config;
@@ -443,6 +444,11 @@ var PrivacyVaultSDK = class {
443
444
  PRIVACY_VAULT_ABI,
444
445
  this.signer ?? this.provider
445
446
  );
447
+ this.readVault = new ethers.Contract(
448
+ config.vaultAddress,
449
+ PRIVACY_VAULT_ABI,
450
+ this.provider
451
+ );
446
452
  this._aspRegistry = new ethers.Contract(
447
453
  config.aspRegistryAddress,
448
454
  ASP_REGISTRY_ABI,
@@ -535,15 +541,15 @@ var PrivacyVaultSDK = class {
535
541
  };
536
542
  }
537
543
  async getLatestRoot() {
538
- const root = await this.vault.getLatestRoot();
544
+ const root = await this.readVault.getLatestRoot();
539
545
  return hexToBytes(root);
540
546
  }
541
547
  async getNextLeafIndex() {
542
- const index = await this.vault.getNextLeafIndex();
548
+ const index = await this.readVault.getNextLeafIndex();
543
549
  return Number(index);
544
550
  }
545
551
  async isNullifierUsed(nullifier) {
546
- return await this.vault.isNullifierUsed(bytesToHex(nullifier));
552
+ return await this.readVault.isNullifierUsed(bytesToHex(nullifier));
547
553
  }
548
554
  async isKnownRoot(root) {
549
555
  return await this.vault.isKnownRoot(bytesToHex(root));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zkenclave-sdk",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "TypeScript SDK for privacy-preserving vault withdrawals with ZK proofs",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",