-
Notifications
You must be signed in to change notification settings - Fork 59
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
chore: track walletType usage #774
base: main
Are you sure you want to change the base?
Conversation
@@ -130,6 +131,8 @@ export type SmartBackendWalletType = (typeof SmartBackendWalletTypes)[number]; | |||
export type BackendWalletType = (typeof BackendWalletTypes)[number]; | |||
export type ParsedWalletDetails = z.infer<typeof walletDetailsSchema>; | |||
|
|||
export const walletDetailsCache = new LRUMap<string, ParsedWalletDetails>(2048); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add caching here because this is called on every write request.
Only caches if wallet details are found. Does not cache DB misses.
// Get wallet details. For EOA and SBW (v5 endpoints), `from` should return a valid backend wallet. | ||
// For SBW (v4 endpoints), `accountAddress` should return a valid backend wallet. | ||
// Else the provided details are incorrect (user error). | ||
let walletDetails: ParsedWalletDetails | undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the big change @d4mr. To track walletType
we need to query walletDetails
for all transactions (not just SBW).
This PR is stale because it has been open for 7 days with no activity. Remove stale label or comment or this PR will be closed in 3 days. |
PR-Codex overview
This PR primarily focuses on renaming the parameter
address
towalletAddress
in various functions and files related to wallet details, enhancing clarity and consistency across the codebase. Additionally, it introduces caching for wallet details to improve performance.Detailed summary
address
towalletAddress
in multiple files:src/utils/cache/getWallet.ts
src/server/routes/backend-wallet/signMessage.ts
src/utils/account.ts
src/utils/cache/clearCache.ts
src/utils/usage.ts
src/db/wallets/getWalletDetails.ts
src/utils/transaction/insertTransaction.ts
walletDetailsCache
insrc/db/wallets/getWalletDetails.ts
for caching wallet details.walletAddress
parameter.walletType
toQueuedTransaction
insrc/utils/transaction/types.ts
.insertTransaction
logic to handle wallet details more effectively.