@interest-protocol/vortex-sdk 6.2.0 → 6.3.0

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.
@@ -6,6 +6,12 @@ interface UtxoConstructorArgs {
6
6
  index?: bigint;
7
7
  vortexPool: string;
8
8
  }
9
+ interface MakeCommitmentArgs {
10
+ amount: bigint;
11
+ publicKey: string;
12
+ blinding: bigint;
13
+ vortexPool: string;
14
+ }
9
15
  export declare class Utxo {
10
16
  amount: bigint;
11
17
  blinding: bigint;
@@ -13,6 +19,7 @@ export declare class Utxo {
13
19
  index: bigint;
14
20
  vortexPool: string;
15
21
  constructor({ amount, blinding, keypair, index, vortexPool, }: UtxoConstructorArgs);
22
+ static makeCommitment({ amount, publicKey, blinding, vortexPool, }: MakeCommitmentArgs): bigint;
16
23
  static blinding(): bigint;
17
24
  commitment(): bigint;
18
25
  nullifier(): bigint;
@@ -1 +1 @@
1
- {"version":3,"file":"utxo.d.ts","sourceRoot":"","sources":["../../src/entities/utxo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAG1C,UAAU,mBAAmB;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,qBAAa,IAAI;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,aAAa,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;gBAEP,EACV,MAAM,EACN,QAAQ,EACR,OAAO,EACP,KAAK,EACL,UAAU,GACX,EAAE,mBAAmB;IAQtB,MAAM,CAAC,QAAQ;IAIf,UAAU;IAWV,SAAS;IAST,OAAO;;;;;;CAQR"}
1
+ {"version":3,"file":"utxo.d.ts","sourceRoot":"","sources":["../../src/entities/utxo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAI1C,UAAU,mBAAmB;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,UAAU,kBAAkB;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,qBAAa,IAAI;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,aAAa,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;gBAEP,EACV,MAAM,EACN,QAAQ,EACR,OAAO,EACP,KAAK,EACL,UAAU,GACX,EAAE,mBAAmB;IAQtB,MAAM,CAAC,cAAc,CAAC,EACpB,MAAM,EACN,SAAS,EACT,QAAQ,EACR,UAAU,GACX,EAAE,kBAAkB;IASrB,MAAM,CAAC,QAAQ;IAIf,UAAU;IASV,SAAS;IAST,OAAO;;;;;;CAQR"}
package/dist/index.js CHANGED
@@ -39186,11 +39186,19 @@ class Utxo {
39186
39186
  this.index = index ?? 0n;
39187
39187
  this.vortexPool = vortexPool;
39188
39188
  }
39189
+ static makeCommitment({ amount, publicKey, blinding, vortexPool, }) {
39190
+ return poseidon4(amount, BigInt(publicKey), blinding, BigInt(normalizeSuiAddress(vortexPool, !vortexPool.startsWith('0x'))));
39191
+ }
39189
39192
  static blinding() {
39190
39193
  return BigInt(Math.floor(Math.random() * 1000000000));
39191
39194
  }
39192
39195
  commitment() {
39193
- return poseidon4(this.amount, BigInt(this.keypair.publicKey), this.blinding, BigInt(normalizeSuiAddress(this.vortexPool, !this.vortexPool.startsWith('0x'))));
39196
+ return Utxo.makeCommitment({
39197
+ amount: this.amount,
39198
+ publicKey: this.keypair.publicKey,
39199
+ blinding: this.blinding,
39200
+ vortexPool: this.vortexPool,
39201
+ });
39194
39202
  }
39195
39203
  nullifier() {
39196
39204
  const commitment = this.commitment();