mirror of
https://github.com/logos-messaging/logos-messaging-js.git
synced 2026-03-21 22:33:10 +00:00
chore: LINEA_CONTRACT instead of SEPOLIA_CONTRACT
This commit is contained in:
parent
d528534a1d
commit
41c5763bc2
@ -1,6 +1,6 @@
|
||||
import { RLN_ABI } from "./abi.js";
|
||||
|
||||
export const SEPOLIA_CONTRACT = {
|
||||
export const LINEA_CONTRACT = {
|
||||
chainId: 59141,
|
||||
address: "0xb9cd878c90e49f797b4431fbf4fb333108cb90e6",
|
||||
abi: RLN_ABI
|
||||
|
||||
@ -5,7 +5,7 @@ import sinon from "sinon";
|
||||
import { createRLN } from "../create.js";
|
||||
import type { IdentityCredential } from "../identity.js";
|
||||
|
||||
import { DEFAULT_RATE_LIMIT, SEPOLIA_CONTRACT } from "./constants.js";
|
||||
import { DEFAULT_RATE_LIMIT, LINEA_CONTRACT } from "./constants.js";
|
||||
import { RLNContract } from "./rln_contract.js";
|
||||
|
||||
export interface TestRLNInstance {
|
||||
@ -42,7 +42,7 @@ export async function initializeRLNContract(
|
||||
mockedRegistryContract: ethers.Contract
|
||||
): Promise<RLNContract> {
|
||||
const provider = new ethers.providers.JsonRpcProvider();
|
||||
const voidSigner = new ethers.VoidSigner(SEPOLIA_CONTRACT.address, provider);
|
||||
const voidSigner = new ethers.VoidSigner(LINEA_CONTRACT.address, provider);
|
||||
|
||||
const originalRegister = mockedRegistryContract.register;
|
||||
(mockedRegistryContract as any).register = function (...args: any[]) {
|
||||
@ -63,7 +63,7 @@ export async function initializeRLNContract(
|
||||
};
|
||||
|
||||
const contract = await RLNContract.init(rlnInstance, {
|
||||
address: SEPOLIA_CONTRACT.address,
|
||||
address: LINEA_CONTRACT.address,
|
||||
signer: voidSigner,
|
||||
rateLimit: DEFAULT_RATE_LIMIT,
|
||||
contract: mockedRegistryContract
|
||||
|
||||
@ -5,7 +5,7 @@ import sinon from "sinon";
|
||||
|
||||
import type { IdentityCredential } from "../identity.js";
|
||||
|
||||
import { DEFAULT_RATE_LIMIT, SEPOLIA_CONTRACT } from "./constants.js";
|
||||
import { DEFAULT_RATE_LIMIT, LINEA_CONTRACT } from "./constants.js";
|
||||
|
||||
export const mockRateLimits = {
|
||||
minRate: 20,
|
||||
@ -36,9 +36,9 @@ export function createMockProvider(): MockProvider {
|
||||
|
||||
export function createMockFilters(): MockFilters {
|
||||
return {
|
||||
MembershipRegistered: () => ({ address: SEPOLIA_CONTRACT.address }),
|
||||
MembershipErased: () => ({ address: SEPOLIA_CONTRACT.address }),
|
||||
MembershipExpired: () => ({ address: SEPOLIA_CONTRACT.address })
|
||||
MembershipRegistered: () => ({ address: LINEA_CONTRACT.address }),
|
||||
MembershipErased: () => ({ address: LINEA_CONTRACT.address }),
|
||||
MembershipExpired: () => ({ address: LINEA_CONTRACT.address })
|
||||
};
|
||||
}
|
||||
|
||||
@ -51,9 +51,9 @@ export function createMockRegistryContract(
|
||||
overrides: ContractOverrides = {}
|
||||
): ethers.Contract {
|
||||
const filters = {
|
||||
MembershipRegistered: () => ({ address: SEPOLIA_CONTRACT.address }),
|
||||
MembershipErased: () => ({ address: SEPOLIA_CONTRACT.address }),
|
||||
MembershipExpired: () => ({ address: SEPOLIA_CONTRACT.address })
|
||||
MembershipRegistered: () => ({ address: LINEA_CONTRACT.address }),
|
||||
MembershipErased: () => ({ address: LINEA_CONTRACT.address }),
|
||||
MembershipExpired: () => ({ address: LINEA_CONTRACT.address })
|
||||
};
|
||||
|
||||
const baseContract = {
|
||||
@ -89,7 +89,7 @@ export function createMockRegistryContract(
|
||||
format: () => {}
|
||||
})
|
||||
},
|
||||
address: SEPOLIA_CONTRACT.address
|
||||
address: LINEA_CONTRACT.address
|
||||
};
|
||||
|
||||
// Merge overrides while preserving filters
|
||||
@ -163,7 +163,7 @@ export function verifyRegistration(
|
||||
expect(decryptedCredentials).to.have.property("identity");
|
||||
expect(decryptedCredentials).to.have.property("membership");
|
||||
expect(decryptedCredentials.membership).to.include({
|
||||
address: SEPOLIA_CONTRACT.address,
|
||||
address: LINEA_CONTRACT.address,
|
||||
treeIndex: 1
|
||||
});
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { RLNDecoder, RLNEncoder } from "./codec.js";
|
||||
import { RLN_ABI } from "./contract/abi.js";
|
||||
import { RLNContract, SEPOLIA_CONTRACT } from "./contract/index.js";
|
||||
import { LINEA_CONTRACT, RLNContract } from "./contract/index.js";
|
||||
import { createRLN } from "./create.js";
|
||||
import { IdentityCredential } from "./identity.js";
|
||||
import { Keystore } from "./keystore/index.js";
|
||||
@ -19,7 +19,7 @@ export {
|
||||
RLNDecoder,
|
||||
MerkleRootTracker,
|
||||
RLNContract,
|
||||
SEPOLIA_CONTRACT,
|
||||
LINEA_CONTRACT,
|
||||
extractMetaMaskSigner,
|
||||
RLN_ABI
|
||||
};
|
||||
|
||||
@ -16,7 +16,7 @@ import {
|
||||
type RLNEncoder
|
||||
} from "./codec.js";
|
||||
import { DEFAULT_RATE_LIMIT } from "./contract/constants.js";
|
||||
import { RLNContract, SEPOLIA_CONTRACT } from "./contract/index.js";
|
||||
import { LINEA_CONTRACT, RLNContract } from "./contract/index.js";
|
||||
import { IdentityCredential } from "./identity.js";
|
||||
import { Keystore } from "./keystore/index.js";
|
||||
import type {
|
||||
@ -108,7 +108,7 @@ type StartRLNOptions = {
|
||||
*/
|
||||
signer?: ethers.Signer;
|
||||
/**
|
||||
* If not set - will use default SEPOLIA_CONTRACT address.
|
||||
* If not set - will use default LINEA_CONTRACT address.
|
||||
*/
|
||||
address?: string;
|
||||
/**
|
||||
@ -190,10 +190,10 @@ export class RLNInstance {
|
||||
const address =
|
||||
credentials?.membership.address ||
|
||||
options.address ||
|
||||
SEPOLIA_CONTRACT.address;
|
||||
LINEA_CONTRACT.address;
|
||||
|
||||
if (address === SEPOLIA_CONTRACT.address) {
|
||||
chainId = SEPOLIA_CONTRACT.chainId;
|
||||
if (address === LINEA_CONTRACT.address) {
|
||||
chainId = LINEA_CONTRACT.chainId;
|
||||
}
|
||||
|
||||
const signer = options.signer || (await extractMetaMaskSigner());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user