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

add preferred route and target asset param #1134

Merged
merged 23 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from 21 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
1 change: 1 addition & 0 deletions apps/connect-v1/src/hooks/useConnectConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { getSortedChains } from "../utils/getSortedChains";

const defaultConfig: WormholeConnectConfig = {
...ENV.wormholeConnectConfig,
// @ts-expect-error: Type error because v1 is outdated
eventHandler: (e: WormholeConnectEvent) => {
if (isPreview || isProduction) {
// Send the event to Mixpanel
Expand Down
6 changes: 6 additions & 0 deletions apps/connect-v1/src/navs/navs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ describe("navs", () => {
toToken: EMPTY_TOKEN,
toChain: 1,
},
// @ts-expect-error: Type error because v1 is outdated
meta: { version: "version", hash: "hash", host: "host" },
});
expect(global.window.history.pushState).toHaveBeenCalledWith(
{ event: "transfer.start" },
Expand All @@ -47,6 +49,8 @@ describe("navs", () => {
toToken: EMPTY_TOKEN,
toChain: 1,
},
// @ts-expect-error: Type error because v1 is outdated
meta: { version: "version", hash: "hash", host: "host" },
});
expect(global.window.history.pushState).toHaveBeenCalledWith(
{ event: "transfer.success" },
Expand All @@ -66,6 +70,8 @@ describe("navs", () => {
toToken: EMPTY_TOKEN,
toChain: 1,
},
// @ts-expect-error: Type error because v1 is outdated
meta: { version: "version", hash: "hash", host: "host" },
});
expect(global.window.history.pushState).toHaveBeenCalledWith(
{ event: "transfer.redeem.success" },
Expand Down
10 changes: 9 additions & 1 deletion apps/connect-v1/src/providers/telemetry.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ describe("telemetry", () => {
});

it("should not track load events", () => {
eventHandler({ type: "load" });
eventHandler({
type: "load",
// @ts-expect-error: Type error because v1 is outdated
meta: { version: "version", hash: "hash", host: "host" },
});

expect(mixpanel.track).not.toHaveBeenCalled();
});
Expand All @@ -44,6 +48,8 @@ describe("telemetry", () => {
chain: "bsc",
wallet: "wallet",
},
// @ts-expect-error: Type error because v1 is outdated
meta: { version: "version", hash: "hash", host: "host" },
});

expect(mixpanel.track).toHaveBeenCalledTimes(1);
Expand All @@ -67,6 +73,8 @@ describe("telemetry", () => {
route: "wstETH Bridge",
txId: "txId",
USDAmount: 123.456,
amount: undefined,
connectVersion: undefined,
});
});

Expand Down
8 changes: 7 additions & 1 deletion apps/connect-v1/src/providers/telemetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ import type { WormholeConnectConfig } from "@wormhole-foundation/wormhole-connec

export type WormholeConnectEvent = Parameters<
NonNullable<WormholeConnectConfig["eventHandler"]>
>[0];
>[0] & {
meta: {
version: string;
hash: string;
};
};

mixpanel.init(
isProduction
Expand Down Expand Up @@ -75,6 +80,7 @@ export const eventHandler = (e: WormholeConnectEvent) => {
txId: e.details.txId,
USDAmount: e.details.USDAmount,
amount: e.details.amount,
connectVersion: e.meta?.version,
route:
{
bridge: "Manual Bridge",
Expand Down
Loading
Loading