Skip to content

Commit

Permalink
Install and use only the required dependencies (#162)
Browse files Browse the repository at this point in the history
  • Loading branch information
barnjamin authored May 21, 2024
1 parent 35b4988 commit dfecfb5
Show file tree
Hide file tree
Showing 46 changed files with 262 additions and 3,606 deletions.
4 changes: 3 additions & 1 deletion evm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
"generate": "typechain --target=ethers-v5 --out-dir=ts/src/types out/*/*.json"
},
"dependencies": {
"@wormhole-foundation/sdk":"^0.7.0-beta.3",
"@wormhole-foundation/sdk-base":"^0.7.0-beta.3",
"@wormhole-foundation/sdk-definitions":"^0.7.0-beta.3",
"@wormhole-foundation/sdk-evm":"^0.7.0-beta.3",
"@wormhole-foundation/example-liquidity-layer-definitions":"0.0.1",
"ethers": "^5.7.2"
},
Expand Down
10 changes: 5 additions & 5 deletions evm/ts/scripts/set_fast_transfer_parameters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { getConfig } from "./helpers";
import { ITokenRouter__factory } from "../src/types/factories/ITokenRouter__factory";
import { ITokenRouter, FastTransferParametersStruct } from "../src/types/ITokenRouter";
import { ethers } from "ethers";
import { Chain, toChainId, toNative } from "@wormhole-foundation/sdk";
import { toChainId } from "@wormhole-foundation/sdk-base";
import { EvmAddress } from "@wormhole-foundation/sdk-evm";

export function getArgs() {
const argv = require("yargs")
Expand Down Expand Up @@ -55,10 +56,9 @@ async function main() {
const routerChainId = toChainId(chain);

// Setup token router contract.
const tokenRouter = ITokenRouter__factory.connect(
toNative(chain as Chain, routers[routerChainId].address).toString(),
wallet,
);

const address = new EvmAddress(routers[routerChainId].address).toString();
const tokenRouter = ITokenRouter__factory.connect(address, wallet);

await setFastTransferParams(routerChainId.toString(), tokenRouter, fastTransferParams);
}
Expand Down
6 changes: 3 additions & 3 deletions evm/ts/scripts/setup_matching_engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { getConfig, ZERO_BYTES32 } from "./helpers";
import { IMatchingEngine__factory, IMatchingEngine } from "../src/types/";
import { RouterEndpointStruct } from "../src/types/IMatchingEngine";
import { ethers } from "ethers";
import { ChainId, toChain, toChainId, toNative } from "@wormhole-foundation/sdk";
import { ChainId, toChain, toChainId } from "@wormhole-foundation/sdk-base";
import { EvmAddress } from "@wormhole-foundation/sdk-evm";

export function getArgs() {
const argv = require("yargs")
Expand Down Expand Up @@ -70,8 +71,7 @@ async function main() {
throw Error("Invalid chainId");
}

const engineChain = toChain(engineChainId);
const engineAddress = toNative(engineChain, matchingEngineConfig["address"]);
const engineAddress = new EvmAddress(matchingEngineConfig["address"]);
// Setup token router contract.
const engine = IMatchingEngine__factory.connect(engineAddress.toString(), wallet);

Expand Down
2 changes: 1 addition & 1 deletion evm/ts/scripts/setup_token_router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ITokenRouter__factory } from "../src/types/factories/ITokenRouter__fact
import { ITokenRouter } from "../src/types/ITokenRouter";
import { EndpointStruct } from "../src/types/ITokenRouter";
import { ethers } from "ethers";
import { toChain, toChainId, toNative } from "@wormhole-foundation/sdk";
import { toChain, toChainId, toNative } from "@wormhole-foundation/sdk-connect";

export function getArgs() {
const argv = require("yargs")
Expand Down
2 changes: 1 addition & 1 deletion evm/ts/src/MatchingEngine/evm.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChainId } from "@wormhole-foundation/sdk";
import { ChainId } from "@wormhole-foundation/sdk-base";
import { ethers } from "ethers";
import { RouterEndpoint, LiveAuctionData, MatchingEngine, RedeemParameters } from ".";
import { LiquidityLayerTransactionResult } from "..";
Expand Down
2 changes: 1 addition & 1 deletion evm/ts/src/TokenRouter/evm.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChainId } from "@wormhole-foundation/sdk";
import { ChainId } from "@wormhole-foundation/sdk-base";
import { ethers } from "ethers";
import { Endpoint, OrderResponse, TokenRouter, FastTransferParameters } from ".";
import { LiquidityLayerTransactionResult } from "..";
Expand Down
1 change: 0 additions & 1 deletion evm/ts/src/TokenRouter/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { VAA } from "@wormhole-foundation/sdk";
import { LiquidityLayerTransactionResult, PreparedInstruction } from "..";
import { ethers } from "ethers";
export * from "./evm";
Expand Down
5 changes: 0 additions & 5 deletions evm/ts/src/consts.ts

This file was deleted.

1 change: 0 additions & 1 deletion evm/ts/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { ethers } from "ethers";

export * from "./MatchingEngine";
export * from "./TokenRouter";
export * from "./consts";
export * from "./error";
export * from "./messages";
export * from "./utils";
Expand Down
2 changes: 1 addition & 1 deletion evm/ts/src/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
messages,
payloads,
} from "@wormhole-foundation/example-liquidity-layer-definitions";
import { toChainId } from "@wormhole-foundation/sdk";
import { toChainId } from "@wormhole-foundation/sdk-base";

export type LiquidityLayerMessageBody = {
fill?: Fill;
Expand Down
4 changes: 2 additions & 2 deletions evm/ts/src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Message } from "@wormhole-foundation/example-liquidity-layer-definitions";
import { ChainId, toChain, toUniversal } from "@wormhole-foundation/sdk";
import { ChainId, toChain } from "@wormhole-foundation/sdk-base";
import { toUniversal } from "@wormhole-foundation/sdk-definitions";
import { ethers } from "ethers";
import { CoreBridgeLiquidityLayerMessage, MessageDecoder } from "./messages";

Expand Down
4 changes: 3 additions & 1 deletion evm/ts/tests/01__registration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ import {
LiquidityLayerEnv,
} from "./helpers";
import { expect } from "chai";
import { toChainId, toNative, toUniversal } from "@wormhole-foundation/sdk";
import { toChainId } from "@wormhole-foundation/sdk-base";
import { toUniversal } from "@wormhole-foundation/sdk-definitions";
import "@wormhole-foundation/sdk-evm";

const CHAIN_PATHWAYS: ValidNetwork[] = ["Ethereum", "Avalanche", "Base"];

Expand Down
3 changes: 2 additions & 1 deletion evm/ts/tests/02__configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import {
parseLiquidityLayerEnvFile,
} from "./helpers";
import { expect } from "chai";
import { toNative, toUniversal } from "@wormhole-foundation/sdk";
import { toUniversal } from "@wormhole-foundation/sdk-definitions";
import "@wormhole-foundation/sdk-evm";

const CHAIN_PATHWAYS: ValidNetwork[] = ["Ethereum", "Avalanche", "Base"];

Expand Down
2 changes: 1 addition & 1 deletion evm/ts/tests/03__marketOrder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
parseLiquidityLayerEnvFile,
tryNativeToUint8Array,
} from "./helpers";
import { serialize, toChainId } from "@wormhole-foundation/sdk";
import { toChainId } from "@wormhole-foundation/sdk-base";

const CHAIN_PATHWAYS: ValidNetwork[][] = [
["Ethereum", "Avalanche"],
Expand Down
5 changes: 4 additions & 1 deletion evm/ts/tests/04__fastMarketOrder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ import {
mineToPenaltyPeriod,
tryNativeToUint8Array,
} from "./helpers";
import { deserialize, keccak256, toChainId, toUniversal } from "@wormhole-foundation/sdk";

import { toChainId } from "@wormhole-foundation/sdk-base";
import { deserialize, keccak256, toUniversal } from "@wormhole-foundation/sdk-definitions";
import "@wormhole-foundation/sdk-evm";

// Cannot send a fast market order from the matching engine chain.
const CHAIN_PATHWAYS: ValidNetwork[][] = [
Expand Down
2 changes: 1 addition & 1 deletion evm/ts/tests/helpers/mock/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Chain } from "@wormhole-foundation/sdk";
import { Chain } from "@wormhole-foundation/sdk-base";
import { ethers } from "ethers";

export * from "./circleAttester";
Expand Down
4 changes: 2 additions & 2 deletions evm/ts/tests/helpers/mock/wormhole.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { ethers } from "ethers";
import { EvmObserver } from ".";
import { parseEvmEvents, parseEvmEvent } from "../../../src";
import { GUARDIAN_PRIVATE_KEY, WORMHOLE_GUARDIAN_SET_INDEX } from "../consts";
import { Chain, VAA, contracts, serialize, toUniversal } from "@wormhole-foundation/sdk";
import { Chain, contracts } from "@wormhole-foundation/sdk-base";
import { serialize, toUniversal } from "@wormhole-foundation/sdk-definitions";
import { mocks } from "@wormhole-foundation/sdk-definitions/testing";
import { tryNativeToUint8Array } from "../utils";

export class GuardianNetwork implements EvmObserver<Uint8Array> {
guardians: mocks.MockGuardians;
Expand Down
3 changes: 2 additions & 1 deletion evm/ts/tests/helpers/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { IERC20 } from "../../src/types";
import { IUSDC__factory } from "../../src/types/factories/IUSDC__factory";
import { WALLET_PRIVATE_KEYS } from "./consts";
import { EvmMatchingEngine } from "../../src";
import { Chain, toUniversal } from "@wormhole-foundation/sdk";
import { Chain } from "@wormhole-foundation/sdk-base";
import { toUniversal } from "@wormhole-foundation/sdk-definitions";

export interface ScoreKeeper {
player: ethers.Wallet;
Expand Down
Loading

0 comments on commit dfecfb5

Please sign in to comment.