Skip to content

Commit

Permalink
feat: remove v1 from build
Browse files Browse the repository at this point in the history
Signed-off-by: Pablo Maldonado <pablo@umaproject.org>
  • Loading branch information
md0x committed Jan 23, 2025
1 parent c0860cc commit 1388f03
Show file tree
Hide file tree
Showing 57 changed files with 1,085 additions and 146 deletions.
12 changes: 7 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
},
"dependencies": {
"@across-protocol/constants": "^3.1.30",
"@coral-xyz/anchor": "^0.30.1",
"@coral-xyz/borsh": "^0.30.1",
"@defi-wonderland/smock": "^2.3.4",
"@eth-optimism/contracts": "^0.5.40",
"@ethersproject/abstract-provider": "5.7.0",
Expand All @@ -52,15 +52,13 @@
"@openzeppelin/contracts": "4.9.6",
"@openzeppelin/contracts-upgradeable": "4.9.6",
"@scroll-tech/contracts": "^0.1.0",
"@solana-developers/helpers": "^2.4.0",
"@solana/spl-token": "^0.4.6",
"@solana/web3.js": "^1.31.0",
"@solana/web3-v2.js": "npm:@solana/web3.js@2",
"@types/yargs": "^17.0.33",
"@uma/common": "^2.37.3",
"@uma/contracts-node": "^0.4.17",
"@uma/core": "^2.61.0",
"axios": "^1.7.4",
"bn.js": "^5.2.1",
"bs58": "^6.0.0",
"prettier-plugin-rust": "^0.1.9",
"yargs": "^17.7.2",
Expand All @@ -69,8 +67,8 @@
"devDependencies": {
"@codama/nodes-from-anchor": "^1.1.0",
"@codama/renderers-js": "^1.1.1",
"codama": "^1.2.0",
"@consensys/linea-sdk": "^0.1.6",
"@coral-xyz/anchor": "^0.30.1",
"@matterlabs/hardhat-zksync-deploy": "^0.6.3",
"@matterlabs/hardhat-zksync-solc": "^1.1.4",
"@matterlabs/hardhat-zksync-upgradable": "^0.1.0",
Expand All @@ -81,6 +79,9 @@
"@nomiclabs/hardhat-waffle": "2.0.3",
"@openzeppelin/hardhat-upgrades": "^1.22.0",
"@pinata/sdk": "^2.1.0",
"@solana-developers/helpers": "^2.4.0",
"@solana/spl-token": "^0.4.6",
"@solana/web3.js": "^1.31.0",
"@typechain/ethers-v5": "^11.0.0",
"@typechain/hardhat": "^8.0.0",
"@types/bn.js": "^5.1.0",
Expand All @@ -90,6 +91,7 @@
"@typescript-eslint/eslint-plugin": "^4.29.1",
"@typescript-eslint/parser": "^4.29.1",
"chai": "^4.3.7",
"codama": "^1.2.0",
"dotenv": "^10.0.0",
"eslint": "^7.29.0",
"eslint-config-prettier": "^8.3.0",
Expand Down
2 changes: 1 addition & 1 deletion scripts/svm/addressToPublicKey.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { evmAddressToPublicKey } from "../../src/svm";
import { evmAddressToPublicKey } from "@svm/web3-v1";
import yargs from "yargs";
import { hideBin } from "yargs/helpers";
const argv = yargs(hideBin(process.argv)).option("address", {
Expand Down
6 changes: 4 additions & 2 deletions scripts/svm/bridgeLiabilityToHubPool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,20 @@ import {
CIRCLE_IRIS_API_URL_DEVNET,
CIRCLE_IRIS_API_URL_MAINNET,
getMessages,
getMessageTransmitterProgram,
getSpokePoolProgram,
getTokenMessengerMinterProgram,
isSolanaDevnet,
MAINNET_CCTP_MESSAGE_TRANSMITTER_ADDRESS,
SEPOLIA_CCTP_MESSAGE_TRANSMITTER_ADDRESS,
SOLANA_SPOKE_STATE_SEED,
SOLANA_USDC_DEVNET,
SOLANA_USDC_MAINNET,
} from "../../src/svm";
} from "@svm/web3-v1";

import { TOKEN_SYMBOLS_MAP } from "@across-protocol/constants";
import { getNodeUrl } from "@uma/common";
import { BigNumber, ethers } from "ethers";
import { getMessageTransmitterProgram, getSpokePoolProgram, getTokenMessengerMinterProgram } from "../../src/svm";
import { BondToken__factory } from "../../typechain";
import { formatUsdc, requireEnv } from "./utils/helpers";

Expand Down
2 changes: 1 addition & 1 deletion scripts/svm/closeRelayerPdas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import * as anchor from "@coral-xyz/anchor";
import { AnchorProvider, BN } from "@coral-xyz/anchor";
import { PublicKey, SystemProgram } from "@solana/web3.js";
import { calculateRelayEventHashUint8Array, getSpokePoolProgram, readProgramEvents } from "@svm/web3-v1";
import yargs from "yargs";
import { hideBin } from "yargs/helpers";
import { calculateRelayEventHashUint8Array, getSpokePoolProgram, readProgramEvents } from "../../src/svm";

// Set up the provider
const provider = AnchorProvider.env();
Expand Down
2 changes: 1 addition & 1 deletion scripts/svm/enableRoute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import * as anchor from "@coral-xyz/anchor";
import { AnchorProvider, BN } from "@coral-xyz/anchor";
import { ASSOCIATED_TOKEN_PROGRAM_ID, TOKEN_PROGRAM_ID, getAssociatedTokenAddressSync } from "@solana/spl-token";
import { PublicKey, SystemProgram } from "@solana/web3.js";
import { getSpokePoolProgram } from "@svm/web3-v1";
import yargs from "yargs";
import { hideBin } from "yargs/helpers";
import { getSpokePoolProgram } from "../../src/svm";

// Set up the provider
const provider = AnchorProvider.env();
Expand Down
5 changes: 3 additions & 2 deletions scripts/svm/executeRebalanceToHubPool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,13 @@ import {
getSpokePoolProgram,
isSolanaDevnet,
loadExecuteRelayerRefundLeafParams,
RelayerRefundLeafSolana,
RelayerRefundLeafType,
SOLANA_SPOKE_STATE_SEED,
SOLANA_USDC_DEVNET,
SOLANA_USDC_MAINNET,
SvmSpokeAnchor,
} from "../../src/svm";
import { RelayerRefundLeafSolana, RelayerRefundLeafType } from "../../src/types/svm";
} from "@svm/web3-v1";

// Set up Solana provider.
const provider = AnchorProvider.env();
Expand Down
8 changes: 4 additions & 4 deletions scripts/svm/executeRebalanceToSpokePool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ import { AccountMeta, PublicKey, SystemProgram } from "@solana/web3.js";
import { getNodeUrl } from "@uma/common";
// eslint-disable-next-line camelcase
import { CHAIN_IDs, TOKEN_SYMBOLS_MAP } from "@across-protocol/constants";
import { BigNumber, ethers } from "ethers";
import yargs from "yargs";
import { hideBin } from "yargs/helpers";
import {
CIRCLE_IRIS_API_URL_DEVNET,
CIRCLE_IRIS_API_URL_MAINNET,
Expand All @@ -26,7 +23,10 @@ import {
isSolanaDevnet,
SOLANA_USDC_DEVNET,
SOLANA_USDC_MAINNET,
} from "../../src/svm";
} from "@svm/web3-v1";
import { BigNumber, ethers } from "ethers";
import yargs from "yargs";
import { hideBin } from "yargs/helpers";
import { HubPool__factory } from "../../typechain";
import { requireEnv } from "./utils/helpers";
import { constructSimpleRebalanceTree } from "./utils/poolRebalanceTree";
Expand Down
9 changes: 5 additions & 4 deletions scripts/svm/fakeFillWithRandomDistribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,18 @@ import {
getOrCreateAssociatedTokenAccount,
} from "@solana/spl-token";
import { AccountMeta, Keypair, PublicKey, SystemProgram, TransactionInstruction } from "@solana/web3.js";
import yargs from "yargs";
import { hideBin } from "yargs/helpers";
import {
AcrossPlusMessageCoder,
FillDataParams,
FillDataValues,
MulticallHandlerCoder,
calculateRelayHashUint8Array,
getSpokePoolProgram,
loadFillV3RelayParams,
sendTransactionWithLookupTable,
} from "../../src/svm";
import { FillDataParams, FillDataValues } from "../../src/types/svm";
} from "@svm/web3-v1";
import yargs from "yargs";
import { hideBin } from "yargs/helpers";

// Set up the provider and signer.
const provider = AnchorProvider.env();
Expand Down
2 changes: 1 addition & 1 deletion scripts/svm/initialize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import * as anchor from "@coral-xyz/anchor";
import { AnchorProvider, BN } from "@coral-xyz/anchor";
import { PublicKey, SystemProgram } from "@solana/web3.js";
import { evmAddressToPublicKey, getSpokePoolProgram } from "@svm/web3-v1";
import yargs from "yargs";
import { hideBin } from "yargs/helpers";
import { evmAddressToPublicKey, getSpokePoolProgram } from "../../src/svm";

// Set up the provider
const provider = AnchorProvider.env();
Expand Down
2 changes: 1 addition & 1 deletion scripts/svm/proposeRebalanceToHubPool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@

import { PublicKey } from "@solana/web3.js";
import { getNodeUrl } from "@uma/common";
import { getSolanaChainId, SOLANA_USDC_DEVNET, SOLANA_USDC_MAINNET } from "@svm/web3-v1";
import { BigNumber, ethers } from "ethers";
import yargs from "yargs";
import { hideBin } from "yargs/helpers";
import { getSolanaChainId, SOLANA_USDC_DEVNET, SOLANA_USDC_MAINNET } from "../../src/svm";
import { BondToken__factory, HubPool__factory } from "../../typechain";
import { CHAIN_IDs } from "../../utils/constants";
import {
Expand Down
3 changes: 1 addition & 2 deletions scripts/svm/proposeRebalanceToSpokePool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ import { BigNumber, ethers } from "ethers";
import yargs from "yargs";
import { hideBin } from "yargs/helpers";
import { CHAIN_IDs, TOKEN_SYMBOLS_MAP } from "../../utils/constants";
// eslint-disable-next-line camelcase
import { getSolanaChainId } from "../../src/svm";
import { getSolanaChainId } from "@svm/web3-v1";
import { BondToken__factory, HubPool__factory } from "../../typechain";
import { requireEnv } from "./utils/helpers";
import { constructSimpleRebalanceTree } from "./utils/poolRebalanceTree";
Expand Down
2 changes: 1 addition & 1 deletion scripts/svm/publicKeyToAddress.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { publicKeyToEvmAddress } from "@svm/web3-v1";
import yargs from "yargs";
import { hideBin } from "yargs/helpers";
import { publicKeyToEvmAddress } from "../../src/svm";

const argv = yargs(hideBin(process.argv)).option("publicKey", {
type: "string",
Expand Down
2 changes: 1 addition & 1 deletion scripts/svm/queryDeposits.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import * as anchor from "@coral-xyz/anchor";
import { AnchorProvider, BN } from "@coral-xyz/anchor";
import { PublicKey } from "@solana/web3.js";
import { getSpokePoolProgram, readProgramEvents } from "@svm/web3-v1";
import yargs from "yargs";
import { hideBin } from "yargs/helpers";
import { getSpokePoolProgram, readProgramEvents } from "../../src/svm";

// Set up the provider
const provider = AnchorProvider.env();
Expand Down
2 changes: 1 addition & 1 deletion scripts/svm/queryEvents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as anchor from "@coral-xyz/anchor";
import { AnchorProvider, Program } from "@coral-xyz/anchor";
import yargs from "yargs";
import { hideBin } from "yargs/helpers";
import { readProgramEvents, stringifyCpiEvent } from "../../src/svm";
import { readProgramEvents, stringifyCpiEvent } from "@svm/web3-v1";
import { SvmSpoke } from "../../target/types/svm_spoke";

// Set up the provider
Expand Down
4 changes: 2 additions & 2 deletions scripts/svm/queryEventsV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { AnchorProvider } from "@coral-xyz/anchor";
import { address, createSolanaRpc } from "@solana/web3-v2.js";
import yargs from "yargs";
import { hideBin } from "yargs/helpers";
import { readProgramEventsV2, stringifyCpiEvent, SvmSpokeIdl } from "../../src/svm";
import { readProgramEvents, stringifyCpiEvent, SvmSpokeIdl } from "../../src/svm";

// Set up the provider
const provider = AnchorProvider.env();
Expand Down Expand Up @@ -41,7 +41,7 @@ async function queryEvents(): Promise<void> {
const eventName = argv.eventName || "any";
const programId = argv.programId;
const rpc = createSolanaRpc(provider.connection.rpcEndpoint);
const events = await readProgramEventsV2(rpc, address(programId), SvmSpokeIdl, "confirmed");
const events = await readProgramEvents(rpc, address(programId), SvmSpokeIdl, "confirmed");
const filteredEvents = events.filter((event) => (eventName == "any" ? true : event.name == eventName));
const formattedEvents = filteredEvents.map((event) => stringifyCpiEvent(event));

Expand Down
2 changes: 1 addition & 1 deletion scripts/svm/queryFills.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import * as anchor from "@coral-xyz/anchor";
import { AnchorProvider, BN } from "@coral-xyz/anchor";
import { PublicKey } from "@solana/web3.js";
import { getSpokePoolProgram, readProgramEvents, strPublicKey, u8Array32ToInt } from "@svm/web3-v1";
import yargs from "yargs";
import { hideBin } from "yargs/helpers";
import { getSpokePoolProgram, readProgramEvents, strPublicKey, u8Array32ToInt } from "../../src/svm";

// Set up the provider
const provider = AnchorProvider.env();
Expand Down
2 changes: 1 addition & 1 deletion scripts/svm/queryRoute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
import { PublicKey } from "@solana/web3.js";
import yargs from "yargs";
import { hideBin } from "yargs/helpers";
import { getSpokePoolProgram } from "../../src/svm";
import { getSpokePoolProgram } from "@svm/web3-v1";

// Set up the provider
const provider = AnchorProvider.env();
Expand Down
2 changes: 1 addition & 1 deletion scripts/svm/queryState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { AnchorProvider, BN } from "@coral-xyz/anchor";
import { PublicKey } from "@solana/web3.js";
import yargs from "yargs";
import { hideBin } from "yargs/helpers";
import { getSpokePoolProgram } from "../../src/svm";
import { getSpokePoolProgram } from "@svm/web3-v1";

// Set up the provider
const provider = AnchorProvider.env();
Expand Down
2 changes: 1 addition & 1 deletion scripts/svm/remoteHubPoolPauseDeposits.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
getMessageTransmitterProgram,
getSpokePoolProgram,
isSolanaDevnet,
} from "../../src/svm";
} from "@svm/web3-v1";
import { HubPool__factory } from "../../typechain";
import { requireEnv } from "./utils/helpers";

Expand Down
2 changes: 1 addition & 1 deletion scripts/svm/remoteHubPoolSetDepositRoute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
isSolanaDevnet,
SOLANA_USDC_DEVNET,
SOLANA_USDC_MAINNET,
} from "../../src/svm";
} from "@svm/web3-v1";
import { HubPool__factory } from "../../typechain";
import { CHAIN_IDs } from "../../utils/constants";
import { requireEnv } from "./utils/helpers";
Expand Down
2 changes: 1 addition & 1 deletion scripts/svm/remotePauseDeposits.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
isSolanaDevnet,
MAINNET_CCTP_MESSAGE_TRANSMITTER_ADDRESS,
SEPOLIA_CCTP_MESSAGE_TRANSMITTER_ADDRESS,
} from "../../src/svm";
} from "@svm/web3-v1";
import { CHAIN_IDs } from "../../utils/constants";
import { requireEnv } from "./utils/helpers";

Expand Down
2 changes: 1 addition & 1 deletion scripts/svm/simpleDeposit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
import { PublicKey, Transaction, sendAndConfirmTransaction } from "@solana/web3.js";
import yargs from "yargs";
import { hideBin } from "yargs/helpers";
import { getSpokePoolProgram } from "../../src/svm";
import { getSpokePoolProgram } from "@svm/web3-v1";

// Set up the provider
const provider = AnchorProvider.env();
Expand Down
9 changes: 7 additions & 2 deletions scripts/svm/simpleFakeRelayerRepayment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,15 @@ import {
sendAndConfirmTransaction,
} from "@solana/web3.js";
import { MerkleTree } from "@uma/common/dist/MerkleTree";
import {
RelayerRefundLeafSolana,
RelayerRefundLeafType,
getSpokePoolProgram,
loadExecuteRelayerRefundLeafParams,
relayerRefundHashFn,
} from "@svm/web3-v1";
import yargs from "yargs";
import { hideBin } from "yargs/helpers";
import { getSpokePoolProgram, loadExecuteRelayerRefundLeafParams, relayerRefundHashFn } from "../../src/svm";
import { RelayerRefundLeafSolana, RelayerRefundLeafType } from "../../src/types/svm";

// Set up the provider
const provider = AnchorProvider.env();
Expand Down
2 changes: 1 addition & 1 deletion scripts/svm/simpleFill.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import {
getOrCreateAssociatedTokenAccount,
} from "@solana/spl-token";
import { PublicKey, SystemProgram, Transaction, sendAndConfirmTransaction } from "@solana/web3.js";
import { calculateRelayHashUint8Array, getSpokePoolProgram, intToU8Array32 } from "@svm/web3-v1";
import yargs from "yargs";
import { hideBin } from "yargs/helpers";
import { calculateRelayHashUint8Array, getSpokePoolProgram, intToU8Array32 } from "../../src/svm";

// Set up the provider
const provider = AnchorProvider.env();
Expand Down
3 changes: 1 addition & 2 deletions scripts/svm/utils/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { BN } from "@coral-xyz/anchor";
import { PublicKey } from "@solana/web3.js";
import { MerkleTree } from "@uma/common";
import { relayerRefundHashFn, RelayerRefundLeafSolana, RelayerRefundLeafType } from "@svm/web3-v1";
import { BigNumber, ethers } from "ethers";
import { relayerRefundHashFn } from "../../../src/svm";
import { RelayerRefundLeafSolana, RelayerRefundLeafType } from "../../../src/types/svm";

export const requireEnv = (name: string): string => {
if (!process.env[name]) throw new Error(`Environment variable ${name} is not set`);
Expand Down
1 change: 0 additions & 1 deletion src/svm/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export * from "./web3-v1";
export * from "./web3-v2";
export * from "./assets";
export * from "./clients";
2 changes: 1 addition & 1 deletion src/svm/web3-v1/coders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
} from "@solana/web3.js";
import bs58 from "bs58";
import { Layout } from "buffer-layout";
import { AcrossPlusMessage } from "../../types/svm";
import { AcrossPlusMessage } from "./types";

/**
* Extended Anchor accounts coder to handle large account data.
Expand Down
2 changes: 2 additions & 0 deletions src/svm/web3-v1/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ export * from "./programConnectors";
export * from "./constants";
export * from "./helpers";
export * from "./cctpHelpers";
export * from "../assets";
export * from "./types";
2 changes: 1 addition & 1 deletion src/svm/web3-v1/instructionParamsUtils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Keypair, TransactionInstruction, Transaction, sendAndConfirmTransaction, PublicKey } from "@solana/web3.js";
import { Program, BN } from "@coral-xyz/anchor";
import { RelayData, SlowFillLeaf, RelayerRefundLeafSolana } from "../../types/svm";
import { RelayData, SlowFillLeaf, RelayerRefundLeafSolana } from "./types";
import { SvmSpoke } from "../../../target/types/svm_spoke";
import { LargeAccountsCoder } from "./coders";

Expand Down
2 changes: 1 addition & 1 deletion src/svm/web3-v1/programConnectors.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AnchorProvider, Idl, Program } from "@coral-xyz/anchor";
import { getDeployedAddress } from "../../DeploymentUtils";
import { SupportedNetworks } from "../../types/svm";
import { SupportedNetworks } from "./types";
import {
MessageTransmitterAnchor,
MessageTransmitterIdl,
Expand Down
4 changes: 2 additions & 2 deletions src/svm/web3-v1/relayHashUtils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { BN } from "@coral-xyz/anchor";
import { ethers } from "ethers";
import { RelayerRefundLeaf, RelayerRefundLeafSolana, SlowFillLeaf } from "../../types/svm";
import { RelayerRefundLeaf, RelayerRefundLeafSolana, SlowFillLeaf } from "@svm/web3-v1";
import { serialize } from "borsh";
import { ethers } from "ethers";

/**
* Calculates the relay hash from relay data and chain ID.
Expand Down
Loading

0 comments on commit 1388f03

Please sign in to comment.