genlayer-js 0.18.8 → 0.18.10

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.
@@ -114,24 +114,19 @@ export interface EpochData {
114
114
  claimed: bigint;
115
115
  stakeDeposit: bigint;
116
116
  stakeWithdrawal: bigint;
117
+ slashed: bigint;
117
118
  }
118
119
 
119
120
  export interface EpochInfo {
120
121
  currentEpoch: bigint;
122
+ lastFinalizedEpoch: bigint;
121
123
  validatorMinStake: string;
122
124
  validatorMinStakeRaw: bigint;
123
125
  delegatorMinStake: string;
124
126
  delegatorMinStakeRaw: bigint;
125
127
  activeValidatorsCount: bigint;
126
128
  epochMinDuration: bigint;
127
- currentEpochStart: Date;
128
- currentEpochEnd: Date | null;
129
129
  nextEpochEstimate: Date | null;
130
- inflation: string;
131
- inflationRaw: bigint;
132
- totalWeight: bigint;
133
- totalClaimed: string;
134
- totalClaimedRaw: bigint;
135
130
  }
136
131
 
137
132
  export interface StakingTransactionResult {
@@ -220,8 +215,10 @@ export interface StakingActions {
220
215
  getValidatorInfo: (validator: Address) => Promise<ValidatorInfo>;
221
216
  getStakeInfo: (delegator: Address, validator: Address) => Promise<StakeInfo>;
222
217
  getEpochInfo: () => Promise<EpochInfo>;
218
+ getEpochData: (epochNumber: bigint) => Promise<EpochData>;
223
219
  getActiveValidators: () => Promise<Address[]>;
224
220
  getActiveValidatorsCount: () => Promise<bigint>;
221
+ getSlashingAddress: () => Promise<Address>;
225
222
  getStakingContract: () => StakingContract;
226
223
  parseStakingAmount: (amount: string | bigint) => bigint;
227
224
  formatStakingAmount: (amount: bigint) => string;
@@ -153,6 +153,21 @@ export type DecodedCallData = {
153
153
  type: TransactionType;
154
154
  };
155
155
 
156
+ export interface LeaderReceipt {
157
+ calldata: string;
158
+ class_name: string;
159
+ contract_state: string;
160
+ eq_outputs: Record<string, unknown>;
161
+ error: string | null;
162
+ execution_result: string;
163
+ gas_used: number;
164
+ mode: string;
165
+ node_config: Record<string, unknown>;
166
+ pending_transactions: unknown[];
167
+ vote: string;
168
+ result: string;
169
+ }
170
+
156
171
  // TODO: make localnet compatible with testnet and unify the types
157
172
  export type GenLayerTransaction = {
158
173
  // currentTimestamp: testnet
@@ -243,20 +258,7 @@ export type GenLayerTransaction = {
243
258
  // consensus_data: localnet // leader_receipt: testnet
244
259
  consensus_data?: {
245
260
  final: boolean;
246
- leader_receipt?: {
247
- calldata: string;
248
- class_name: string;
249
- contract_state: string;
250
- eq_outputs: Record<string, unknown>;
251
- error: string | null;
252
- execution_result: string;
253
- gas_used: number;
254
- mode: string;
255
- node_config: Record<string, unknown>;
256
- pending_transactions: unknown[];
257
- vote: string;
258
- result: string;
259
- }[];
261
+ leader_receipt?: LeaderReceipt[];
260
262
  validators?: Record<string, unknown>[];
261
263
  votes?: Record<string, string>;
262
264
  };
@@ -0,0 +1,59 @@
1
+ // tests/smoke.test.ts
2
+ // Basic smoke tests to verify testnet chain configuration and connectivity
3
+ import {describe, it, expect} from "vitest";
4
+ import {testnetAsimov} from "@/chains/testnetAsimov";
5
+ import {createPublicClient, http} from "viem";
6
+
7
+ describe("Testnet Asimov Chain Config", () => {
8
+ it("should have valid RPC URL", () => {
9
+ const rpcUrl = testnetAsimov.rpcUrls.default.http[0];
10
+ expect(rpcUrl).toBe("https://zksync-os-testnet-genlayer.zksync.dev");
11
+ });
12
+
13
+ it("should have valid WebSocket URL", () => {
14
+ const wsUrl = testnetAsimov.rpcUrls.default.webSocket?.[0];
15
+ expect(wsUrl).toBe("wss://zksync-os-testnet-alpha.zksync.dev/ws");
16
+ });
17
+
18
+ it("should have consensus main contract address", () => {
19
+ expect(testnetAsimov.consensusMainContract?.address).toBe(
20
+ "0x6CAFF6769d70824745AD895663409DC70aB5B28E",
21
+ );
22
+ });
23
+
24
+ it("should have consensus data contract address", () => {
25
+ expect(testnetAsimov.consensusDataContract?.address).toBe(
26
+ "0x0D9d1d74d72Fa5eB94bcf746C8FCcb312a722c9B",
27
+ );
28
+ });
29
+
30
+ it("should have staking contract address", () => {
31
+ expect(testnetAsimov.stakingContract?.address).toBe(
32
+ "0x63Fa5E0bb10fb6fA98F44726C5518223F767687A",
33
+ );
34
+ });
35
+
36
+ it("should have correct chain ID", () => {
37
+ expect(testnetAsimov.id).toBe(0x107d);
38
+ });
39
+ });
40
+
41
+ describe("Testnet Asimov RPC Connectivity", () => {
42
+ it("should connect and fetch chain ID", async () => {
43
+ const client = createPublicClient({
44
+ chain: testnetAsimov,
45
+ transport: http(testnetAsimov.rpcUrls.default.http[0]),
46
+ });
47
+ const chainId = await client.getChainId();
48
+ expect(chainId).toBe(testnetAsimov.id);
49
+ }, 15000);
50
+
51
+ it("should fetch latest block number", async () => {
52
+ const client = createPublicClient({
53
+ chain: testnetAsimov,
54
+ transport: http(testnetAsimov.rpcUrls.default.http[0]),
55
+ });
56
+ const blockNumber = await client.getBlockNumber();
57
+ expect(blockNumber).toBeGreaterThan(0n);
58
+ }, 15000);
59
+ });