@aptos-labs/confidential-assets-bindings 0.0.4 → 0.0.5
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.cjs +19 -16
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +19 -16
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -522,12 +522,11 @@ async function __wbg_init(module_or_path) {
|
|
|
522
522
|
}
|
|
523
523
|
//#endregion
|
|
524
524
|
//#region src/index.ts
|
|
525
|
-
const CDN_WASM_URL = `https://unpkg.com/@aptos-labs/confidential-assets-bindings@0.0.
|
|
525
|
+
const CDN_WASM_URL = `https://unpkg.com/@aptos-labs/confidential-assets-bindings@0.0.5/dist/aptos_confidential_asset_wasm_bg.wasm`;
|
|
526
526
|
async function getNodeModulesWASM() {
|
|
527
527
|
try {
|
|
528
528
|
const fs = await import("fs");
|
|
529
|
-
const
|
|
530
|
-
const possiblePaths = [path.resolve(process.cwd(), "node_modules/@aptos-labs/confidential-assets-bindings/dist/aptos_confidential_asset_wasm_bg.wasm"), path.resolve(__dirname, "../../node_modules/@aptos-labs/confidential-assets-bindings/aptos_confidential_asset_wasm_bg.wasm")];
|
|
529
|
+
const possiblePaths = [(await import("path")).resolve(process.cwd(), "node_modules/@aptos-labs/confidential-assets-bindings/dist/aptos_confidential_asset_wasm_bg.wasm"), new URL("./aptos_confidential_asset_wasm_bg.wasm", require("url").pathToFileURL(__filename).href).pathname];
|
|
531
530
|
for (const wasmPath of possiblePaths) if (fs.existsSync(wasmPath)) return fs.readFileSync(wasmPath);
|
|
532
531
|
} catch {}
|
|
533
532
|
return CDN_WASM_URL;
|
|
@@ -555,23 +554,27 @@ const rangeProof = async (inputs) => {
|
|
|
555
554
|
await ensureWasmInitialized();
|
|
556
555
|
const { v, r, valBase, randBase, numBits = 32 } = inputs;
|
|
557
556
|
const proof = range_proof(v, r, valBase, randBase, numBits);
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
557
|
+
try {
|
|
558
|
+
return {
|
|
559
|
+
proof: proof.proof(),
|
|
560
|
+
commitment: proof.comm()
|
|
561
|
+
};
|
|
562
|
+
} finally {
|
|
563
|
+
proof.free();
|
|
564
|
+
}
|
|
564
565
|
};
|
|
565
566
|
const batchRangeProof = async (inputs) => {
|
|
566
567
|
await ensureWasmInitialized();
|
|
567
568
|
const { v, rs, valBase, randBase, numBits = 32 } = inputs;
|
|
568
569
|
const proof = batch_range_proof(new BigUint64Array(v), rs, valBase, randBase, numBits);
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
570
|
+
try {
|
|
571
|
+
return {
|
|
572
|
+
proof: proof.proof(),
|
|
573
|
+
commitments: proof.comms()
|
|
574
|
+
};
|
|
575
|
+
} finally {
|
|
576
|
+
proof.free();
|
|
577
|
+
}
|
|
575
578
|
};
|
|
576
579
|
const verifyProof = async (inputs) => {
|
|
577
580
|
await ensureWasmInitialized();
|
|
@@ -583,7 +586,7 @@ const batchVerifyProof = async (inputs) => {
|
|
|
583
586
|
const { proof, comms, valBase, randBase, numBits } = inputs;
|
|
584
587
|
return batch_verify_proof(proof, comms, valBase, randBase, numBits);
|
|
585
588
|
};
|
|
586
|
-
let _discreteLogSolver;
|
|
589
|
+
let _discreteLogSolver = null;
|
|
587
590
|
const getDiscreteLogSolver = () => {
|
|
588
591
|
if (_discreteLogSolver) return _discreteLogSolver;
|
|
589
592
|
return _discreteLogSolver = new DiscreteLogSolver();
|
package/dist/index.d.cts
CHANGED
|
@@ -16,7 +16,7 @@ interface BatchRangeProofInputs {
|
|
|
16
16
|
rs: Uint8Array[];
|
|
17
17
|
valBase: Uint8Array;
|
|
18
18
|
randBase: Uint8Array;
|
|
19
|
-
numBits
|
|
19
|
+
numBits?: number;
|
|
20
20
|
}
|
|
21
21
|
declare const batchRangeProof: (inputs: BatchRangeProofInputs) => Promise<{
|
|
22
22
|
proof: Uint8Array<ArrayBufferLike>;
|
package/dist/index.d.mts
CHANGED
|
@@ -16,7 +16,7 @@ interface BatchRangeProofInputs {
|
|
|
16
16
|
rs: Uint8Array[];
|
|
17
17
|
valBase: Uint8Array;
|
|
18
18
|
randBase: Uint8Array;
|
|
19
|
-
numBits
|
|
19
|
+
numBits?: number;
|
|
20
20
|
}
|
|
21
21
|
declare const batchRangeProof: (inputs: BatchRangeProofInputs) => Promise<{
|
|
22
22
|
proof: Uint8Array<ArrayBufferLike>;
|
package/dist/index.mjs
CHANGED
|
@@ -521,12 +521,11 @@ async function __wbg_init(module_or_path) {
|
|
|
521
521
|
}
|
|
522
522
|
//#endregion
|
|
523
523
|
//#region src/index.ts
|
|
524
|
-
const CDN_WASM_URL = `https://unpkg.com/@aptos-labs/confidential-assets-bindings@0.0.
|
|
524
|
+
const CDN_WASM_URL = `https://unpkg.com/@aptos-labs/confidential-assets-bindings@0.0.5/dist/aptos_confidential_asset_wasm_bg.wasm`;
|
|
525
525
|
async function getNodeModulesWASM() {
|
|
526
526
|
try {
|
|
527
527
|
const fs = await import("fs");
|
|
528
|
-
const
|
|
529
|
-
const possiblePaths = [path.resolve(process.cwd(), "node_modules/@aptos-labs/confidential-assets-bindings/dist/aptos_confidential_asset_wasm_bg.wasm"), path.resolve(__dirname, "../../node_modules/@aptos-labs/confidential-assets-bindings/aptos_confidential_asset_wasm_bg.wasm")];
|
|
528
|
+
const possiblePaths = [(await import("path")).resolve(process.cwd(), "node_modules/@aptos-labs/confidential-assets-bindings/dist/aptos_confidential_asset_wasm_bg.wasm"), new URL("./aptos_confidential_asset_wasm_bg.wasm", import.meta.url).pathname];
|
|
530
529
|
for (const wasmPath of possiblePaths) if (fs.existsSync(wasmPath)) return fs.readFileSync(wasmPath);
|
|
531
530
|
} catch {}
|
|
532
531
|
return CDN_WASM_URL;
|
|
@@ -554,23 +553,27 @@ const rangeProof = async (inputs) => {
|
|
|
554
553
|
await ensureWasmInitialized();
|
|
555
554
|
const { v, r, valBase, randBase, numBits = 32 } = inputs;
|
|
556
555
|
const proof = range_proof(v, r, valBase, randBase, numBits);
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
556
|
+
try {
|
|
557
|
+
return {
|
|
558
|
+
proof: proof.proof(),
|
|
559
|
+
commitment: proof.comm()
|
|
560
|
+
};
|
|
561
|
+
} finally {
|
|
562
|
+
proof.free();
|
|
563
|
+
}
|
|
563
564
|
};
|
|
564
565
|
const batchRangeProof = async (inputs) => {
|
|
565
566
|
await ensureWasmInitialized();
|
|
566
567
|
const { v, rs, valBase, randBase, numBits = 32 } = inputs;
|
|
567
568
|
const proof = batch_range_proof(new BigUint64Array(v), rs, valBase, randBase, numBits);
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
569
|
+
try {
|
|
570
|
+
return {
|
|
571
|
+
proof: proof.proof(),
|
|
572
|
+
commitments: proof.comms()
|
|
573
|
+
};
|
|
574
|
+
} finally {
|
|
575
|
+
proof.free();
|
|
576
|
+
}
|
|
574
577
|
};
|
|
575
578
|
const verifyProof = async (inputs) => {
|
|
576
579
|
await ensureWasmInitialized();
|
|
@@ -582,7 +585,7 @@ const batchVerifyProof = async (inputs) => {
|
|
|
582
585
|
const { proof, comms, valBase, randBase, numBits } = inputs;
|
|
583
586
|
return batch_verify_proof(proof, comms, valBase, randBase, numBits);
|
|
584
587
|
};
|
|
585
|
-
let _discreteLogSolver;
|
|
588
|
+
let _discreteLogSolver = null;
|
|
586
589
|
const getDiscreteLogSolver = () => {
|
|
587
590
|
if (_discreteLogSolver) return _discreteLogSolver;
|
|
588
591
|
return _discreteLogSolver = new DiscreteLogSolver();
|