fix: idCommitmnet little endianess (#86)

* fix: idCommitmnet little endianess

* stop double conversion
This commit is contained in:
Sasha 2023-12-01 13:20:48 +01:00 committed by GitHub
parent 60a50709c7
commit 0c98a266e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,3 +1,4 @@
import { hexToBytes } from "@waku/utils/bytes";
import { ethers } from "ethers";
import { RLN_REGISTRY_ABI, RLN_STORAGE_ABI } from "./constants.js";
@ -169,15 +170,11 @@ export class RLNContract {
return;
}
const idCommitment = ethers.utils.zeroPad(
ethers.utils.arrayify(_idCommitment),
32
);
const idCommitment = hexToBytes(_idCommitment?._hex);
rlnInstance.insertMember(idCommitment);
this._members.set(index.toNumber(), {
index,
idCommitment:
_idCommitment?._hex || ethers.utils.hexlify(idCommitment),
idCommitment: _idCommitment?._hex,
});
});