Skip to content
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

SDK: update version script to set peer dep versions #471

Merged
merged 3 commits into from
Jul 9, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:

npm publish --access public --tag $tag \
--workspace sdk/definitions \
--workspace sdk/evm \
--workspace evm/ts \
--workspace solana \
--workspace sdk/route
env:
Expand Down
12 changes: 3 additions & 9 deletions sdk/route/__tests__/route.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,15 @@ import {
routes,
} from "@wormhole-foundation/sdk-connect";

import * as testing from "@wormhole-foundation/sdk-definitions/testing";

import "@wormhole-foundation/sdk-definitions-ntt";
import "@wormhole-foundation/sdk-evm-ntt";
import "@wormhole-foundation/sdk-solana-ntt";

import { EvmPlatform } from "@wormhole-foundation/sdk-evm";
import { SolanaPlatform } from "@wormhole-foundation/sdk-solana";
import { nttAutomaticRoute } from "../src/automatic.js";
import { nttManualRoute } from "../src/manual.js";
import { NttRoute } from "../src/types.js";
import { nttAutomaticRoute } from "../src/automatic.js";

const SOL_TOKEN = "EetppHswYvV1jjRWoQKC1hejdeBDHR9NNzNtCyRQfrrQ";
const SEPOLIA_TOKEN = "0x738141EFf659625F2eAD4feECDfCD94155C67f18";
Expand Down Expand Up @@ -92,14 +90,12 @@ describe("Manual Route Tests", function () {
let found: routes.ManualRoute<Network>;
it("Should resolve a given route request", async function () {
const request = await routes.RouteTransferRequest.create(wh, {
from: testing.utils.makeChainAddress("Solana"),
to: testing.utils.makeChainAddress("Sepolia"),
source: Wormhole.tokenId("Solana", SOL_TOKEN),
destination: Wormhole.tokenId("Sepolia", SEPOLIA_TOKEN),
});
const foundRoutes = await resolver.findRoutes(request);
expect(foundRoutes).toHaveLength(1);
expect(foundRoutes[0]!.request.from.chain).toEqual("Solana");
expect(foundRoutes[0]!.request.fromChain.chain).toEqual("Solana");

const rt = foundRoutes[0]!;
if (!routes.isManual(rt)) throw new Error("Expected manual route");
Expand Down Expand Up @@ -185,14 +181,12 @@ describe("Automatic Route Tests", function () {
let found: routes.AutomaticRoute<Network>;
it("Should resolve a given route request", async function () {
const request = await routes.RouteTransferRequest.create(wh, {
from: testing.utils.makeChainAddress("Solana"),
to: testing.utils.makeChainAddress("Sepolia"),
source: Wormhole.tokenId("Solana", SOL_TOKEN),
destination: Wormhole.tokenId("Sepolia", SEPOLIA_TOKEN),
});
const foundRoutes = await resolver.findRoutes(request);
expect(foundRoutes).toHaveLength(1);
expect(foundRoutes[0]!.request.from.chain).toEqual("Solana");
expect(foundRoutes[0]!.request.fromChain.chain).toEqual("Solana");

const rt = foundRoutes[0]!;
if (!routes.isAutomatic(rt)) throw new Error("Expected automatic route");
Expand Down
2 changes: 1 addition & 1 deletion sdk/route/src/manual.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ export class NttManualRoute<N extends Network>
);
const completeTransfer = ntt.completeInboundQueuedTransfer(
toChain.chain,
vaa.payload.nttManagerPayload,
vaa.payload["nttManagerPayload"],
this.request.destination.id.address
);
const finalizeTxids = await signSendWait(toChain, completeTransfer, signer);
Expand Down
9 changes: 9 additions & 0 deletions setSdkVersion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@ function updateVersionInPackageJson(
);
}

if (packageJson.peerDependencies) {
packageJson.peerDependencies = Object.fromEntries(
Object.entries(packageJson.peerDependencies).map((entry) => {
const [k, v] = entry as [string, string];
return [k, packagesInWorkspace.includes(k) ? `${version}` : v];
})
);
}

fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
}

Expand Down
Loading