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