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

Circle Wallets #841

Merged
merged 11 commits into from
Feb 7, 2025
Merged

Circle Wallets #841

merged 11 commits into from
Feb 7, 2025

Conversation

d4mr
Copy link
Member

@d4mr d4mr commented Feb 4, 2025

Context:

  • added WalletCredentials table with the plan to normalise all credentials, instead of storing it adhoc
  • there's a isDefault row on credentials, with a restriction for one default per type. The default exists so users don't need to pass credential ID with every create wallet call
  • instead of storing non-credential wallet provider related configuration adhoc, we have a walletProviderConfigs JSONB field that will be typed via zod
    • this makes it easier to add more wallet provider configurations without DB migrations

eventual migration plan to normalised credentials:

  • on the dashboard, prevent people from creating a new backend wallet without linking to a credential. if one doesn't exist, we have a flow that auto creates a default credential from your existing default credential (stored in config today)
  • for folks using the API:
    • when they try to create a new backend wallet, we auto create a default credential using the ones in config.
    • we BLOCK any API changes to modify the older configuration. This way we ensure that the Default credential doesn't go out of sync with the ones in config, (which breaks user expectations)
    • instead we ask them to use the credentials api instead
    • existing wallets that don't use credentials keep working, we keep backwards compatibility

PR-Codex overview

This PR focuses on enhancing wallet credential management, particularly for Circle wallets, by introducing new schemas, routes, and database structures. It also includes error handling improvements and updates to the wallet creation process.

Detailed summary

  • Modified migration.sql to alter the wallet_credentials table.
  • Updated error messages in get-wallet.ts.
  • Added CircleWalletConfiguration type in config.ts.
  • Implemented new request body schema for wallet credentials in create.ts.
  • Added routes for creating and retrieving wallet credentials.
  • Introduced caching for wallet credentials in get-wallet-credential.ts.
  • Enhanced wallet credential creation logic in create-wallet-credential.ts.
  • Added support for Circle wallet types in various schemas and functions.
  • Updated Prisma schema to include walletProviderConfigs and WalletCredentials model.
  • Improved error handling in wallet-related operations.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

Copy link

zeet-co bot commented Feb 4, 2025

We're building your pull request over on Zeet.
Click me for more info about your build and deployment.
Once built, this branch can be tested at: https://tw-unreal-demo-engine-vwn0-pb-cir-332fe3.engine-aws-usw2.zeet.app before merging 😉

Copy link

socket-security bot commented Feb 4, 2025

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/@circle-fin/[email protected] environment, filesystem, network 0 1.4 MB ashuk-circle

🚮 Removed packages: npm/[email protected]

View full report↗︎

Copy link
Member

@joaquim-verges joaquim-verges left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i see what you mean by so many files touched when adding a wallet type xD

@d4mr d4mr merged commit 7c79dba into main Feb 7, 2025
6 of 7 checks passed
@d4mr d4mr deleted the pb/circle-w3s-legacy branch February 7, 2025 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants