Skip to content

Commit

Permalink
chore: comments, unused packages & cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
borcherd committed Feb 14, 2025
1 parent d70f855 commit 57d8e53
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 28 deletions.
4 changes: 1 addition & 3 deletions apps/marginfi-v2-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,7 @@
"tweetnacl": "^1.0.3",
"uuid": "^9.0.0",
"vaul": "^0.9.0",
"zustand": "^4.4.1",
"sonner": "1.7.4",
"next-themes": "0.4.4"
"zustand": "^4.4.1"
},
"devDependencies": {
"@mrgnlabs/eslint-config-custom": "workspace:*",
Expand Down
1 change: 1 addition & 0 deletions apps/marginfi-v2-ui/src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ export default function MrgnApp({ Component, pageProps, path }: AppProps & MrgnA
mrgnState={{ marginfiClient, selectedAccount, extendedBankInfos, nativeSolBalance }}
/>
<ToastContainer position="bottom-left" theme="dark" />
{/* TODO: remove above toast container */}
<ToastProvider />
{globalActionBoxProps.isOpen && <GlobalActionBoxPortal />}
</ActionBoxProvider>
Expand Down
4 changes: 2 additions & 2 deletions packages/mrgn-toasts/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# mrgn-toasts

- Install: `yarn`
- Run: `yarn dev`
- Install: `pnpm install`
- Run: `pnpm run dev`
1 change: 0 additions & 1 deletion packages/mrgn-toasts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
},
"dependencies": {
"sonner": "1.7.4",
"next-themes": "0.4.4",
"@tabler/icons-react": "^3.3.0",
"react": "18.2.0",
"@mrgnlabs/mrgn-common": "workspace:*"
Expand Down
3 changes: 1 addition & 2 deletions packages/mrgn-toasts/src/utils/toast-manager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ export interface MultiStepToastStep {
retry?: () => void;
}

/** 🔹 Type for MultiStepToastController */
export interface MultiStepToastController {
start: () => void;
successAndNext: (explorerUrl?: string, signature?: string) => void;
Expand Down Expand Up @@ -139,5 +138,5 @@ class ToastManager {
}
}

// Exporting singleton instance
// Exporting singleton instance
export const toastManager = new ToastManager();
15 changes: 8 additions & 7 deletions packages/mrgn-utils/src/actions/actions-v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ async function executeActionWrapper(
const txnSig = await action(failedTxns, (explorerUrl, signature) => {
toast.successAndNext(explorerUrl, signature);
});
toast.success("", typeof txnSig === "string" ? txnSig : txnSig[txnSig.length - 1]); // TODO: clean this up
toast.success("", typeof txnSig === "string" ? txnSig : txnSig[txnSig.length - 1]); // TODO: clean this up, always return one signature
return txnSig;
} catch (error) {
if (!(error instanceof ProcessTransactionError || error instanceof SolanaJSONRPCError)) {
Expand Down Expand Up @@ -67,28 +67,29 @@ interface ExecuteActionProps {
callbacks: {
captureEvent: (event: string, properties?: Record<string, any>) => void;
};
}
} // TODO: move to types file


export interface ExecuteDepositSwapActionPropsV2 extends ExecuteActionProps {
infoProps: {
depositToken: string;
swapToken: string;
amount: number;
};
}
} // TODO: move to types file

export async function ExecuteDepositSwapActionV2(props: ExecuteDepositSwapActionPropsV2) {
const steps = getDepositSwapSteps(props.actionTxns);

props.callbacks.captureEvent("user_deposit_swap_initiate", { uuid: props.attemptUuid, ...props.infoProps });
props.callbacks.captureEvent("user_deposit_swap_initiate", { uuid: props.attemptUuid, ...props.infoProps });

const action = async (txns: ActionTxns, onSuccessAndNext: (explorerUrl?: string, signature?: string) => void) => {
return await props.marginfiClient.processTransactions(
txns.transactions,
{
...props.processOpts,
callback: (index, success, sig, stepsToAdvance) => {
success && onSuccessAndNext(undefined, sig); // TODO: add stepsToAdvance & explorerUrl to toast handler
success && onSuccessAndNext(undefined, sig); // TODO: add stepsToAdvance & explorerUrl to toast handler. !! DOES NOT WORK with bundles, need to implement stepsToAdvance
},
},
props.txOpts
Expand All @@ -97,7 +98,7 @@ export async function ExecuteDepositSwapActionV2(props: ExecuteDepositSwapAction

await executeActionWrapper(action, steps, "Deposit", props.actionTxns);

props.callbacks.captureEvent("user_deposit_swap", { uuid: props.attemptUuid, ...props.infoProps }); // TODO: Does this get executed if an error is thrown? Check
props.callbacks.captureEvent("user_deposit_swap", { uuid: props.attemptUuid, ...props.infoProps }); // TODO: Does this get executed if an error is thrown?
}

function getDepositSwapSteps(actionTxns: ActionTxns) {
Expand All @@ -106,4 +107,4 @@ function getDepositSwapSteps(actionTxns: ActionTxns) {
...actionTxns.transactions.map((tx) => ({ label: TransactionConfigMap[tx.type].label })),
];
return steps;
}
} // TODO: update this and move to utils file
13 changes: 0 additions & 13 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 57d8e53

Please sign in to comment.