Skip to content

chore: Unify svm w/ arch/svm #977

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/svm/eventsClient.ts → src/arch/svm/eventsClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ import web3, {
RpcTransport,
Signature,
} from "@solana/kit";
import { bs58 } from "../utils";
import { bs58 } from "../../utils";
import { EventData, EventName, EventWithData } from "./types";
import { decodeEvent } from "./utils/events";
import { isDevnet } from "./utils/helpers";
import { decodeEvent, isDevnet } from "./utils";

// Utility type to extract the return type for the JSON encoding overload. We only care about the overload where the
// configuration parameter (C) has the optional property 'encoding' set to 'json'.
Expand Down
3 changes: 3 additions & 0 deletions src/arch/svm/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
export * from "./eventsClient";
export * from "./SpokeUtils";
export * from "./types";
export * from "./utils";
File renamed without changes.
12 changes: 10 additions & 2 deletions src/svm/utils/events.ts → src/arch/svm/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
import { BN, BorshEventCoder, Idl } from "@coral-xyz/anchor";
import { address } from "@solana/kit";
import { EventName, EventData, SVMEventNames } from "../types";
import web3, { address, RpcTransport } from "@solana/kit";
import { EventName, EventData, SVMEventNames } from "./types";

/**
* Helper to determine if the current RPC network is devnet.
*/
export async function isDevnet(rpc: web3.Rpc<web3.SolanaRpcApiFromTransport<RpcTransport>>): Promise<boolean> {
const genesisHash = await rpc.getGenesisHash().send();
return genesisHash === "EtWTRABZaYq6iMfeYKouRu166VU2xqa1wcaWoxPkrZBG";
}

/**
* Parses event data from a transaction.
Expand Down
4 changes: 1 addition & 3 deletions src/clients/SpokePoolClient/SVMSpokePoolClient.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import winston from "winston";
import { Rpc, SolanaRpcApiFromTransport, RpcTransport } from "@solana/kit";
import { BigNumber, DepositSearchResult, EventSearchConfig, MakeOptional } from "../../utils";
import { SvmSpokeEventsClient, SVMEventNames } from "../../arch/svm";
import { HubPoolClient } from "../HubPoolClient";
import { knownEventNames, SpokePoolClient, SpokePoolUpdate } from "./SpokePoolClient";
import { SvmSpokeEventsClient } from "../../svm/eventsClient";
import { RelayData, FillStatus } from "../../interfaces";
import { SVMEventNames } from "../../svm/types";

/**
* SvmSpokePoolClient is a client for the SVM SpokePool program. It extends the base SpokePoolClient
* and implements the abstract methods required for interacting with an SVM Spoke Pool.
Expand Down
1 change: 0 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,3 @@ export * as clients from "./clients";
export * as typechain from "./typechain";
export * as caching from "./caching";
export * as providers from "./providers";
export * as svm from "./svm";
3 changes: 0 additions & 3 deletions src/svm/index.ts

This file was deleted.

9 changes: 0 additions & 9 deletions src/svm/utils/helpers.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/svm/utils/index.ts

This file was deleted.