Skip to content

Commit

Permalink
track amount and denom of successful txs
Browse files Browse the repository at this point in the history
  • Loading branch information
thal0x committed Jul 27, 2023
1 parent 947a5df commit 52f2b58
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/analytics.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import va from "@vercel/analytics";
import { Route } from "./components/TransactionDialog";

export function trackRoute(route: Route) {
va.track("transaction", {
type: route.actionType,
amount: parseFloat(route.amountIn),
asset: route.sourceAsset.symbol,
});
}
3 changes: 3 additions & 0 deletions src/solve/form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { MsgTransfer } from "@injectivelabs/sdk-ts";
import { WalletClient } from "@cosmos-kit/core";
import { useSkipClient } from "./hooks";
import { SkipClient, MsgsRequest } from "./client";
import { trackRoute } from "@/analytics";

const wait = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));

Expand Down Expand Up @@ -536,4 +537,6 @@ export async function executeRoute(

onTxSuccess({}, i);
}

trackRoute(route);
}

0 comments on commit 52f2b58

Please sign in to comment.